kernel: rename Z_KERNEL_STACK_BUFFER to K_KERNEL_STACK_BUFFER
Simple rename to align the kernel naming scheme. This is being
used throughout the tree, especially in the architecture code.
As this is not a private API internal to kernel, prefix it
appropriately with K_.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
diff --git a/arch/arc/core/irq_manage.c b/arch/arc/core/irq_manage.c
index 73c8007..f6573f5 100644
--- a/arch/arc/core/irq_manage.c
+++ b/arch/arc/core/irq_manage.c
@@ -44,11 +44,11 @@
void z_arc_firq_stack_set(void)
{
#ifdef CONFIG_SMP
- char *firq_sp = Z_KERNEL_STACK_BUFFER(
+ char *firq_sp = K_KERNEL_STACK_BUFFER(
_firq_interrupt_stack[z_arc_v2_core_id()]) +
CONFIG_ARC_FIRQ_STACK_SIZE;
#else
- char *firq_sp = Z_KERNEL_STACK_BUFFER(_firq_interrupt_stack) +
+ char *firq_sp = K_KERNEL_STACK_BUFFER(_firq_interrupt_stack) +
CONFIG_ARC_FIRQ_STACK_SIZE;
#endif
diff --git a/arch/arc/core/smp.c b/arch/arc/core/smp.c
index 767c463..9f8ee38 100644
--- a/arch/arc/core/smp.c
+++ b/arch/arc/core/smp.c
@@ -50,7 +50,7 @@
* arc_cpu_wake_flag will protect arc_cpu_sp that
* only one slave cpu can read it per time
*/
- arc_cpu_sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
+ arc_cpu_sp = K_KERNEL_STACK_BUFFER(stack) + sz;
arc_cpu_wake_flag = cpu_num;
diff --git a/arch/arc/core/thread.c b/arch/arc/core/thread.c
index 5634012..fd3f86c 100644
--- a/arch/arc/core/thread.c
+++ b/arch/arc/core/thread.c
@@ -283,7 +283,7 @@
void *p1, void *p2, void *p3)
{
_kernel.cpus[0].id = 0;
- _kernel.cpus[0].irq_stack = (Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
+ _kernel.cpus[0].irq_stack = (K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]));
void *main_stack = (Z_THREAD_STACK_BUFFER(z_main_stack) +
diff --git a/arch/arm/core/cortex_a_r/smp.c b/arch/arm/core/cortex_a_r/smp.c
index 85a8650..9e06730 100644
--- a/arch/arm/core/cortex_a_r/smp.c
+++ b/arch/arm/core/cortex_a_r/smp.c
@@ -120,16 +120,16 @@
}
/* Pass stack address to secondary core */
- arm_cpu_boot_params.irq_sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
- arm_cpu_boot_params.fiq_sp = Z_KERNEL_STACK_BUFFER(z_arm_fiq_stack[cpu_num])
+ arm_cpu_boot_params.irq_sp = K_KERNEL_STACK_BUFFER(stack) + sz;
+ arm_cpu_boot_params.fiq_sp = K_KERNEL_STACK_BUFFER(z_arm_fiq_stack[cpu_num])
+ CONFIG_ARMV7_FIQ_STACK_SIZE;
- arm_cpu_boot_params.abt_sp = Z_KERNEL_STACK_BUFFER(z_arm_abort_stack[cpu_num])
+ arm_cpu_boot_params.abt_sp = K_KERNEL_STACK_BUFFER(z_arm_abort_stack[cpu_num])
+ CONFIG_ARMV7_EXCEPTION_STACK_SIZE;
- arm_cpu_boot_params.udf_sp = Z_KERNEL_STACK_BUFFER(z_arm_undef_stack[cpu_num])
+ arm_cpu_boot_params.udf_sp = K_KERNEL_STACK_BUFFER(z_arm_undef_stack[cpu_num])
+ CONFIG_ARMV7_EXCEPTION_STACK_SIZE;
- arm_cpu_boot_params.svc_sp = Z_KERNEL_STACK_BUFFER(z_arm_svc_stack[cpu_num])
+ arm_cpu_boot_params.svc_sp = K_KERNEL_STACK_BUFFER(z_arm_svc_stack[cpu_num])
+ CONFIG_ARMV7_SVC_STACK_SIZE;
- arm_cpu_boot_params.sys_sp = Z_KERNEL_STACK_BUFFER(z_arm_sys_stack[cpu_num])
+ arm_cpu_boot_params.sys_sp = K_KERNEL_STACK_BUFFER(z_arm_sys_stack[cpu_num])
+ CONFIG_ARMV7_SYS_STACK_SIZE;
arm_cpu_boot_params.fn = fn;
diff --git a/arch/arm/core/cortex_a_r/stacks.c b/arch/arm/core/cortex_a_r/stacks.c
index 0691595..fecc190 100644
--- a/arch/arm/core/cortex_a_r/stacks.c
+++ b/arch/arm/core/cortex_a_r/stacks.c
@@ -28,7 +28,7 @@
memset(z_arm_svc_stack, 0xAA, CONFIG_ARMV7_SVC_STACK_SIZE);
memset(z_arm_abort_stack, 0xAA, CONFIG_ARMV7_EXCEPTION_STACK_SIZE);
memset(z_arm_undef_stack, 0xAA, CONFIG_ARMV7_EXCEPTION_STACK_SIZE);
- memset(Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]), 0xAA,
+ memset(K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]), 0xAA,
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]));
}
#endif
diff --git a/arch/arm/include/cortex_m/stack.h b/arch/arm/include/cortex_m/stack.h
index f5c4de5..feeaf71 100644
--- a/arch/arm/include/cortex_m/stack.h
+++ b/arch/arm/include/cortex_m/stack.h
@@ -40,7 +40,7 @@
static ALWAYS_INLINE void z_arm_interrupt_stack_setup(void)
{
uint32_t msp =
- (uint32_t)(Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0])) +
+ (uint32_t)(K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0])) +
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]);
__set_MSP(msp);
diff --git a/arch/arm64/core/fatal.c b/arch/arm64/core/fatal.c
index dbf0c4c..5d475e4 100644
--- a/arch/arm64/core/fatal.c
+++ b/arch/arm64/core/fatal.c
@@ -33,7 +33,7 @@
char *safe_exc_sp;
cpu_id = arch_curr_cpu()->id;
- safe_exc_sp = Z_KERNEL_STACK_BUFFER(z_arm64_safe_exception_stacks[cpu_id]) +
+ safe_exc_sp = K_KERNEL_STACK_BUFFER(z_arm64_safe_exception_stacks[cpu_id]) +
CONFIG_ARM64_SAFE_EXCEPTION_STACK_SIZE;
arch_curr_cpu()->arch.safe_exception_stack = (uint64_t)safe_exc_sp;
write_sp_el0((uint64_t)safe_exc_sp);
diff --git a/arch/arm64/core/smp.c b/arch/arm64/core/smp.c
index 3413a57..8777c40 100644
--- a/arch/arm64/core/smp.c
+++ b/arch/arm64/core/smp.c
@@ -84,7 +84,7 @@
"The count of CPU Cores nodes in dts is not equal to CONFIG_MP_MAX_NUM_CPUS\n");
#endif
- arm64_cpu_boot_params.sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
+ arm64_cpu_boot_params.sp = K_KERNEL_STACK_BUFFER(stack) + sz;
arm64_cpu_boot_params.fn = fn;
arm64_cpu_boot_params.arg = arg;
arm64_cpu_boot_params.cpu_num = cpu_num;
diff --git a/arch/riscv/core/smp.c b/arch/riscv/core/smp.c
index fe9f349..68147f8 100644
--- a/arch/riscv/core/smp.c
+++ b/arch/riscv/core/smp.c
@@ -33,7 +33,7 @@
riscv_cpu_init[cpu_num].fn = fn;
riscv_cpu_init[cpu_num].arg = arg;
- riscv_cpu_sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
+ riscv_cpu_sp = K_KERNEL_STACK_BUFFER(stack) + sz;
riscv_cpu_boot_flag = 0U;
#ifdef CONFIG_PM_CPU_OPS
diff --git a/arch/riscv/core/thread.c b/arch/riscv/core/thread.c
index 124f204..20ef9f4 100644
--- a/arch/riscv/core/thread.c
+++ b/arch/riscv/core/thread.c
@@ -206,7 +206,7 @@
ARG_UNUSED(p3);
_kernel.cpus[0].id = 0;
- _kernel.cpus[0].irq_stack = (Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
+ _kernel.cpus[0].irq_stack = (K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]));
main_stack = (Z_THREAD_STACK_BUFFER(z_main_stack) +
diff --git a/arch/x86/core/fatal.c b/arch/x86/core/fatal.c
index 1203f39..517d2ef 100644
--- a/arch/x86/core/fatal.c
+++ b/arch/x86/core/fatal.c
@@ -59,7 +59,7 @@
#else
cpu_id = 0;
#endif
- start = (uintptr_t)Z_KERNEL_STACK_BUFFER(
+ start = (uintptr_t)K_KERNEL_STACK_BUFFER(
z_interrupt_stacks[cpu_id]);
end = start + CONFIG_ISR_STACK_SIZE;
#ifdef CONFIG_USERSPACE
diff --git a/arch/x86/core/ia32/fatal.c b/arch/x86/core/ia32/fatal.c
index 38cf180..597f21a 100644
--- a/arch/x86/core/ia32/fatal.c
+++ b/arch/x86/core/ia32/fatal.c
@@ -206,7 +206,7 @@
_df_esf.eflags = _main_tss.eflags;
/* Restore the main IA task to a runnable state */
- _main_tss.esp = (uint32_t)(Z_KERNEL_STACK_BUFFER(
+ _main_tss.esp = (uint32_t)(K_KERNEL_STACK_BUFFER(
z_interrupt_stacks[0]) + CONFIG_ISR_STACK_SIZE);
_main_tss.cs = CODE_SEG;
_main_tss.ds = DATA_SEG;
diff --git a/arch/x86/core/intel64/cpu.c b/arch/x86/core/intel64/cpu.c
index f5b3af5..3c17e2d 100644
--- a/arch/x86/core/intel64/cpu.c
+++ b/arch/x86/core/intel64/cpu.c
@@ -156,7 +156,7 @@
apic_id = x86_cpu_loapics[cpu_num];
- x86_cpuboot[cpu_num].sp = (uint64_t) Z_KERNEL_STACK_BUFFER(stack) + sz;
+ x86_cpuboot[cpu_num].sp = (uint64_t) K_KERNEL_STACK_BUFFER(stack) + sz;
x86_cpuboot[cpu_num].stack_size = sz;
x86_cpuboot[cpu_num].fn = fn;
x86_cpuboot[cpu_num].arg = arg;
diff --git a/arch/xtensa/include/kernel_arch_func.h b/arch/xtensa/include/kernel_arch_func.h
index 8dfa53f..48599f0 100644
--- a/arch/xtensa/include/kernel_arch_func.h
+++ b/arch/xtensa/include/kernel_arch_func.h
@@ -51,7 +51,7 @@
XTENSA_WSR(ZSR_CPU_STR, cpu0);
#ifdef CONFIG_INIT_STACKS
- char *stack_start = Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]);
+ char *stack_start = K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]);
size_t stack_sz = K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]);
char *stack_end = stack_start + stack_sz;
diff --git a/include/zephyr/kernel/thread_stack.h b/include/zephyr/kernel/thread_stack.h
index 67aa35a..941df22 100644
--- a/include/zephyr/kernel/thread_stack.h
+++ b/include/zephyr/kernel/thread_stack.h
@@ -283,7 +283,7 @@
/** @} */
-static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
+static inline char *K_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
{
return (char *)sym + K_KERNEL_STACK_RESERVED;
}
@@ -294,7 +294,7 @@
#define K_THREAD_STACK_DEFINE K_KERNEL_STACK_DEFINE
#define K_THREAD_STACK_ARRAY_DEFINE K_KERNEL_STACK_ARRAY_DEFINE
#define K_THREAD_STACK_MEMBER K_KERNEL_STACK_MEMBER
-#define Z_THREAD_STACK_BUFFER Z_KERNEL_STACK_BUFFER
+#define Z_THREAD_STACK_BUFFER K_KERNEL_STACK_BUFFER
#define K_THREAD_STACK_DECLARE K_KERNEL_STACK_DECLARE
#define K_THREAD_STACK_ARRAY_DECLARE K_KERNEL_STACK_ARRAY_DECLARE
#define K_THREAD_PINNED_STACK_DEFINE K_KERNEL_PINNED_STACK_DEFINE
diff --git a/kernel/init.c b/kernel/init.c
index 506e3ef..fe6c176 100644
--- a/kernel/init.c
+++ b/kernel/init.c
@@ -469,7 +469,7 @@
_kernel.cpus[id].idle_thread = &z_idle_threads[id];
_kernel.cpus[id].id = id;
_kernel.cpus[id].irq_stack =
- (Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[id]) +
+ (K_KERNEL_STACK_BUFFER(z_interrupt_stacks[id]) +
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[id]));
#ifdef CONFIG_SCHED_THREAD_USAGE_ALL
_kernel.cpus[id].usage = &_kernel.usage[id];
diff --git a/kernel/thread.c b/kernel/thread.c
index 729be27..ac76e44 100644
--- a/kernel/thread.c
+++ b/kernel/thread.c
@@ -392,7 +392,7 @@
{
/* Object cannot host a user mode thread */
stack_obj_size = Z_KERNEL_STACK_SIZE_ADJUST(stack_size);
- stack_buf_start = Z_KERNEL_STACK_BUFFER(stack);
+ stack_buf_start = K_KERNEL_STACK_BUFFER(stack);
stack_buf_size = stack_obj_size - K_KERNEL_STACK_RESERVED;
/* Zephyr treats stack overflow as an app bug. But
diff --git a/soc/espressif/esp32/esp32-mp.c b/soc/espressif/esp32/esp32-mp.c
index c5ec588..baaae70 100644
--- a/soc/espressif/esp32/esp32-mp.c
+++ b/soc/espressif/esp32/esp32-mp.c
@@ -258,12 +258,12 @@
sr.cpu = cpu_num;
sr.fn = fn;
- sr.stack_top = Z_KERNEL_STACK_BUFFER(stack) + sz;
+ sr.stack_top = K_KERNEL_STACK_BUFFER(stack) + sz;
sr.arg = arg;
sr.vecbase = vb;
sr.alive = &alive_flag;
- appcpu_top = Z_KERNEL_STACK_BUFFER(stack) + sz;
+ appcpu_top = K_KERNEL_STACK_BUFFER(stack) + sz;
start_rec = &sr;
diff --git a/soc/intel/intel_adsp/common/multiprocessing.c b/soc/intel/intel_adsp/common/multiprocessing.c
index ff49b61..dfd7bd2 100644
--- a/soc/intel/intel_adsp/common/multiprocessing.c
+++ b/soc/intel/intel_adsp/common/multiprocessing.c
@@ -129,7 +129,7 @@
start_rec.fn = fn;
start_rec.arg = arg;
- z_mp_stack_top = Z_KERNEL_STACK_BUFFER(stack) + sz;
+ z_mp_stack_top = K_KERNEL_STACK_BUFFER(stack) + sz;
soc_start_core(cpu_num);
}
diff --git a/subsys/debug/thread_analyzer.c b/subsys/debug/thread_analyzer.c
index 39a9bcf..e7f4bb7 100644
--- a/subsys/debug/thread_analyzer.c
+++ b/subsys/debug/thread_analyzer.c
@@ -134,7 +134,7 @@
unsigned int num_cpus = arch_num_cpus();
for (int i = 0; i < num_cpus; i++) {
- const uint8_t *buf = Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
+ const uint8_t *buf = K_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
size_t size = K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[i]);
size_t unused;
int err;
diff --git a/subsys/shell/modules/kernel_service.c b/subsys/shell/modules/kernel_service.c
index ff8079f..3d940ba 100644
--- a/subsys/shell/modules/kernel_service.c
+++ b/subsys/shell/modules/kernel_service.c
@@ -257,7 +257,7 @@
for (int i = 0; i < num_cpus; i++) {
size_t unused;
- const uint8_t *buf = Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
+ const uint8_t *buf = K_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
size_t size = K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[i]);
int err = z_stack_space_get(buf, size, &unused);
diff --git a/tests/kernel/threads/thread_stack/src/main.c b/tests/kernel/threads/thread_stack/src/main.c
index 73730d5..272cad3 100644
--- a/tests/kernel/threads/thread_stack/src/main.c
+++ b/tests/kernel/threads/thread_stack/src/main.c
@@ -121,7 +121,7 @@
#endif
{
reserved = K_KERNEL_STACK_RESERVED;
- stack_buf = Z_KERNEL_STACK_BUFFER(stack_obj);
+ stack_buf = K_KERNEL_STACK_BUFFER(stack_obj);
alignment = Z_KERNEL_STACK_OBJ_ALIGN;
}