hv: replace MEM_2K with a new macro MAX_BOOTARGS_SIZE for bootargs size

- for all cases of referring guest bootargs size, replace MEM_2K with
  CONFIG_MAX_BOOTARGS_SIZE for better readability.
- remove duplicated MAX_BOOTARGS_SIZE definition from vm_config.h.

Also fix one minor issue in general_sw_loader() which uses copy_to_gpa()
to copy a string. Since copy_to_gpa() makes use of memncpy_s() to do the
job, the size parameter should include the string null ternimator.

Tracked-On: #2806
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Zide Chen
2019-03-19 08:42:36 -07:00
committed by wenlingz
parent 12d977284a
commit 370998ba5a
5 changed files with 22 additions and 15 deletions

View File

@@ -14,6 +14,9 @@
#define MULTIBOOT_INFO_HAS_DRIVES 0x00000080U
#define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200U
/* maximum lengt of the guest OS' command line parameter string */
#define MAX_BOOTARGS_SIZE 2048U
struct acrn_vm;
struct multiboot_info {
uint32_t mi_flags;

View File

@@ -9,8 +9,8 @@
#include <types.h>
#include <pci.h>
#include <multiboot.h>
#define MAX_BOOTARGS_SIZE 1024U
#define MAX_CONFIG_NAME_SIZE 32U
#define PLUG_CPU(n) (1U << (n))