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:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user