summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2023-02-23 15:38:17 +0100
committerdzwdz2023-02-23 15:38:17 +0100
commitc9daa8909313b020df57605d0bd50ac48b208d58 (patch)
tree7051752002999e648619bc91e4d99edfda7b9f01 /src
parent5715a511fcd0490dfc74579ee95f88ef1877f021 (diff)
toolchain: update, move to a Camellia-specific toolchain
Diffstat (limited to 'src')
-rw-r--r--src/kernel/syscalls.c1
-rw-r--r--src/user/lib/elfload.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 259b59f..0810720 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -319,6 +319,7 @@ void __user *_sys_memflag(void __user *addr, size_t len, int flags) {
addr = (userptr_t)((uintptr_t __force)addr & ~PAGE_MASK); // align to page boundary
if (flags & MEMFLAG_FINDFREE) {
+ // TODO space out page allocations to catch stupid bugs
addr = pagedir_findfree(pages, addr, len);
if (!(flags & MEMFLAG_PRESENT))
SYSCALL_RETURN((uintptr_t)addr);
diff --git a/src/user/lib/elfload.c b/src/user/lib/elfload.c
index cb7ce58..3862534 100644
--- a/src/user/lib/elfload.c
+++ b/src/user/lib/elfload.c
@@ -160,7 +160,7 @@ void elf_exec(void *base, char **argv, char **envp) {
void *exebase = elf_loadmem(ehdr);
if (!exebase) return;
- void *newstack = _sys_memflag((void*)0x11000, 0x1000, MEMFLAG_FINDFREE | MEMFLAG_PRESENT);
+ void *newstack = _sys_memflag((void*)0x11000, 0x1000, MEMFLAG_FINDFREE | MEMFLAG_PRESENT) + 0x1000 - 8;
if (!newstack) return;
_freejmp_chstack(exebase + ehdr->e_entry, exebase, elf_spread(ehdr) + 0x1000, (const char**)argv, envp, newstack);