Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try overwriting supervisor stack to reclaim RAM #87

Open
projectgus opened this issue Feb 16, 2016 · 0 comments
Open

Try overwriting supervisor stack to reclaim RAM #87

projectgus opened this issue Feb 16, 2016 · 0 comments

Comments

@projectgus
Copy link
Contributor

This was brought up in #76 but the initial fix for the issue doesn't address it, so I'm spinning it off here.

When the RTOS scheduler starts we reserve the memory used for the pre-scheduler stack as "supervisor stack", but if scheduler never exits then we can probably clobber this memory and reuse it for heap.

Amount to potentially save is unclear. sdk_user_start has the stack at approx 0x3ffffce9, and the current high water mark when the scheduler starts is 0x3ffffc10. So potential saving may be ~217 bytes, or may be more if the ROM functions also allocate stack memory before calling user_start that can be reused.

Will need to tread carefully as some ROM functions may also make use of hard-coded memory regions at the top of memory here.

The task for someone to try is:

  • When the scheduler starts, set the stack limit to 0x3ffffce9 (or higher) and see if any memory corruption issues appear.
  • Devise automated tests to try and expose any likely memory corruption issues (context switches, calling ROM functions, etc.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant