arch/x86_64:Add runtime stack size analysis

Add runtime stack size analysis tool

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
This commit is contained in:
liwenxiang1
2025-01-06 16:02:22 +08:00
committed by Xiang Xiao
parent 79b82da476
commit 0046070395
4 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -150,7 +150,7 @@ static inline_function bool up_interrupt_context(void)
{ {
bool flag; bool flag;
__asm__ volatile("movb %%gs:(%c1), %0" __asm__ volatile("movb %%gs:(%c1), %0"
: "=qm" (flag) : "=qr" (flag)
: "i" (offsetof(struct intel64_cpu_s, : "i" (offsetof(struct intel64_cpu_s,
interrupt_context))); interrupt_context)));
return flag; return flag;
+4
View File
@@ -77,6 +77,10 @@ if(${CONFIG_STACK_USAGE_WARNING})
endif() endif()
endif() endif()
if(CONFIG_ARCH_INSTRUMENT_ALL)
add_compile_options(-finstrument-functions)
endif()
if(CONFIG_COVERAGE_ALL) if(CONFIG_COVERAGE_ALL)
add_compile_options(-fprofile-arcs -ftest-coverage -fno-inline) add_compile_options(-fprofile-arcs -ftest-coverage -fno-inline)
endif() endif()
+6
View File
@@ -71,6 +71,12 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0)
ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING) ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING)
endif endif
# Instrumentation options
ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y)
ARCHOPTIMIZATION += -finstrument-functions
endif
ARCHCFLAGS += -fno-common -Wno-attributes ARCHCFLAGS += -fno-common -Wno-attributes
ARCHCXXFLAGS += -fno-common -Wno-attributes -nostdinc++ ARCHCXXFLAGS += -fno-common -Wno-attributes -nostdinc++
+1 -1
View File
@@ -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) uint64_t *irq_xcp_regs(void)
{ {
/* This must be the simplest as possible, so we not use too much registers. /* This must be the simplest as possible, so we not use too much registers.