From c5e467e50ceadeccf7beb8dcf7ba1e4df0dda7ae Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 21 Mar 2024 13:58:49 +0100 Subject: Kconfig: Make GBD_STUB and long mode mutually exclusive GDB debugging is not implemented with x86 long mode. Change-Id: Icaf7d0763829d5badf73d38bb8fc3d36cfe18964 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/81379 Reviewed-by: Martin L Roth Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan Reviewed-by: Eric Lai --- src/Kconfig | 3 ++- src/arch/x86/c_start.S | 5 +++-- src/arch/x86/exception.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Kconfig b/src/Kconfig index 3a9a4e87fd..645d16c278 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -1015,7 +1015,8 @@ comment "General Debug Settings" config GDB_STUB bool "GDB debugging support" default n - depends on DRIVERS_UART +# FIXME Not implemented in long mode + depends on DRIVERS_UART && !USE_X86_64_SUPPORT help If enabled, you will be able to set breakpoints for gdb debugging. See src/arch/x86/c_start.S for details. diff --git a/src/arch/x86/c_start.S b/src/arch/x86/c_start.S index 6bea8db10d..94b9bd9fa5 100644 --- a/src/arch/x86/c_start.S +++ b/src/arch/x86/c_start.S @@ -129,8 +129,9 @@ _start: gdb_stub_breakpoint: #if ENV_X86_64 pop %rax /* Return address */ - pushfl - push %cs + pushfq + mov %cs, %rbx + push %rbx push %rax /* Return address */ push $0 /* No error code */ push $32 /* vector 32 is user defined */ diff --git a/src/arch/x86/exception.c b/src/arch/x86/exception.c index b8f0583a43..aecce7b7b1 100644 --- a/src/arch/x86/exception.c +++ b/src/arch/x86/exception.c @@ -379,6 +379,7 @@ void x86_exception(struct eregs *info); void x86_exception(struct eregs *info) { #if CONFIG(GDB_STUB) + /* TODO implement 64bit mode */ int signo; memcpy(gdb_stub_registers, info, 8*sizeof(uint32_t)); gdb_stub_registers[PC] = info->eip; -- cgit v1.2.3