Changeset View
Changeset View
Standalone View
Standalone View
sys/mips/mips/vm_machdep.c
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | |||||
cpu_thread_clean(struct thread *td) | cpu_thread_clean(struct thread *td) | ||||
{ | { | ||||
} | } | ||||
void | void | ||||
cpu_thread_swapin(struct thread *td) | cpu_thread_swapin(struct thread *td) | ||||
{ | { | ||||
pt_entry_t *pte; | pt_entry_t *pte; | ||||
int i; | |||||
/* | /* | ||||
* The kstack may be at a different physical address now. | * The kstack may be at a different physical address now. | ||||
* Cache the PTEs for the Kernel stack in the machine dependent | * Cache the PTEs for the Kernel stack in the machine dependent | ||||
* part of the thread struct so cpu_switch() can quickly map in | * part of the thread struct so cpu_switch() can quickly map in | ||||
* the pcb struct and kernel stack. | * the pcb struct and kernel stack. | ||||
*/ | */ | ||||
#ifdef KSTACK_LARGE_PAGE | |||||
/* Just one entry for one large kernel page. */ | |||||
pte = pmap_pte(kernel_pmap, td->td_kstack); | |||||
td->td_md.md_upte[0] = *pte & ~TLBLO_SWBITS_MASK; | |||||
td->td_md.md_upte[1] = 1; | |||||
#else | |||||
int i; | |||||
for (i = 0; i < KSTACK_PAGES; i++) { | for (i = 0; i < KSTACK_PAGES; i++) { | ||||
pte = pmap_pte(kernel_pmap, td->td_kstack + i * PAGE_SIZE); | pte = pmap_pte(kernel_pmap, td->td_kstack + i * PAGE_SIZE); | ||||
td->td_md.md_upte[i] = *pte & ~TLBLO_SWBITS_MASK; | td->td_md.md_upte[i] = *pte & ~TLBLO_SWBITS_MASK; | ||||
} | } | ||||
#endif /* ! KSTACK_LARGE_PAGE */ | |||||
} | } | ||||
void | void | ||||
cpu_thread_swapout(struct thread *td) | cpu_thread_swapout(struct thread *td) | ||||
{ | { | ||||
} | } | ||||
void | void | ||||
cpu_thread_alloc(struct thread *td) | cpu_thread_alloc(struct thread *td) | ||||
{ | { | ||||
pt_entry_t *pte; | pt_entry_t *pte; | ||||
int i; | |||||
KASSERT((td->td_kstack & (1 << PAGE_SHIFT)) == 0, ("kernel stack must be aligned.")); | KASSERT((td->td_kstack & ((KSTACK_PAGE_SIZE * 2) - 1) ) == 0, | ||||
("kernel stack must be aligned.")); | |||||
td->td_pcb = (struct pcb *)(td->td_kstack + | td->td_pcb = (struct pcb *)(td->td_kstack + | ||||
td->td_kstack_pages * PAGE_SIZE) - 1; | td->td_kstack_pages * PAGE_SIZE) - 1; | ||||
td->td_frame = &td->td_pcb->pcb_regs; | td->td_frame = &td->td_pcb->pcb_regs; | ||||
#ifdef KSTACK_LARGE_PAGE | |||||
/* Just one entry for one large kernel page. */ | |||||
pte = pmap_pte(kernel_pmap, td->td_kstack); | |||||
td->td_md.md_upte[0] = *pte & ~TLBLO_SWBITS_MASK; | |||||
td->td_md.md_upte[1] = 1; | |||||
#else | |||||
{ | |||||
int i; | |||||
for (i = 0; i < KSTACK_PAGES; i++) { | for (i = 0; i < KSTACK_PAGES; i++) { | ||||
pte = pmap_pte(kernel_pmap, td->td_kstack + i * PAGE_SIZE); | pte = pmap_pte(kernel_pmap, td->td_kstack + i * | ||||
PAGE_SIZE); | |||||
td->td_md.md_upte[i] = *pte & ~TLBLO_SWBITS_MASK; | td->td_md.md_upte[i] = *pte & ~TLBLO_SWBITS_MASK; | ||||
} | } | ||||
} | |||||
#endif /* ! KSTACK_LARGE_PAGE */ | |||||
} | } | ||||
void | void | ||||
cpu_set_syscall_retval(struct thread *td, int error) | cpu_set_syscall_retval(struct thread *td, int error) | ||||
{ | { | ||||
struct trapframe *locr0 = td->td_frame; | struct trapframe *locr0 = td->td_frame; | ||||
unsigned int code; | unsigned int code; | ||||
int quad_syscall; | int quad_syscall; | ||||
▲ Show 20 Lines • Show All 343 Lines • Show Last 20 Lines |