Add macros for arm64 pcb register offsets

Add macros for offsets of macros we set in the arm64 pcb pcb_x array.
This will simplift reducing the size of this array in a later change.

Sponsored by:	Arm Ltd
This commit is contained in:
Andrew Turner 2023-03-22 12:18:41 +00:00
parent c888b3b228
commit 1c33a94ab0
4 changed files with 12 additions and 8 deletions

View File

@ -144,7 +144,7 @@ db_trace_thread(struct thread *thr, int count)
if (thr != curthread) {
ctx = kdb_thr_ctx(thr);
frame.fp = (uintptr_t)ctx->pcb_x[29];
frame.fp = (uintptr_t)ctx->pcb_x[PCB_FP];
frame.pc = (uintptr_t)ctx->pcb_lr;
db_stack_trace_cmd(thr, &frame);
} else

View File

@ -68,7 +68,7 @@ stack_save_td(struct stack *st, struct thread *td)
if (TD_IS_RUNNING(td))
return (EOPNOTSUPP);
frame.fp = td->td_pcb->pcb_x[29];
frame.fp = td->td_pcb->pcb_x[PCB_FP];
frame.pc = ADDR_MAKE_CANONICAL(td->td_pcb->pcb_lr);
stack_capture(td, st, &frame);

View File

@ -105,8 +105,8 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
td2->td_frame = tf;
/* Set the return value registers for fork() */
td2->td_pcb->pcb_x[19] = (uintptr_t)fork_return;
td2->td_pcb->pcb_x[20] = (uintptr_t)td2;
td2->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return;
td2->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td2;
td2->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame;
@ -183,8 +183,8 @@ cpu_copy_thread(struct thread *td, struct thread *td0)
bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb));
td->td_pcb->pcb_x[19] = (uintptr_t)fork_return;
td->td_pcb->pcb_x[20] = (uintptr_t)td;
td->td_pcb->pcb_x[PCB_X19] = (uintptr_t)fork_return;
td->td_pcb->pcb_x[PCB_X20] = (uintptr_t)td;
td->td_pcb->pcb_lr = (uintptr_t)fork_trampoline;
td->td_pcb->pcb_sp = (uintptr_t)td->td_frame;
@ -287,8 +287,8 @@ void
cpu_fork_kthread_handler(struct thread *td, void (*func)(void *), void *arg)
{
td->td_pcb->pcb_x[19] = (uintptr_t)func;
td->td_pcb->pcb_x[20] = (uintptr_t)arg;
td->td_pcb->pcb_x[PCB_X19] = (uintptr_t)func;
td->td_pcb->pcb_x[PCB_X20] = (uintptr_t)arg;
}
void

View File

@ -36,6 +36,10 @@
struct trapframe;
#define PCB_X19 19
#define PCB_X20 20
#define PCB_FP 29
struct pcb {
uint64_t pcb_x[30];
uint64_t pcb_lr;