ARC: make variables with regs and addresses bit agnostic

Make variables where we store CPU registers values and
memory addresses bit agnostic.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
Evgeniy Paltsev 2020-11-11 22:07:57 +03:00 committed by Kumar Gala
commit 0d859796be
4 changed files with 98 additions and 98 deletions

View file

@ -24,16 +24,16 @@ LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
#ifdef CONFIG_ARC_EXCEPTION_DEBUG #ifdef CONFIG_ARC_EXCEPTION_DEBUG
static void dump_arc_esf(const z_arch_esf_t *esf) static void dump_arc_esf(const z_arch_esf_t *esf)
{ {
LOG_ERR(" r0: 0x%08x r1: 0x%08x r2: 0x%08x r3: 0x%08x", LOG_ERR(" r0: 0x%" PRIxPTR " r1: 0x%" PRIxPTR " r2: 0x%" PRIxPTR " r3: 0x%" PRIxPTR "",
esf->r0, esf->r1, esf->r2, esf->r3); esf->r0, esf->r1, esf->r2, esf->r3);
LOG_ERR(" r4: 0x%08x r5: 0x%08x r6: 0x%08x r7: 0x%08x", LOG_ERR(" r4: 0x%" PRIxPTR " r5: 0x%" PRIxPTR " r6: 0x%" PRIxPTR " r7: 0x%" PRIxPTR "",
esf->r4, esf->r5, esf->r6, esf->r7); esf->r4, esf->r5, esf->r6, esf->r7);
LOG_ERR(" r8: 0x%08x r9: 0x%08x r10: 0x%08x r11: 0x%08x", LOG_ERR(" r8: 0x%" PRIxPTR " r9: 0x%" PRIxPTR " r10: 0x%" PRIxPTR " r11: 0x%" PRIxPTR "",
esf->r8, esf->r9, esf->r10, esf->r11); esf->r8, esf->r9, esf->r10, esf->r11);
LOG_ERR("r12: 0x%08x r13: 0x%08x pc: 0x%08x", LOG_ERR("r12: 0x%" PRIxPTR " r13: 0x%" PRIxPTR " pc: 0x%" PRIxPTR "",
esf->r12, esf->r13, esf->pc); esf->r12, esf->r13, esf->pc);
LOG_ERR(" blink: 0x%08x status32: 0x%08x", esf->blink, esf->status32); LOG_ERR(" blink: 0x%" PRIxPTR " status32: 0x%" PRIxPTR "", esf->blink, esf->status32);
LOG_ERR("lp_end: 0x%08x lp_start: 0x%08x lp_count: 0x%08x", LOG_ERR("lp_end: 0x%" PRIxPTR " lp_start: 0x%" PRIxPTR " lp_count: 0x%" PRIxPTR "",
esf->lp_end, esf->lp_start, esf->lp_count); esf->lp_end, esf->lp_start, esf->lp_count);
} }
#endif #endif

View file

