Differences From Artifact [930b5d7379]:
- File kmem/heapao.fn.c — part of check-in [a8d93823f1] at 2019-08-18 13:42:35 on branch trunk — add functions, generate C syscall table (user: lexi, size: 415) [annotate] [blame] [check-ins using]
- File mod/kmem/heapao.fn.c — part of check-in [14172a910a] at 2019-08-21 06:00:24 on branch trunk — move modules to a subdirectory in order to keep the directory tree organized and make room for OS-specific build files (user: lexi, size: 415) [annotate] [blame] [check-ins using]
To Artifact [e98ef79662]:
- File mod/kmem/heapao.fn.c — part of check-in [e50a476efe] at 2019-08-22 02:52:20 on branch trunk — removed sneaky segfault in x86-64 syscall fn where %r8 (the register that contains the pointer to the syscall arguments from the C syscall wrapper, which need to be copied into the correct registers before the kernel is invoked) gets overwritten if the syscall valency > 5, because of overlapping ccall and syscall ABI argument registers - r8 is clobbered by argument 5 and any further attempts to use it as a ptr segfault at best. also modified the report function so that it immediate cancels compilation if a sub-process reports failure. changed allocator function signatures so they can return a condition code if the kernel reports an error; updated example code so it compiles and runs without fault. (user: lexi, size: 500) [annotate] [blame] [check-ins using]
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
/* heapao.fn.c - kmheapao() "allocate heap object" * ~ lexi hale <lexi@hale.su> * kmheapao() allocates a region in heap memory * and returns a kmptr struct referencing that * newly allocated region. */ kmptr kmheapao(sz size) { void* ptr = kmheapa(size); kmptr p = { .kind = (ptr != null ? kmkind_heap : kmkind_fail), .ref = ptr, .shred = false, }; return p; } |
| | > > > > | |
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/* heapao.fn.c - kmheapao() "allocate heap object" * ~ lexi hale <lexi@hale.su> * kmheapao() allocates a region in heap memory * and returns a kmptr struct referencing that * newly allocated region. */ kmcond kmheapao(kmptr* where, sz size) { void* ptr; kmcond e = kmheapa(&ptr, size); if (e != kmcond_ok) return e; kmptr p = { .kind = (ptr != null ? kmkind_heap : kmkind_fail), .ref = ptr, .shred = false, }; *where = p; return kmcond_ok; } |