native,platform: small refactor
This commit is contained in:
parent
ad9504123f
commit
e8f6374f4b
1 changed files with 2 additions and 3 deletions
|
@ -14,12 +14,11 @@
|
||||||
static int pmem_fd = 0;
|
static int pmem_fd = 0;
|
||||||
static void *pmem = NULL;
|
static void *pmem = NULL;
|
||||||
static ucontext_t uc_example = {};
|
static ucontext_t uc_example = {};
|
||||||
static int sys_pgsz;
|
|
||||||
static void *(*memcpy_libc)(void *, const void *, size_t) = NULL;
|
static void *(*memcpy_libc)(void *, const void *, size_t) = NULL;
|
||||||
sigset_t __am_intr_sigmask = {};
|
sigset_t __am_intr_sigmask = {};
|
||||||
__am_cpu_t *__am_cpu_struct = NULL;
|
__am_cpu_t *__am_cpu_struct = NULL;
|
||||||
int __am_ncpu = 0;
|
int __am_ncpu = 0;
|
||||||
int __am_pgsize;
|
int __am_pgsize = 0;
|
||||||
|
|
||||||
static void save_context_handler(int sig, siginfo_t *info, void *ucontext) {
|
static void save_context_handler(int sig, siginfo_t *info, void *ucontext) {
|
||||||
memcpy_libc(&uc_example, ucontext, sizeof(uc_example));
|
memcpy_libc(&uc_example, ucontext, sizeof(uc_example));
|
||||||
|
@ -78,7 +77,7 @@ static void init_platform() {
|
||||||
thiscpu->vm_head = NULL;
|
thiscpu->vm_head = NULL;
|
||||||
|
|
||||||
// create trap page to receive syscall and yield by SIGSEGV
|
// 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,
|
void *ret = mmap(TRAP_PAGE_START, sys_pgsz, PROT_NONE,
|
||||||
MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
|
||||||
assert(ret != (void *)-1);
|
assert(ret != (void *)-1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue