Move the l0 pagetable address to struct mdproc. It is a property of the

whole process so should live there.

Sponsored by:	DARPA, AFRL
This commit is contained in:
Andrew Turner 2017-08-22 13:16:14 +00:00
parent 988bd0d72b
commit 6683b30c03
6 changed files with 19 additions and 8 deletions

View File

@ -50,12 +50,15 @@ 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));
ASSYM(P_MD, offsetof(struct proc, p_md));
ASSYM(MD_L0ADDR, offsetof(struct mdproc, md_l0addr));
ASSYM(SF_UC, offsetof(struct sigframe, sf_uc));
ASSYM(TD_PROC, offsetof(struct thread, td_proc));
ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
ASSYM(TD_FRAME, offsetof(struct thread, td_frame));

View File

@ -4662,8 +4662,9 @@ pmap_activate(struct thread *td)
critical_enter();
pmap = vmspace_pmap(td->td_proc->p_vmspace);
td->td_pcb->pcb_l0addr = vtophys(pmap->pm_l0);
__asm __volatile("msr ttbr0_el1, %0" : : "r"(td->td_pcb->pcb_l0addr));
td->td_proc->p_md.md_l0addr = vtophys(pmap->pm_l0);
__asm __volatile("msr ttbr0_el1, %0" : :
"r"(td->td_proc->p_md.md_l0addr));
pmap_invalidate_all(pmap);
critical_exit();
}

View File

@ -86,7 +86,8 @@ ENTRY(cpu_throw)
*/
/* Switch to the new pmap */
ldr x5, [x4, #PCB_L0ADDR]
ldr x28, [x1, #TD_PROC]
ldr x5, [x28, #(P_MD + MD_L0ADDR)]
msr ttbr0_el1, x5
isb
@ -186,8 +187,15 @@ ENTRY(cpu_switch)
* to a user process.
*/
/*
* Load the proc pointers. If these are the same then we are in the
* same process so don't need to switch page tables or issue a
* TLB invalidate.
*/
ldr x28, [x1, #TD_PROC]
/* Switch to the new pmap */
ldr x5, [x4, #PCB_L0ADDR]
ldr x5, [x28, #(P_MD + MD_L0ADDR)]
msr ttbr0_el1, x5
isb

View File

@ -91,7 +91,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
td2->td_pcb = pcb2;
bcopy(td1->td_pcb, pcb2, sizeof(*pcb2));
td2->td_pcb->pcb_l0addr =
td2->td_proc->p_md.md_l0addr =
vtophys(vmspace_pmap(td2->td_proc->p_vmspace)->pm_l0);
tf = (struct trapframe *)STACKALIGN((struct trapframe *)pcb2 - 1);

View File

@ -43,7 +43,6 @@ struct pcb {
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 */
vm_offset_t pcb_onfault;

View File

@ -40,7 +40,7 @@ struct mdthread {
};
struct mdproc {
int dummy;
vm_offset_t md_l0addr;
};
#define KINFO_PROC_SIZE 1088