@ -22,15 +22,15 @@
/* initial stack frame */ /* initial stack frame */
struct init_stack_frame { struct init_stack_frame {
uint32_t pc; uintptr_t pc;
#ifdef CONFIG_ARC_HAS_SECURE #ifdef CONFIG_ARC_HAS_SECURE
uint32_t sec_stat; uint32_t sec_stat;
#endif #endif
uint32_t status32; uintptr_t status32;
uint32_t r3; uintptr_t r3;
uint32_t r2; uintptr_t r2;
uint32_t r1; uintptr_t r1;
uint32_t r0; uintptr_t r0;
}; };
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
@ -158,15 +158,15 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
} }
#else #else
iframe->status32 = _ARC_V2_STATUS32_DZ; iframe->status32 = _ARC_V2_STATUS32_DZ;
iframe->pc = ((uint32_t)z_thread_entry_wrapper); iframe->pc = ((uintptr_t)z_thread_entry_wrapper);
#endif /* CONFIG_USERSPACE */ #endif /* CONFIG_USERSPACE */
#ifdef CONFIG_ARC_SECURE_FIRMWARE #ifdef CONFIG_ARC_SECURE_FIRMWARE
iframe->sec_stat = z_arc_v2_aux_reg_read(_ARC_V2_SEC_STAT); iframe->sec_stat = z_arc_v2_aux_reg_read(_ARC_V2_SEC_STAT);
#endif #endif
iframe->r0 = (uint32_t)entry; iframe->r0 = (uintptr_t)entry;
iframe->r1 = (uint32_t)p1; iframe->r1 = (uintptr_t)p1;
iframe->r2 = (uint32_t)p2; iframe->r2 = (uintptr_t)p2;
iframe->r3 = (uint32_t)p3; iframe->r3 = (uintptr_t)p3;
#ifdef CONFIG_ARC_STACK_CHECKING #ifdef CONFIG_ARC_STACK_CHECKING
#ifdef CONFIG_ARC_SECURE_FIRMWARE #ifdef CONFIG_ARC_SECURE_FIRMWARE
@ -182,7 +182,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
thread->switch_handle = thread; thread->switch_handle = thread;
thread->arch.relinquish_cause = _CAUSE_COOP; thread->arch.relinquish_cause = _CAUSE_COOP;
thread->callee_saved.sp = thread->callee_saved.sp =
(uint32_t)iframe - ___callee_saved_stack_t_SIZEOF; (uintptr_t)iframe - ___callee_saved_stack_t_SIZEOF;
arch_setup_callee_saved_regs(thread, thread->callee_saved.sp); arch_setup_callee_saved_regs(thread, thread->callee_saved.sp);

View file

