Expand the cmdline buffer so that the boot params surely fit in and use that more stable address from now on.
Suggested-by: Ralf Ramsauer <[email protected]> Signed-off-by: Jan Kiszka <[email protected]> --- inmates/tools/x86/linux-loader.c | 16 +++++++++------- tools/jailhouse-cell-linux | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/inmates/tools/x86/linux-loader.c b/inmates/tools/x86/linux-loader.c index cca6056b..f3eca1cd 100644 --- a/inmates/tools/x86/linux-loader.c +++ b/inmates/tools/x86/linux-loader.c @@ -12,8 +12,6 @@ #include <inmate.h> -#define ZERO_PAGE_ADDR HEAP_BASE - struct boot_params { u8 padding1[0x230]; u32 kernel_alignment; @@ -38,18 +36,22 @@ struct setup_data { u8 cpu_ids[SMP_MAX_CPUS]; } __attribute__((packed)); +/* actually not used as command line but for the zero page and setup data */ +CMDLINE_BUFFER(3*PAGE_SIZE); + +static struct boot_params boot_params __attribute__((alias("cmdline"))); + void inmate_main(void) { - struct boot_params *boot_params = (struct boot_params *)ZERO_PAGE_ADDR; void (*entry)(int, struct boot_params *); struct setup_data *setup_data; void *kernel; - kernel = (void *)(unsigned long)boot_params->kernel_alignment; + kernel = (void *)(unsigned long)boot_params.kernel_alignment; - map_range(kernel, boot_params->init_size, MAP_CACHED); + map_range(kernel, boot_params.init_size, MAP_CACHED); - setup_data = (struct setup_data *)boot_params->setup_data; + setup_data = (struct setup_data *)boot_params.setup_data; setup_data->pm_timer_address = comm_region->pm_timer_address; setup_data->pci_mmconfig_base = comm_region->pci_mmconfig_base; setup_data->tsc_khz = comm_region->tsc_khz; @@ -60,5 +62,5 @@ void inmate_main(void) memcpy(setup_data->cpu_ids, smp_cpu_ids, SMP_MAX_CPUS); entry = kernel + 0x200; - entry(0, boot_params); + entry(0, &boot_params); } diff --git a/tools/jailhouse-cell-linux b/tools/jailhouse-cell-linux index 762afc27..f4589c99 100755 --- a/tools/jailhouse-cell-linux +++ b/tools/jailhouse-cell-linux @@ -289,7 +289,7 @@ jailhouse cell load %s linux-loader.bin -a 0x%x %s -a 0x%x ' % return 0 def params_address(self): - return 0x6000 + return 0x1000 def kernel_address(self): return self._zero_page.kernel_load_addr -- 2.13.6 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
