Store the read-only thread pointer when scheduling a new thread. This is

not currently set, however we may wish to set it later.
This commit is contained in:
Andrew Turner 2017-06-09 15:37:17 +00:00
parent 9260925dcd
commit 9a19869a5f
3 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,7 @@ ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIGNBYTES + 1));
ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT);
ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x));
ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0));
ASSYM(PCB_L0ADDR, offsetof(struct pcb, pcb_l0addr));
ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));

View File

@ -104,6 +104,8 @@ ENTRY(cpu_throw)
ldp x5, x6, [x4, #PCB_SP]
mov sp, x5
msr tpidr_el0, x6
ldr x6, [x4, #PCB_TPIDRRO]
msr tpidrro_el0, x6
ldp x8, x9, [x4, #PCB_REGS + 8 * 8]
ldp x10, x11, [x4, #PCB_REGS + 10 * 8]
ldp x12, x13, [x4, #PCB_REGS + 12 * 8]
@ -149,6 +151,8 @@ ENTRY(cpu_switch)
str x30, [x4, #PCB_REGS + 30 * 8]
/* And the old stack pointer */
mov x5, sp
mrs x6, tpidrro_el0
str x6, [x4, #PCB_TPIDRRO]
mrs x6, tpidr_el0
stp x5, x6, [x4, #PCB_SP]
@ -215,6 +219,8 @@ ENTRY(cpu_switch)
ldp x5, x6, [x4, #PCB_SP]
mov sp, x5
msr tpidr_el0, x6
ldr x6, [x4, #PCB_TPIDRRO]
msr tpidrro_el0, x6
ldp x8, x9, [x4, #PCB_REGS + 8 * 8]
ldp x10, x11, [x4, #PCB_REGS + 10 * 8]
ldp x12, x13, [x4, #PCB_REGS + 12 * 8]
@ -301,6 +307,8 @@ ENTRY(savectx)
str x30, [x0, #PCB_REGS + 30 * 8]
/* And the old stack pointer */
mov x5, sp
mrs x6, tpidrro_el0
str x6, [x0, #PCB_TPIDRRO]
mrs x6, tpidr_el0
stp x5, x6, [x0, #PCB_SP]

View File

@ -42,6 +42,7 @@ struct pcb {
/* These two need to be in order as we access them together */
uint64_t pcb_sp;
uint64_t pcb_tpidr_el0;
uint64_t pcb_tpidrro_el0;
vm_offset_t pcb_l0addr;
/* Fault handler, the error value is passed in x0 */