From 691a0e2e56145b6956742c1ac850e36fadcccddd Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Tue, 28 Apr 2020 15:31:21 +0800 Subject: [PATCH] HV: add a specific stack space used in CPU booting The original stack used in CPU booting is: ld_bss_end + 4KB; which could be out of the RAM size limit defined in link_ram file. So add a specific stack space in link_ram file, and used in CPU booting. Tracked-On: #4738 Signed-off-by: Minggui Cao Reviewed by: Yin Fengwei Acked-by: Eddie Dong --- hypervisor/arch/x86/boot/cpu_primary.S | 6 ++---- hypervisor/bsp/ld/link_ram.ld.in | 8 ++++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hypervisor/arch/x86/boot/cpu_primary.S b/hypervisor/arch/x86/boot/cpu_primary.S index f76deb0c0..94877e8bd 100644 --- a/hypervisor/arch/x86/boot/cpu_primary.S +++ b/hypervisor/arch/x86/boot/cpu_primary.S @@ -237,10 +237,8 @@ cpu_primary_start_64: primary_start_long_mode: - /* Initialize temporary stack pointer */ - lea ld_bss_end(%rip), %rsp - /*0x1000 = PAGE_SIZE*/ - add $0x1000,%rsp + /* Initialize temporary stack pointer, size = 0x1000 */ + lea stack_for_boot(%rip), %rsp /* 16 = CPU_STACK_ALIGN */ and $(~(16 - 1)),%rsp diff --git a/hypervisor/bsp/ld/link_ram.ld.in b/hypervisor/bsp/ld/link_ram.ld.in index dd331f2ef..bcf84b1c7 100644 --- a/hypervisor/bsp/ld/link_ram.ld.in +++ b/hypervisor/bsp/ld/link_ram.ld.in @@ -71,6 +71,14 @@ SECTIONS } > ram + .boot_stack : + { + /* 4K for the boot stack */ + . += 4096; + stack_for_boot = .; + . = ALIGN(4); + } > ram + .bss_noinit (NOLOAD): { . = ALIGN(4) ;