ref: f6d48501c4c475c5c9cad077ae6b206e72e0c65d
parent: 07665995b1973c612a8874badec060114393fa4d
author: halfwit <michaelmisch1985@gmail.com>
date: Thu May 22 18:48:58 PDT 2025
Still working through the start bits, not there
--- a/kern/fns.h
+++ b/kern/fns.h
@@ -222,12 +222,9 @@
ulong ticks(void);
void osproc(Proc*);
void osexec(Proc*);
-void osbuildtext(Chan *);
-void osbuilddata(Chan *);
-void osbuildbss(Chan *);
-void ospatchtext(void);
+void *osbuildmem(Chan *, uintptr, uintptr, uintptr, int);
void osnewproc(Proc*);
-void osclrmem(void);
+void osclrmem(uintptr, uintptr);
void procsleep(void);
void procwakeup(Proc*);
void osinit(void);
--- a/kern/posix.c
+++ b/kern/posix.c
@@ -270,13 +270,13 @@
error("read error");
/* Contiguous memory block for text/data/bss */
- binary = mmap(nil, UTZERO+n+bss, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
+ binary = mmap(nil, n+bss, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if(binary == MAP_FAILED)
error("Failed: %r");
/* Mark text portion executable */
- memcpy(binary+UTZERO, exec, n);
- if(mprotect(binary+UTZERO, ts, PROT_EXEC|PROT_READ) != 0)
+ memcpy(binary, exec, n);
+ if(mprotect(binary, ts, PROT_EXEC|PROT_READ) != 0)
error("Unable to mprotect: %r");
free(exec);