diff --git a/arch/x86_64/include/irq.h b/arch/x86_64/include/irq.h index 574f5874586..b404a23dd55 100644 --- a/arch/x86_64/include/irq.h +++ b/arch/x86_64/include/irq.h @@ -150,7 +150,7 @@ static inline_function bool up_interrupt_context(void) { bool flag; __asm__ volatile("movb %%gs:(%c1), %0" - : "=qm" (flag) + : "=qr" (flag) : "i" (offsetof(struct intel64_cpu_s, interrupt_context))); return flag; diff --git a/arch/x86_64/src/cmake/Toolchain.cmake b/arch/x86_64/src/cmake/Toolchain.cmake index 66780c438c7..fdff54ab0bc 100644 --- a/arch/x86_64/src/cmake/Toolchain.cmake +++ b/arch/x86_64/src/cmake/Toolchain.cmake @@ -77,6 +77,10 @@ if(${CONFIG_STACK_USAGE_WARNING}) endif() endif() +if(CONFIG_ARCH_INSTRUMENT_ALL) + add_compile_options(-finstrument-functions) +endif() + if(CONFIG_COVERAGE_ALL) add_compile_options(-fprofile-arcs -ftest-coverage -fno-inline) endif() diff --git a/arch/x86_64/src/common/Toolchain.defs b/arch/x86_64/src/common/Toolchain.defs index 6be1980d1a6..ff2309e3c16 100644 --- a/arch/x86_64/src/common/Toolchain.defs +++ b/arch/x86_64/src/common/Toolchain.defs @@ -71,6 +71,12 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0) ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING) endif +# Instrumentation options + +ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y) + ARCHOPTIMIZATION += -finstrument-functions +endif + ARCHCFLAGS += -fno-common -Wno-attributes ARCHCXXFLAGS += -fno-common -Wno-attributes -nostdinc++ diff --git a/arch/x86_64/src/intel64/intel64_handlers.c b/arch/x86_64/src/intel64/intel64_handlers.c index 61949c8abcb..93a536c8c0d 100644 --- a/arch/x86_64/src/intel64/intel64_handlers.c +++ b/arch/x86_64/src/intel64/intel64_handlers.c @@ -188,7 +188,7 @@ uint64_t *irq_handler(uint64_t *regs, uint64_t irq_no) * ****************************************************************************/ -nosanitize_address +noinstrument_function nosanitize_address uint64_t *irq_xcp_regs(void) { /* This must be the simplest as possible, so we not use too much registers.