<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 8, 2021, 3:00 PM Chris Johns <<a href="mailto:chrisj@rtems.org">chrisj@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 9/2/21 12:37 am, Joel Sherrill wrote:<br>
> On Mon, Feb 8, 2021 at 12:44 AM Chris Johns <<a href="mailto:chrisj@rtems.org" target="_blank" rel="noreferrer">chrisj@rtems.org</a><br>
> <mailto:<a href="mailto:chrisj@rtems.org" target="_blank" rel="noreferrer">chrisj@rtems.org</a>>> wrote:<br>
> <br>
> On 8/2/21 5:38 pm, Sebastian Huber wrote:<br>
> ><br>
> > On 08/02/2021 07:30, <a href="mailto:chrisj@rtems.org" target="_blank" rel="noreferrer">chrisj@rtems.org</a> <mailto:<a href="mailto:chrisj@rtems.org" target="_blank" rel="noreferrer">chrisj@rtems.org</a>> wrote:<br>
> >> diff --git a/cpukit/libcsupport/src/rtems_heap_greedy.c<br>
> >> b/cpukit/libcsupport/src/rtems_heap_greedy.c<br>
> >> index 4dda39873f..2361f17d2e 100644<br>
> >> --- a/cpukit/libcsupport/src/rtems_heap_greedy.c<br>
> >> +++ b/cpukit/libcsupport/src/rtems_heap_greedy.c<br>
> >> @@ -30,8 +30,20 @@ void *rtems_heap_greedy_allocate(<br>
> >> size_t block_count<br>
> >> )<br>
> >> {<br>
> >> + Heap_Control *heap = RTEMS_Malloc_Heap;<br>
> >> + size_t size = 128 * 1024 * 1024;<br>
> >> void *opaque;<br>
> >> + while (size > 0) {<br>
> >> + opaque = (*rtems_malloc_extend_handler)( heap, size );<br>
> >> + if (opaque == NULL) {<br>
> >> + size >>= 1;<br>
> >> + } else {<br>
> >> + if ( rtems_malloc_dirty_helper != NULL )<br>
> >> + (*rtems_malloc_dirty_helper)( opaque, size );<br>
> >> + }<br>
> >> + }<br>
> > You need a couple of more ' ' after and before the braces. Each if should<br>
> have a<br>
> > { }. Apart from the formatting it looks good.<br>
> <br>
> Thanks, I will fix the formatting and push.<br>
> <br>
> And there is no performance issue on hardware so that must be a psim thing.<br>
> <br>
> <br>
> What performance issue do you think there could have been?<br>
<br>
I do not know. I have never looked at how psim is implemented. I believe the<br>
slow down inside the simulator.<br>
<br>
> This must just be a side-effect of the PowerPC BSPs which have more than 32MB <br>
> RAM and want to support dynamically loading code. They must ensure that no<br>
> branches or calls exceed 32MB from the current location. Thus it has to be loaded <br>
> early in program life before the heap is extended.<br>
<br>
This is inside the simulator?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">No. This is BSP behavior for a number of the PowerPC BSPs. </div><div dir="auto"><br></div><div dir="auto">If less than 32mb or no one ever used dynamic loading on it, then it doesn't have sbrk support. And since dynamic loading was only available with Till's cexp until you added dynamic loading, this tends to only show up in bsps which are used with EPICS.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> Are there other supported architectures where code must fit into a subset of the<br>
> address space where it could negatively impact dynamic loading?<br>
<br>
ARM.<br>
<br>
> How does the DL code deal with PPC code that is built without the -mlongcall <br>
> option?<br>
<br>
libdl adds a trampoline ...<br>
<br>
<a href="https://git.rtems.org/rtems/tree/cpukit/libdl/rtl-mdreloc-powerpc.c#n184" rel="noreferrer noreferrer" target="_blank">https://git.rtems.org/rtems/tree/cpukit/libdl/rtl-mdreloc-powerpc.c#n184</a><br>
<br>
Chris<br>
<br>
> EPICS discusses this here:<br>
> <br>
> <a href="https://epics.anl.gov/base/ppc.php" rel="noreferrer noreferrer" target="_blank">https://epics.anl.gov/base/ppc.php</a> <<a href="https://epics.anl.gov/base/ppc.php" rel="noreferrer noreferrer" target="_blank">https://epics.anl.gov/base/ppc.php</a>><br>
> <br>
> --joel<br>
> <br>
> <br>
> Chris<br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a> <mailto:<a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a>><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
> <<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a>><br>
> <br>
</blockquote></div></div></div>