Skip to content

Commit b69d248

Browse files
dcpleungnashif
authored andcommitted
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>
1 parent f05111d commit b69d248

File tree

22 files changed

+30
-30
lines changed

22 files changed

+30
-30
lines changed

arch/arc/core/irq_manage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ K_KERNEL_STACK_DEFINE(_firq_interrupt_stack, CONFIG_ARC_FIRQ_STACK_SIZE);
4444
void z_arc_firq_stack_set(void)
4545
{
4646
#ifdef CONFIG_SMP
47-
char *firq_sp = Z_KERNEL_STACK_BUFFER(
47+
char *firq_sp = K_KERNEL_STACK_BUFFER(
4848
_firq_interrupt_stack[z_arc_v2_core_id()]) +
4949
CONFIG_ARC_FIRQ_STACK_SIZE;
5050
#else
51-
char *firq_sp = Z_KERNEL_STACK_BUFFER(_firq_interrupt_stack) +
51+
char *firq_sp = K_KERNEL_STACK_BUFFER(_firq_interrupt_stack) +
5252
CONFIG_ARC_FIRQ_STACK_SIZE;
5353
#endif
5454

arch/arc/core/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
5050
* arc_cpu_wake_flag will protect arc_cpu_sp that
5151
* only one slave cpu can read it per time
5252
*/
53-
arc_cpu_sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
53+
arc_cpu_sp = K_KERNEL_STACK_BUFFER(stack) + sz;
5454

5555
arc_cpu_wake_flag = cpu_num;
5656

arch/arc/core/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ FUNC_NORETURN void z_arc_switch_to_main_no_multithreading(k_thread_entry_t main_
283283
void *p1, void *p2, void *p3)
284284
{
285285
_kernel.cpus[0].id = 0;
286-
_kernel.cpus[0].irq_stack = (Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
286+
_kernel.cpus[0].irq_stack = (K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
287287
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]));
288288

289289
void *main_stack = (Z_THREAD_STACK_BUFFER(z_main_stack) +

arch/arm/core/cortex_a_r/smp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz, arch_cpustart_
120120
}
121121

122122
/* Pass stack address to secondary core */
123-
arm_cpu_boot_params.irq_sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
124-
arm_cpu_boot_params.fiq_sp = Z_KERNEL_STACK_BUFFER(z_arm_fiq_stack[cpu_num])
123+
arm_cpu_boot_params.irq_sp = K_KERNEL_STACK_BUFFER(stack) + sz;
124+
arm_cpu_boot_params.fiq_sp = K_KERNEL_STACK_BUFFER(z_arm_fiq_stack[cpu_num])
125125
+ CONFIG_ARMV7_FIQ_STACK_SIZE;
126-
arm_cpu_boot_params.abt_sp = Z_KERNEL_STACK_BUFFER(z_arm_abort_stack[cpu_num])
126+
arm_cpu_boot_params.abt_sp = K_KERNEL_STACK_BUFFER(z_arm_abort_stack[cpu_num])
127127
+ CONFIG_ARMV7_EXCEPTION_STACK_SIZE;
128-
arm_cpu_boot_params.udf_sp = Z_KERNEL_STACK_BUFFER(z_arm_undef_stack[cpu_num])
128+
arm_cpu_boot_params.udf_sp = K_KERNEL_STACK_BUFFER(z_arm_undef_stack[cpu_num])
129129
+ CONFIG_ARMV7_EXCEPTION_STACK_SIZE;
130-
arm_cpu_boot_params.svc_sp = Z_KERNEL_STACK_BUFFER(z_arm_svc_stack[cpu_num])
130+
arm_cpu_boot_params.svc_sp = K_KERNEL_STACK_BUFFER(z_arm_svc_stack[cpu_num])
131131
+ CONFIG_ARMV7_SVC_STACK_SIZE;
132-
arm_cpu_boot_params.sys_sp = Z_KERNEL_STACK_BUFFER(z_arm_sys_stack[cpu_num])
132+
arm_cpu_boot_params.sys_sp = K_KERNEL_STACK_BUFFER(z_arm_sys_stack[cpu_num])
133133
+ CONFIG_ARMV7_SYS_STACK_SIZE;
134134

135135
arm_cpu_boot_params.fn = fn;

arch/arm/core/cortex_a_r/stacks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void z_arm_init_stacks(void)
2828
memset(z_arm_svc_stack, 0xAA, CONFIG_ARMV7_SVC_STACK_SIZE);
2929
memset(z_arm_abort_stack, 0xAA, CONFIG_ARMV7_EXCEPTION_STACK_SIZE);
3030
memset(z_arm_undef_stack, 0xAA, CONFIG_ARMV7_EXCEPTION_STACK_SIZE);
31-
memset(Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]), 0xAA,
31+
memset(K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]), 0xAA,
3232
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]));
3333
}
3434
#endif

