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

Relocatable executables (i.e. TSRs) #90

Open
thejpster opened this issue Jan 14, 2024 · 1 comment
Open

Relocatable executables (i.e. TSRs) #90

thejpster opened this issue Jan 14, 2024 · 1 comment

Comments

@thejpster
Copy link
Member

The -C relocation-model=pie option for rustc will produce an executable where code and data are designed to be in the same region (i.e. RAM) and can be located anywhere provided their relative offsets remain the same.

This means we should be able to load a TSR if it has been compiled as pie. It could occupy the top part of RAM and hook itself into the OS, perhap by replacing one of the OS API functions with itself. This would require the OS API table to be in RAM, but that's plausible - it's not too large and we do have 4K of OS reserved RAM. It would also allow the loading of multiple programs simultaneously (e.g. running a linker during a compilation) without moving the first program out of the way so the second can have access to the usual start address (0x2000_1000).

@thejpster
Copy link
Member Author

thejpster commented Jan 14, 2024

This is distinct from the "ropi-rwpi" model, where the RW data can be relocated separately to the RO code/data, and register R9 is used to tell the RO code where the RW data has been located. That doesn't apply here because we have the usual (for a microcontroller) case of code + data being together in RAM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant