x86: Change 4-level page table base address to low memory
authorBin Meng <bmeng.cn@gmail.com>
Thu, 31 Jan 2019 16:22:12 +0000 (08:22 -0800)
committerBin Meng <bmeng.cn@gmail.com>
Tue, 12 Feb 2019 06:37:16 +0000 (14:37 +0800)
At present the 4-level page table base address for 64-bit U-Boot
proper is assigned an address that conflicts with CONFIG_LOADADDR.
Change it to an address within the low memory range instead.

Fixes crashes seen when 'dhcp' on QEMU x86_64 with
"-net nic -net user,tftp=.,bootfile=u-boot".

Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/i386/cpu.c

index 208ef08562d0c04090c51c46168dc6dc2efc40ce..af42431f45e4c68eedc2e659c3513116e1f224a1 100644 (file)
@@ -462,6 +462,7 @@ int cpu_has_64bit(void)
                has_long_mode();
 }
 
+#define PAGETABLE_BASE         0x80000
 #define PAGETABLE_SIZE         (6 * 4096)
 
 /**
@@ -523,10 +524,7 @@ int cpu_jump_to_64bit_uboot(ulong target)
        uint32_t *pgtable;
        func_t func;
 
-       /* TODO(sjg@chromium.org): Find a better place for this */
-       pgtable = (uint32_t *)0x1000000;
-       if (!pgtable)
-               return -ENOMEM;
+       pgtable = (uint32_t *)PAGETABLE_BASE;
 
        build_pagetable(pgtable);