arch/arm/include/cortex_m/stack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ K_KERNEL_STACK_ARRAY_DECLARE(z_interrupt_stacks, CONFIG_MP_MAX_NUM_CPUS,
4040
static ALWAYS_INLINE void z_arm_interrupt_stack_setup(void)
4141
{
4242
uint32_t msp =
43-
(uint32_t)(Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0])) +
43+
(uint32_t)(K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0])) +
4444
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]);
4545

4646
__set_MSP(msp);

arch/arm64/core/fatal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void z_arm64_safe_exception_stack_init(void)
3333
char *safe_exc_sp;
3434

3535
cpu_id = arch_curr_cpu()->id;
36-
safe_exc_sp = Z_KERNEL_STACK_BUFFER(z_arm64_safe_exception_stacks[cpu_id]) +
36+
safe_exc_sp = K_KERNEL_STACK_BUFFER(z_arm64_safe_exception_stacks[cpu_id]) +
3737
CONFIG_ARM64_SAFE_EXCEPTION_STACK_SIZE;
3838
arch_curr_cpu()->arch.safe_exception_stack = (uint64_t)safe_exc_sp;
3939
write_sp_el0((uint64_t)safe_exc_sp);

arch/arm64/core/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
8484
"The count of CPU Cores nodes in dts is not equal to CONFIG_MP_MAX_NUM_CPUS\n");
8585
#endif
8686

87-
arm64_cpu_boot_params.sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
87+
arm64_cpu_boot_params.sp = K_KERNEL_STACK_BUFFER(stack) + sz;
8888
arm64_cpu_boot_params.fn = fn;
8989
arm64_cpu_boot_params.arg = arg;
9090
arm64_cpu_boot_params.cpu_num = cpu_num;

arch/riscv/core/smp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
3333
riscv_cpu_init[cpu_num].fn = fn;
3434
riscv_cpu_init[cpu_num].arg = arg;
3535

36-
riscv_cpu_sp = Z_KERNEL_STACK_BUFFER(stack) + sz;
36+
riscv_cpu_sp = K_KERNEL_STACK_BUFFER(stack) + sz;
3737
riscv_cpu_boot_flag = 0U;
3838

3939
#ifdef CONFIG_PM_CPU_OPS

arch/riscv/core/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ FUNC_NORETURN void z_riscv_switch_to_main_no_multithreading(k_thread_entry_t mai
206206
ARG_UNUSED(p3);
207207

208208
_kernel.cpus[0].id = 0;
209-
_kernel.cpus[0].irq_stack = (Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
209+
_kernel.cpus[0].irq_stack = (K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]) +
210210
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]));
211211

212212
main_stack = (Z_THREAD_STACK_BUFFER(z_main_stack) +

arch/x86/core/fatal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bool z_x86_check_stack_bounds(uintptr_t addr, size_t size, uint16_t cs)
5959
#else
6060
cpu_id = 0;
6161
#endif
62-
start = (uintptr_t)Z_KERNEL_STACK_BUFFER(
62+
start = (uintptr_t)K_KERNEL_STACK_BUFFER(
6363
z_interrupt_stacks[cpu_id]);
6464
end = start + CONFIG_ISR_STACK_SIZE;
6565
#ifdef CONFIG_USERSPACE

arch/x86/core/ia32/fatal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static FUNC_NORETURN __used void df_handler_top(void)
206206
_df_esf.eflags = _main_tss.eflags;
207207

208208
/* Restore the main IA task to a runnable state */
209-
_main_tss.esp = (uint32_t)(Z_KERNEL_STACK_BUFFER(
209+
_main_tss.esp = (uint32_t)(K_KERNEL_STACK_BUFFER(
210210
z_interrupt_stacks[0]) + CONFIG_ISR_STACK_SIZE);
211211
_main_tss.cs = CODE_SEG;
212212
_main_tss.ds = DATA_SEG;

arch/x86/core/intel64/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
156156

157157
apic_id = x86_cpu_loapics[cpu_num];
158158

159-
x86_cpuboot[cpu_num].sp = (uint64_t) Z_KERNEL_STACK_BUFFER(stack) + sz;
159+
x86_cpuboot[cpu_num].sp = (uint64_t) K_KERNEL_STACK_BUFFER(stack) + sz;
160160
x86_cpuboot[cpu_num].stack_size = sz;
161161
x86_cpuboot[cpu_num].fn = fn;
162162
x86_cpuboot[cpu_num].arg = arg;

arch/xtensa/include/kernel_arch_func.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static ALWAYS_INLINE void arch_kernel_init(void)
5151
XTENSA_WSR(ZSR_CPU_STR, cpu0);
5252

5353
#ifdef CONFIG_INIT_STACKS
54-
char *stack_start = Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]);
54+
char *stack_start = K_KERNEL_STACK_BUFFER(z_interrupt_stacks[0]);
5555
size_t stack_sz = K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[0]);
5656
char *stack_end = stack_start + stack_sz;
5757

include/zephyr/kernel/thread_stack.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static inline char *z_stack_ptr_align(char *ptr)
283283

284284
/** @} */
285285

286-
static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
286+
static inline char *K_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
287287
{
288288
return (char *)sym + K_KERNEL_STACK_RESERVED;
289289
}
@@ -294,7 +294,7 @@ static inline char *Z_KERNEL_STACK_BUFFER(k_thread_stack_t *sym)
294294
#define K_THREAD_STACK_DEFINE K_KERNEL_STACK_DEFINE
295295
#define K_THREAD_STACK_ARRAY_DEFINE K_KERNEL_STACK_ARRAY_DEFINE
296296
#define K_THREAD_STACK_MEMBER K_KERNEL_STACK_MEMBER
297-
#define Z_THREAD_STACK_BUFFER Z_KERNEL_STACK_BUFFER
297+
#define Z_THREAD_STACK_BUFFER K_KERNEL_STACK_BUFFER
298298
#define K_THREAD_STACK_DECLARE K_KERNEL_STACK_DECLARE
299299
#define K_THREAD_STACK_ARRAY_DECLARE K_KERNEL_STACK_ARRAY_DECLARE
300300
#define K_THREAD_PINNED_STACK_DEFINE K_KERNEL_PINNED_STACK_DEFINE

kernel/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ void z_init_cpu(int id)
469469
_kernel.cpus[id].idle_thread = &z_idle_threads[id];
470470
_kernel.cpus[id].id = id;
471471
_kernel.cpus[id].irq_stack =
472-
(Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[id]) +
472+
(K_KERNEL_STACK_BUFFER(z_interrupt_stacks[id]) +
473473
K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[id]));
474474
#ifdef CONFIG_SCHED_THREAD_USAGE_ALL
475475
_kernel.cpus[id].usage = &_kernel.usage[id];

