native,platform: small refactor

This commit is contained in:
Zihao Yu 2022-11-09 16:23:46 +08:00
parent ad9504123f
commit e8f6374f4b

View file

@ -14,12 +14,11 @@
static int pmem_fd = 0;
static void *pmem = NULL;
static ucontext_t uc_example = {};
static int sys_pgsz;
static void *(*memcpy_libc)(void *, const void *, size_t) = NULL;
sigset_t __am_intr_sigmask = {};
__am_cpu_t *__am_cpu_struct = NULL;
int __am_ncpu = 0;
int __am_pgsize;
int __am_pgsize = 0;
static void save_context_handler(int sig, siginfo_t *info, void *ucontext) {
memcpy_libc(&uc_example, ucontext, sizeof(uc_example));
@ -78,7 +77,7 @@ static void init_platform() {
thiscpu->vm_head = NULL;
// create trap page to receive syscall and yield by SIGSEGV
sys_pgsz = sysconf(_SC_PAGESIZE);
int sys_pgsz = sysconf(_SC_PAGESIZE);
void *ret = mmap(TRAP_PAGE_START, sys_pgsz, PROT_NONE,
MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
assert(ret != (void *)-1);