diff --git a/d9_bpt64.S b/d9_bpt64.S index ed49b921c8a22e3fa6b1f20300f2a5da7deefcc2..47f565f61643527e07f2a952c7781f220105f91f 100644 --- a/d9_bpt64.S +++ b/d9_bpt64.S @@ -22,10 +22,12 @@ bpt_unmap_mrd: .quad 0x0000000040000000 /* 1GB */ .quad 0x0000000040000000 /* 1GB */ + .quad 0x0000000040000000 /* Page-aligned */ /* Used for struct ukplat_memregion_desc * Unmapping starts at 1GB and ends at 4GB */ .quad 0x00000000c0000000 + .quad 0x00000000000c0000 /* Page count */ .short 0x0000000000000000 .short 0x0000000000000010 /* UKPLAT_MEMRF_UNMAP */ .space 36 diff --git a/setup.c b/setup.c index 48c3c96ef2b164f04228b210f2db1632c5fe0203..b4e3a7b7c9084d889573ae90eae0e5deab630234 100644 --- a/setup.c +++ b/setup.c @@ -15,12 +15,13 @@ #include #endif /* CONFIG_ENFORCE_W_XOR_X && CONFIG_PAGING */ -static char *cmdline; +static __u64 cmdline; static __sz cmdline_len; static inline int cmdline_init(struct ukplat_bootinfo *bi) { char *cmdl; + int rc; if (bi->cmdline_len) { cmdl = (char *)bi->cmdline; @@ -36,21 +37,22 @@ static inline int cmdline_init(struct ukplat_bootinfo *bi) * by `ukplat_entry_argp` to obtain argc/argv. So mark it as a kernel * resource instead. */ - cmdline = ukplat_memregion_alloc(cmdline_len + 1, UKPLAT_MEMRT_KERNEL, - UKPLAT_MEMRF_READ | UKPLAT_MEMRF_WRITE | - UKPLAT_MEMRF_MAP); - if (unlikely(!cmdline)) + rc = ukplat_memregion_alloc(cmdline_len + 1, UKPLAT_MEMRT_KERNEL, + UKPLAT_MEMRF_READ | UKPLAT_MEMRF_WRITE, + &cmdline); + if (unlikely(rc)) return -ENOMEM; - memcpy(cmdline, cmdl, cmdline_len); - cmdline[cmdline_len] = 0; + memcpy((void *)cmdline, cmdl, cmdline_len); + cmdl = (char *)cmdline; + cmdl[cmdline_len] = 0; return 0; } static void __noreturn _ukplat_entry2(void) { - ukplat_entry_argp(NULL, cmdline, cmdline_len); + ukplat_entry_argp(NULL, (char *)cmdline, cmdline_len); ukplat_lcpu_halt(); } @@ -58,7 +60,7 @@ static void __noreturn _ukplat_entry2(void) void _libd9plat_entry(void *fdtp) { int rc; - void *bstack; + __u64 bstack; struct ukplat_bootinfo *bi; ukplat_bootinfo_fdt_setup(fdtp); @@ -75,12 +77,12 @@ void _libd9plat_entry(void *fdtp) UK_CRASH("Failed to initialize command-line\n"); /* Allocate boot stack */ - bstack = ukplat_memregion_alloc(__STACK_SIZE, UKPLAT_MEMRT_STACK, - UKPLAT_MEMRF_READ | UKPLAT_MEMRF_WRITE | - UKPLAT_MEMRF_MAP); - if (unlikely(!bstack)) + rc = ukplat_memregion_alloc(__STACK_SIZE, UKPLAT_MEMRT_STACK, + UKPLAT_MEMRF_READ | UKPLAT_MEMRF_WRITE, + &bstack); + if (unlikely(rc)) UK_CRASH("Boot stack alloc failed\n"); - bstack = (void *)((__uptr)bstack + __STACK_SIZE); + bstack = (__u64)((__uptr)bstack + __STACK_SIZE); /* Initialize paging */ rc = ukplat_mem_init(); @@ -111,7 +113,7 @@ void _libd9plat_entry(void *fdtp) /* * Switch away from the bootstrap stack as early as possible. */ - uk_pr_info("Switch from bootstrap stack to stack @%p\n", bstack); + uk_pr_info("Switch from bootstrap stack to stack @%lx\n", bstack); /* Print boot information */ uk_pr_info("Print bootinfo before jump to entry:\n"); @@ -120,5 +122,5 @@ void _libd9plat_entry(void *fdtp) /* * Enter Unikraft with new allocated stack. */ - lcpu_arch_jump_to(bstack, _ukplat_entry2); + lcpu_arch_jump_to((void *)bstack, _ukplat_entry2); }