AppSize in !Boot
Colin (478) 2433 posts |
For the last 3 days I’ve been trying to make a beagleboard rom image but when I put my new USB modules in it it doesn’t boot. As it changes to the desktop and the splash screen appears, an error box pops up with no text, buttons or icon in it. The iconbar hasn’t appeared at this point. Though I can’t do anything I can move the mouse so USB is working. I can unplug and reinsert the mouse and other devices and the hub lights go on and off and the mouse continues working. If I use the old usbdriver file with my new ehci driver it boots ok so I thought there must be something wrong with my new usbdriver file. However if I remove the line
from What does appsize do? |
Wouter Rademaker (458) 197 posts |
https://www.riscosopen.org/wiki/documentation/show/*AppSize This command is used at startup to shrink the RMA to its smallest possible size, and should not be used by other applications. |
Steve Pampling (1551) 8172 posts |
Isn’t the board you have an old Beagle rather than an XM? From the Rev C4 manual 5.3 A quick check on the wiki page show 256MB vs. 512MB in the XM So that command appears to be trying to set the RMA to a size bigger than the board memory. |
Colin (478) 2433 posts |
I don’t think the value matters too much. I think it just free’s up available memory. Its just a puzzle that with my new modules if I abort Bootrun after |
WPB (1391) 352 posts |
Does disabling networking have any effect, since that’s via USB too, right? |
Colin (478) 2433 posts |
Disabling networking made no difference. Tracking the bug through !Boot doesn’t look as if it is going to help either. I created a short obey file
and put it at various points in !boot. It entered the desktop correctly right up until I put it as the last line in If I put the obey file in the line before the last line it works correctly even though the line it was put before is just a comment. It looks like at some point memory usage grows to the point where appsize does something and causes a failure. I can’t even see how the new usbdriver module uses memory any different to the old usbdriver. I’ve run out of ideas at the moment. |
WPB (1391) 352 posts |
Yeah, that is very weird indeed. I hope someone with the knowledge can help you soon. Fingers crossed… |
Colin (478) 2433 posts |
Investigating further Appsize (line 332 here) changes the RMA dynamic area size. If I add I note in BootRun after the line
So this may be a problem that is supposed to be fixed. Anyone any thoughts? |
Jeffrey Lee (213) 6048 posts |
What you’re most likely experiencing is one of the limitations of OS_ChangeDynamicArea – you aren’t allowed to resize a dynamic area from within an IRQ handler. So in the worst-case situation of an unfragmented RMA, if AppSize is allowed to shrink it to its minimum size then there’ll only be under 4K of space available for IRQ handlers to allocate memory from. If they use up that 4K (or need something larger) then they have no way of growing the RMA, other than having some kind of fallback path which will register a callback to allow the operation to be performed from the foreground (assuming there’s enough memory available to register the callback!) At this stage I think the simplest fix would be to remove the “If Boot$OSVersion < 350 Then” bit and just make it so that all versions of the OS add 256K to the RMA after shrinking it. Later on it might be nice to have the RMA resize itself automatically to try and ensure there’s a minimum amount of free space available for IRQ code. Or even better, allow OS_ChangeDynamicArea from IRQ handlers! (But that would be a pretty big change, especially since it does things like issue service calls to warn applications of the memory being moved) |
Colin (478) 2433 posts |
Thanks Jeffrey That seems a reasonable explanation to me – Thank goodness I didn’t rip my code to shreds :-) |
Steve Revill (20) 1361 posts |
Bodge alert… HeapUtils ! |