kernel/thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ static char *setup_thread_stack(struct k_thread *new_thread,
392392
{
393393
/* Object cannot host a user mode thread */
394394
stack_obj_size = Z_KERNEL_STACK_SIZE_ADJUST(stack_size);
395-
stack_buf_start = Z_KERNEL_STACK_BUFFER(stack);
395+
stack_buf_start = K_KERNEL_STACK_BUFFER(stack);
396396
stack_buf_size = stack_obj_size - K_KERNEL_STACK_RESERVED;
397397

398398
/* Zephyr treats stack overflow as an app bug. But

soc/espressif/esp32/esp32-mp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,12 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
258258

259259
sr.cpu = cpu_num;
260260
sr.fn = fn;
261-
sr.stack_top = Z_KERNEL_STACK_BUFFER(stack) + sz;
261+
sr.stack_top = K_KERNEL_STACK_BUFFER(stack) + sz;
262262
sr.arg = arg;
263263
sr.vecbase = vb;
264264
sr.alive = &alive_flag;
265265

266-
appcpu_top = Z_KERNEL_STACK_BUFFER(stack) + sz;
266+
appcpu_top = K_KERNEL_STACK_BUFFER(stack) + sz;
267267

268268
start_rec = &sr;
269269

soc/intel/intel_adsp/common/multiprocessing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void arch_cpu_start(int cpu_num, k_thread_stack_t *stack, int sz,
129129
start_rec.fn = fn;
130130
start_rec.arg = arg;
131131

132-
z_mp_stack_top = Z_KERNEL_STACK_BUFFER(stack) + sz;
132+
z_mp_stack_top = K_KERNEL_STACK_BUFFER(stack) + sz;
133133

134134
soc_start_core(cpu_num);
135135
}

subsys/debug/thread_analyzer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ static void isr_stacks(void)
134134
unsigned int num_cpus = arch_num_cpus();
135135

136136
for (int i = 0; i < num_cpus; i++) {
137-
const uint8_t *buf = Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
137+
const uint8_t *buf = K_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
138138
size_t size = K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[i]);
139139
size_t unused;
140140
int err;

subsys/shell/modules/kernel_service.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static int cmd_kernel_stacks(const struct shell *sh,
257257

258258
for (int i = 0; i < num_cpus; i++) {
259259
size_t unused;
260-
const uint8_t *buf = Z_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
260+
const uint8_t *buf = K_KERNEL_STACK_BUFFER(z_interrupt_stacks[i]);
261261
size_t size = K_KERNEL_STACK_SIZEOF(z_interrupt_stacks[i]);
262262
int err = z_stack_space_get(buf, size, &unused);
263263

tests/kernel/threads/thread_stack/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void stack_buffer_scenarios(void)
121121
#endif
122122
{
123123
reserved = K_KERNEL_STACK_RESERVED;
124-
stack_buf = Z_KERNEL_STACK_BUFFER(stack_obj);
124+
stack_buf = K_KERNEL_STACK_BUFFER(stack_obj);
125125
alignment = Z_KERNEL_STACK_OBJ_ALIGN;
126126
}
127127

0 commit comments

Comments
 (0)