xous-core/apps/app-loader
Vihaan Jim 9eeed0d284 Add distinction between p_filesz and p_memsz
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
2023-08-04 17:54:06 -04:00
..
spawn Add distinction between p_filesz and p_memsz 2023-08-04 17:54:06 -04:00
src Add distinction between p_filesz and p_memsz 2023-08-04 17:54:06 -04:00
Cargo.toml Turn app-loader into an app instead of a service 2023-08-01 22:16:40 -04:00