PERFORCE change 158149 for review
Ulf Lilleengen
lulf at FreeBSD.org
Mon Feb 23 12:23:49 PST 2009
http://perforce.freebsd.org/chv.cgi?CH=158149
Change 158149 by lulf at lulf_carrot on 2009/02/23 20:23:17
- Point PTBR to the actual pmap instead of the directory. This allows
code referring to the PRBR to become a bit simpler, allowing tlb_miss
to call pmap_pte for retrieving page.
- Simplify restorectx a bit, removing a few unneeded instructions, using
register+offset addressing directly, and free one register.
- Allocate memory for msgbufp.
Affected files ...
.. //depot/projects/avr32/src/sys/avr32/avr32/pmap.c#7 edit
.. //depot/projects/avr32/src/sys/avr32/avr32/switch.S#6 edit
Differences ...
==== //depot/projects/avr32/src/sys/avr32/avr32/pmap.c#7 (text+ko) ====
@@ -96,11 +96,14 @@
kernel_pmap->pm_pd[j] = (pd_entry_t)(pagetables + (i * NPTEPG));
}
+ msgbufp = (struct msgbuf *)pmap_steal_memory(MSGBUF_SIZE);
+ msgbufinit(msgbufp, MSGBUF_SIZE);
+
kernel_vm_end = VM_MAX_KERNEL_ADDRESS;
/* Enable paging */
tlb_flush();
- sysreg_write(PTBR, (uint32_t)kernel_pmap->pm_pd);
+ sysreg_write(PTBR, (uint32_t)kernel_pmap);
sysreg_write(MMUCR,
bit_offset(SYS, MMUCR, S) |
bit_offset(SYS, MMUCR, E) |
@@ -817,15 +820,11 @@
*/
static int tlb_at = KSTACK_PAGES;
void pmap_tlb_miss(uint32_t ecr, uint32_t tlbear, uint32_t tlbehi) {
- pd_entry_t* pd = (pd_entry_t *)sysreg_read(PTBR);
+ pmap_t pmap = (pmap_t)sysreg_read(PTBR);
pt_entry_t *ent;
register_t mmucr;
- ent = (pt_entry_t *)pd[pd_index_from_va(tlbear)];
- if (ent) {
- ent += pt_index_from_va(tlbear);
- }
-
+ ent = pmap_pte(pmap, tlbear);
if (!ent || !*ent) {
breakpoint();
/* printf("\nTLB miss: %x\n", ecr);
==== //depot/projects/avr32/src/sys/avr32/avr32/switch.S#6 (text+ko) ====
@@ -55,7 +55,6 @@
retal sp /* return 0 */
END(savectx)
-
/**
* r12: Pointer struct thread
* r11: Pmap
@@ -73,26 +72,20 @@
* r4: Misc
* r3: tlbehi save
* r2: Address of PCB
- * r1: Pointer to PD
*/
/* Load PCB and PD address */
ld.w r2, r12[TD_PCB]
- sub r1, r11, -(PMAP_PD)
- ld.w r1, r1
-
- /* Check if stack is in stack is is P3 */
- sub r10, r12, -(TD_KSTACK)
- ld.w r10, r10
+ /* Check if stack is in P3 */
+ ld.w r10, r12[TD_KSTACK]
mov r9, r10
lsr r9, 29
cp r9, 0x6
brne restore_finish
/* Add ASID and V flag to kstack value */
- sub r4, r11, -(PMAP_ASID)
- ld.w r4, r4
+ ld.w r4, r11[PMAP_ASID]
add r10, r4
sbr r10, AT32_SYS_TLBEHI_V
@@ -140,7 +133,7 @@
brne 1b /* Or not */
restore_finish:
- mtsr AT32_SYS_PTBR, r1 /* Point lookups to new pmap */
+ mtsr AT32_SYS_PTBR, r11 /* Point lookups to new pmap */
mtsr AT32_SYS_TLBEHI, r10 /* Set TLBEHI (ASID for new td) */
nop /* Wait for mtsr */
ld.w r4, r2++ /* Load status register */
More information about the p4-projects
mailing list