@ -37,70 +37,70 @@ extern "C" {
#ifdef CONFIG_ARC_HAS_SECURE #ifdef CONFIG_ARC_HAS_SECURE
struct _irq_stack_frame { struct _irq_stack_frame {
uint32_t lp_end; uintptr_t lp_end;
uint32_t lp_start; uintptr_t lp_start;
uint32_t lp_count; uintptr_t lp_count;
#ifdef CONFIG_CODE_DENSITY #ifdef CONFIG_CODE_DENSITY
/* /*
* Currently unsupported. This is where those registers are * Currently unsupported. This is where those registers are
* automatically pushed on the stack by the CPU when taking a regular * automatically pushed on the stack by the CPU when taking a regular
* IRQ. * IRQ.
*/ */
uint32_t ei_base; uintptr_t ei_base;
uint32_t ldi_base; uintptr_t ldi_base;
uint32_t jli_base; uintptr_t jli_base;
#endif #endif
uint32_t r0; uintptr_t r0;
uint32_t r1; uintptr_t r1;
uint32_t r2; uintptr_t r2;
uint32_t r3; uintptr_t r3;
uint32_t r4; uintptr_t r4;
uint32_t r5; uintptr_t r5;
uint32_t r6; uintptr_t r6;
uint32_t r7; uintptr_t r7;
uint32_t r8; uintptr_t r8;
uint32_t r9; uintptr_t r9;
uint32_t r10; uintptr_t r10;
uint32_t r11; uintptr_t r11;
uint32_t r12; uintptr_t r12;
uint32_t r13; uintptr_t r13;
uint32_t blink; uintptr_t blink;
uint32_t pc; uintptr_t pc;
uint32_t sec_stat; uintptr_t sec_stat;
uint32_t status32; uintptr_t status32;
}; };
#else #else
struct _irq_stack_frame { struct _irq_stack_frame {
uint32_t r0; uintptr_t r0;
uint32_t r1; uintptr_t r1;
uint32_t r2; uintptr_t r2;
uint32_t r3; uintptr_t r3;
uint32_t r4; uintptr_t r4;
uint32_t r5; uintptr_t r5;
uint32_t r6; uintptr_t r6;
uint32_t r7; uintptr_t r7;
uint32_t r8; uintptr_t r8;
uint32_t r9; uintptr_t r9;
uint32_t r10; uintptr_t r10;
uint32_t r11; uintptr_t r11;
uint32_t r12; uintptr_t r12;
uint32_t r13; uintptr_t r13;
uint32_t blink; uintptr_t blink;
uint32_t lp_end; uintptr_t lp_end;
uint32_t lp_start; uintptr_t lp_start;
uint32_t lp_count; uintptr_t lp_count;
#ifdef CONFIG_CODE_DENSITY #ifdef CONFIG_CODE_DENSITY
/* /*
* Currently unsupported. This is where those registers are * Currently unsupported. This is where those registers are
* automatically pushed on the stack by the CPU when taking a regular * automatically pushed on the stack by the CPU when taking a regular
* IRQ. * IRQ.
*/ */
uint32_t ei_base; uintptr_t ei_base;
uint32_t ldi_base; uintptr_t ldi_base;
uint32_t jli_base; uintptr_t jli_base;
#endif #endif
uint32_t pc; uintptr_t pc;
uint32_t status32; uintptr_t status32;
}; };
#endif #endif
@ -110,47 +110,47 @@ typedef struct _irq_stack_frame _isf_t;
/* callee-saved registers pushed on the stack, not in k_thread */ /* callee-saved registers pushed on the stack, not in k_thread */
struct _callee_saved_stack { struct _callee_saved_stack {
uint32_t r13; uintptr_t r13;
uint32_t r14; uintptr_t r14;
uint32_t r15; uintptr_t r15;
uint32_t r16; uintptr_t r16;
uint32_t r17; uintptr_t r17;
uint32_t r18; uintptr_t r18;
uint32_t r19; uintptr_t r19;
uint32_t r20; uintptr_t r20;
uint32_t r21; uintptr_t r21;
uint32_t r22; uintptr_t r22;
uint32_t r23; uintptr_t r23;
uint32_t r24; uintptr_t r24;
uint32_t r25; uintptr_t r25;
uint32_t r26; uintptr_t r26;
uint32_t fp; /* r27 */ uintptr_t fp; /* r27 */
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
#ifdef CONFIG_ARC_HAS_SECURE #ifdef CONFIG_ARC_HAS_SECURE
uint32_t user_sp; uintptr_t user_sp;
uint32_t kernel_sp; uintptr_t kernel_sp;
#else #else
uint32_t user_sp; uintptr_t user_sp;
#endif #endif
#endif #endif
/* r28 is the stack pointer and saved separately */ /* r28 is the stack pointer and saved separately */
/* r29 is ILINK and does not need to be saved */ /* r29 is ILINK and does not need to be saved */
uint32_t r30; uintptr_t r30;
#ifdef CONFIG_ARC_HAS_ACCL_REGS #ifdef CONFIG_ARC_HAS_ACCL_REGS
uint32_t r58; uintptr_t r58;
uint32_t r59; uintptr_t r59;
#endif #endif
#ifdef CONFIG_FPU_SHARING #ifdef CONFIG_FPU_SHARING
uint32_t fpu_status; uintptr_t fpu_status;
uint32_t fpu_ctrl; uintptr_t fpu_ctrl;
#ifdef CONFIG_FP_FPU_DA #ifdef CONFIG_FP_FPU_DA
uint32_t dpfp2h; uintptr_t dpfp2h;
uint32_t dpfp2l; uintptr_t dpfp2l;
uint32_t dpfp1h; uintptr_t dpfp1h;
uint32_t dpfp1l; uintptr_t dpfp1l;
#endif #endif
#endif #endif

View file

@ -35,7 +35,7 @@ extern "C" {
#endif #endif
struct _callee_saved { struct _callee_saved {
uint32_t sp; /* r28 */ uintptr_t sp; /* r28 */
}; };
typedef struct _callee_saved _callee_saved_t; typedef struct _callee_saved _callee_saved_t;
@ -48,16 +48,16 @@ struct _thread_arch {
/* High address of stack region, stack grows downward from this /* High address of stack region, stack grows downward from this
* location. Usesd for hardware stack checking * location. Usesd for hardware stack checking
*/ */
uint32_t k_stack_base; uintptr_t k_stack_base;
uint32_t k_stack_top; uintptr_t k_stack_top;
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
uint32_t u_stack_base; uintptr_t u_stack_base;
uint32_t u_stack_top; uintptr_t u_stack_top;
#endif #endif
#endif #endif
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
uint32_t priv_stack_start; uintptr_t priv_stack_start;
#endif #endif
}; };