Skip to content

Instantly share code, notes, and snippets.

@kiryl
Created May 11, 2020 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiryl/d45eb54110944ff95e544972d8bdac1d to your computer and use it in GitHub Desktop.
Save kiryl/d45eb54110944ff95e544972d8bdac1d to your computer and use it in GitHub Desktop.
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 5143c516531e..47dc6650b3ba 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -963,14 +963,17 @@ void pc_memory_init(PCMachineState *pcms,
memory_region_add_subregion(system_memory, 0, ram_below_4g);
e820_add_entry(0, x86ms->below_4g_mem_size, E820_RAM);
if (x86ms->above_4g_mem_size > 0) {
+ hwaddr offset = (1UL << 46) - (1UL << 30);
+// hwaddr offset = 1UL << 46;
+// hwaddr offset = (1UL << 50);
ram_above_4g = g_malloc(sizeof(*ram_above_4g));
memory_region_init_alias(ram_above_4g, NULL, "ram-above-4g",
machine->ram,
x86ms->below_4g_mem_size,
x86ms->above_4g_mem_size);
- memory_region_add_subregion(system_memory, 0x100000000ULL,
+ memory_region_add_subregion(system_memory, offset,
ram_above_4g);
- e820_add_entry(0x100000000ULL, x86ms->above_4g_mem_size, E820_RAM);
+ e820_add_entry(offset, x86ms->above_4g_mem_size, E820_RAM);
}
if (!pcmc->has_reserved_memory &&
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index e818fc712aca..ae202f6239b7 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1942,7 +1942,7 @@ uint64_t cpu_get_tsc(CPUX86State *env);
/* XXX: This value should match the one returned by CPUID
* and in exec.c */
# if defined(TARGET_X86_64)
-# define TCG_PHYS_ADDR_BITS 40
+# define TCG_PHYS_ADDR_BITS 52
# else
# define TCG_PHYS_ADDR_BITS 36
# endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment