Simple ELF program loader

Now any initrd file is treated like a program image and passed to the
loader to load as a process. Very rudimentary elf loading just allocates
pages, copies sections, and sets the ELF's entrypoint as the RIP to
iretq to.
This commit is contained in:
Justin C. Miller
2018-09-06 01:31:47 -07:00
parent 3d0b262435
commit 585abe9a18
13 changed files with 321 additions and 51 deletions

View File

@@ -17,9 +17,9 @@ memset(void *s, uint8_t v, size_t n)
}
void *
memcpy(void *dest, void *src, size_t n)
memcpy(void *dest, const void *src, size_t n)
{
uint8_t *s = reinterpret_cast<uint8_t *>(src);
const uint8_t *s = reinterpret_cast<const uint8_t *>(src);
uint8_t *d = reinterpret_cast<uint8_t *>(dest);
for (size_t i = 0; i < n; ++i) d[i] = s[i];
return d;

View File

@@ -35,7 +35,7 @@ void * memset(void *p, uint8_t v, size_t n);
/// \src The memory to copy from
/// \n The number of bytes to copy
/// \returns A pointer to the destination memory
void * memcpy(void *dest, void *src, size_t n);
void * memcpy(void *dest, const void *src, size_t n);
/// Read a value of type T from a location in memory
/// \arg p The location in memory to read