HV: init and sanitize acrn multiboot info

Initialize and sanitize a acrn specific multiboot info struct with current
supported multiboot1 in very early boot stage, which would bring below
benifits:

- don't need to do hpa2hva convention every time when refering boot_regs;

- panic early if failed to sanitize multiboot info, so that don't need to
  check multiboot info pointer/flags and panic in later boot process;

- keep most code unchanged when introduce multiboot2 support in future;

Tracked-On: #4419

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2020-02-17 09:24:44 +08:00
committed by wenlingz
parent 520a0222d3
commit 19ffaa50dc
12 changed files with 162 additions and 92 deletions

View File

@@ -41,17 +41,12 @@ static uint32_t parse_seed_arg(void)
{
char *cmd_src = NULL;
char *arg, *arg_end;
struct multiboot_info *mbi = NULL;
struct acrn_multiboot_info *mbi = get_multiboot_info();
uint32_t i = SEED_ARG_NUM - 1U;
uint32_t len;
if (boot_regs[0U] == MULTIBOOT_INFO_MAGIC) {
mbi = (struct multiboot_info *)hpa2hva((uint64_t)boot_regs[1U]);
if (mbi != NULL) {
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
cmd_src = (char *)hpa2hva((uint64_t)mbi->mi_cmdline);
}
}
if ((mbi->mi_flags & MULTIBOOT_INFO_HAS_CMDLINE) != 0U) {
cmd_src = mbi->mi_cmdline;
}
if (cmd_src != NULL) {