mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-04 04:27:34 +00:00
It turns out that in ELF files there *is* a difference between file size and mem size. Mem size is the size of the chunk of memory, but file size is the size of what we copy into there from the file. Most of the time they are the same, which is why previously `spawn' only considered mem size, but this caused issues. In particular, in the xous implementation of the rust standard library, there whenever something is allocated it has to first check an AtomicI32 LOCKED to see if it is 0 or 1, and set it to 1 when it is allocating so that only one thing is allocating at a time. However, the mem size for the section containing LOCKED is larger than the file size, meaning that `spawn' copied more of the file that it should have. This lead to junk being put into LOCKED, which caused the new process to assume that something else was perpetually allocating. Now, `spawn' puts 0's in the space between the end of the file size and the end of the memsize, which makes everything work as expected. The only problem remaining is that when an app registers for GAM, GAM checks whether the app is allowed to register, which is based on what apps were included in the image. Obviously, this does not work when you are trying to load apps that are not already in the image |
||
|---|---|---|
| .. | ||
| spawn | ||
| src | ||
| Cargo.toml | ||