Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F172739764
D736.id1390.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D736.id1390.diff
View Options
Index: head/sys/arm/arm/locore.S
===================================================================
--- head/sys/arm/arm/locore.S
+++ head/sys/arm/arm/locore.S
@@ -152,21 +152,7 @@
/* Find the delta between VA and PA */
adr r0, Lpagetable
- ldr r1, [r0]
- sub r2, r1, r0
- /* At this point: r2 = VA - PA */
-
- /*
- * Find the physical address of the table. After these two
- * instructions:
- * r1 = va(pagetable)
- *
- * r0 = va(pagetable) - (VA - PA)
- * = va(pagetable) - VA + PA
- * = pa(pagetable)
- */
- ldr r1, [r0, #4]
- sub r0, r1, r2
+ bl translate_va_to_pa
#ifndef _ARM_ARCH_6
/*
@@ -289,6 +275,41 @@
/* NOTREACHED */
END(_start)
+#define VA_TO_PA_POINTER(name, table) \
+name: ;\
+ .word . ;\
+ .word table
+
+/*
+ * Returns the physical address of a magic va to pa pointer.
+ * r0 - The pagetable data pointer. This must be built using the
+ * VA_TO_PA_POINTER macro.
+ * e.g.
+ * VA_TO_PA_POINTER(Lpagetable, pagetable)
+ * ...
+ * adr r0, Lpagetable
+ * bl translate_va_to_pa
+ * r0 will now contain the physical address of pagetable
+ * r1, r2 - Trashed
+ */
+translate_va_to_pa:
+ ldr r1, [r0]
+ sub r2, r1, r0
+ /* At this point: r2 = VA - PA */
+
+ /*
+ * Find the physical address of the table. After these two
+ * instructions:
+ * r1 = va(pagetable)
+ *
+ * r0 = va(pagetable) - (VA - PA)
+ * = va(pagetable) - VA + PA
+ * = pa(pagetable)
+ */
+ ldr r1, [r0, #4]
+ sub r0, r1, r2
+ RET
+
/*
* Builds the page table
* r0 - The table base address
@@ -320,9 +341,7 @@
RET
-Lpagetable:
- .word .
- .word pagetable
+VA_TO_PA_POINTER(Lpagetable, pagetable)
Lvirtaddr:
.word KERNVIRTADDR
@@ -368,8 +387,7 @@
.Lmpvirt_done:
.word mpvirt_done
-Lstartup_pagetable_secondary:
- .word temp_pagetable
+VA_TO_PA_POINTER(Lstartup_pagetable_secondary, temp_pagetable)
ASENTRY_NP(mpentry)
@@ -396,10 +414,12 @@
bl armv7_idcache_inv_all /* Modifies r0-r3, ip */
#endif
- ldr r0, Lstartup_pagetable_secondary
- bic r0, r0, #0xf0000000
- orr r0, r0, #PHYSADDR
+ /* Load the page table physical address */
+ adr r0, Lstartup_pagetable_secondary
+ bl translate_va_to_pa
+ /* Load the address the secondary page table */
ldr r0, [r0]
+
orr r0, r0, #2 /* Set TTB shared memory flag */
mcr p15, 0, r0, c2, c0, 0 /* Set TTB */
mcr p15, 0, r0, c8, c7, 0 /* Flush TLB */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 21, 4:11 PM (15 m, 26 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39367905
Default Alt Text
D736.id1390.diff (2 KB)
Attached To
Mode
D736: Generalise the va to pa code and use it when starting secondary cores
Attached
Detach File
Event Timeline
Log In to Comment