Resolve hisenbugs regarding GCC and -Os
This commit is contained in:
@ -58,7 +58,10 @@ ElfAuxval proc_load_elf_segs(Proc *proc, uint8_t *data) {
|
||||
hal_memset(VIRT(physaddr), 0, blocks * HAL_PAGE_SIZE);
|
||||
hal_memcpy(VIRT(physaddr) + off, (data + phdr->p_offset), phdr->p_filesz);
|
||||
|
||||
uint32_t pgflags = HAL_PG_USER | HAL_PG_RW | HAL_PG_PRESENT;
|
||||
uint32_t pgflags = HAL_PG_USER | HAL_PG_PRESENT;
|
||||
if (phdr->p_flags & PF_W) {
|
||||
pgflags |= HAL_PG_RW;
|
||||
}
|
||||
hal_vmm_map_range(proc->platformdata.cr3, virtaddr, physaddr, blocks * HAL_PAGE_SIZE, pgflags);
|
||||
|
||||
VasRange *range = dlmalloc(sizeof(*range));
|
||||
@ -165,25 +168,8 @@ Proc *proc_spawnuser(char *mountpoint, char *path) {
|
||||
range->pgflags = flags;
|
||||
LL_APPEND(proc->vas, range);
|
||||
|
||||
/* uint8_t *sp = (uint8_t *)pmm_alloc(PROC_STACKBLOCKS) + PROC_STACKSIZE; */
|
||||
/* uint8_t *spbase = sp - PROC_STACKSIZE; */
|
||||
/* uint8_t *kstackp = (uint8_t *)pmm_alloc(PROC_STACKBLOCKS) + PROC_STACKSIZE; */
|
||||
/* proc->platformdata.kstack = kstackp; */
|
||||
/* proc->platformdata.pstack = sp; */
|
||||
|
||||
|
||||
|
||||
/* uint32_t flags = HAL_PG_RW | HAL_PG_USER | HAL_PG_PRESENT; */
|
||||
|
||||
/* hal_vmm_map_range(proc->platformdata.cr3, spbase, spbase, PROC_STACKSIZE, flags); */
|
||||
/* VasRange *range = dlmalloc(sizeof(*range)); */
|
||||
/* range->virtstart = spbase; */
|
||||
/* range->physstart = spbase; */
|
||||
/* range->size = PROC_STACKSIZE; */
|
||||
/* range->pgflags = flags; */
|
||||
/* LL_APPEND(proc->vas, range); */
|
||||
|
||||
ElfAuxval aux = proc_load_elf_segs(proc, data);
|
||||
dlfree(data);
|
||||
|
||||
proc->platformdata.trapframe.ss = 0x20 | 0x3;
|
||||
proc->platformdata.trapframe.rsp = (uint64_t)virttop;
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#define PROC_NAME_MAX 0x100
|
||||
|
||||
#define PROC_STACKBLOCKS 256
|
||||
#define PROC_STACKBLOCKS (1024*4)
|
||||
#define PROC_STACKSIZE (PROC_STACKBLOCKS * BITMAP_BLOCK_SIZE)
|
||||
|
||||
#define PROC_MAX 0x100 // max amount of processes
|
||||
@ -19,8 +19,8 @@
|
||||
#define PROC_VFSHANDLES_MAX 0x80
|
||||
#define PROC_PIPEHANDLES_MAX 0x20
|
||||
|
||||
#define PROC_MMAN_MAP_BASE 0x0000004000000000ULL
|
||||
#define PROC_USER_STACK_TOP 0x00007ffffffff000ULL
|
||||
#define PROC_MMAN_MAP_BASE 0x700000000000
|
||||
#define PROC_USER_STACK_TOP 0x800000000000
|
||||
|
||||
typedef struct {
|
||||
IntrStackFrame trapframe;
|
||||
|
Reference in New Issue
Block a user