- Status Closed
- Percent Complete
- Task Type Patches
- Category Operating System/Drivers
- Assigned To No-one
- Operating System Generic RaaA
- Severity Low
- Priority Very Low
- Reported Version Daily build (which?)
- Due in Version Undecided
-
Due Date
Undecided
- Votes
- Private
Attached to Project: Rockbox
Opened by thomasjfox - 2011-03-03
Last edited by thomasjfox - 2011-03-03
Opened by thomasjfox - 2011-03-03
Last edited by thomasjfox - 2011-03-03
FS#11985 - Fix stack size calculation on 64bit sim/RaaA builds
Fix stack size calculation on 64bit sim/RaaA builds.
sizeof(long) is usually 8 bytes on 64bit and will
result in a too small stack size. Discovered while
writing the new “power” thread for RaaA.
When using sigaltstack + “DEFAULT_STACK_SIZE/sizeof(long)” in firmware/hosted/powermgmt.c on 64bit, rockbox will stall during startup.
kugel, is that change correct? Or might there be an other issue?
Loading...
Available keyboard shortcuts
- Alt + ⇧ Shift + l Login Dialog / Logout
- Alt + ⇧ Shift + a Add new task
- Alt + ⇧ Shift + m My searches
- Alt + ⇧ Shift + t focus taskid search
Tasklist
- o open selected task
- j move cursor down
- k move cursor up
Task Details
- n Next task
- p Previous task
- Alt + ⇧ Shift + e ↵ Enter Edit this task
- Alt + ⇧ Shift + w watch task
- Alt + ⇧ Shift + y Close Task
Task Editing
- Alt + ⇧ Shift + s save task
That looks wrong. The default stack size is supposed to be DEFAULT_STACK_SIZE bytes. It's allocated as an array of long for alignment reasons, so the number of elements of DEFAULT_STACK_SIZE/sizeof(long) is the correct one. If you suddenly make it DEFAULT_STACK_SIZE/sizeof(int), DEFAULT_STACK_SIZE is suddenly in units of two bytes, which really can't be correct.
It is of course possible that stack usage is bigger on 64 bit systems, in which case DEFAULT_STACK_SIZE itself should be increased.
I agree with gevearts. Furthermore (except on windows) a long is what's actually put onto the stack.
I can't really imagine that the power thread needs more than DEFAULT_STACK_SIZE, but you can always bump that stack (or DEFAULT_STACK_SIZE).
Now I can see it, too…
That's also the reason my code wasn't working before as I first had this in firmware/target/hosted/powermgmnt.c:
static char power_stack[DEFAULT_STACK_SIZE/sizeof(long)];
Testing it with this works, too:
static long power_stack[DEFAULT_STACK_SIZE/sizeof(long)];
Will close the ticket. Thanks for looking into this, both of you.