Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107291339
D24495.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24495.diff
View Options
Index: head/sys/riscv/riscv/locore.S
===================================================================
--- head/sys/riscv/riscv/locore.S
+++ head/sys/riscv/riscv/locore.S
@@ -59,13 +59,6 @@
lla gp, __global_pointer$
.option pop
- /* Get the physical address kernel loaded to */
- lla t0, virt_map
- ld t1, 0(t0)
- sub t1, t1, t0
- li t2, KERNBASE
- sub s9, t2, t1 /* s9 = physmem base */
-
/*
* a0 = hart id
* a1 = dtbp
@@ -87,6 +80,9 @@
* Page tables
*/
1:
+ /* Get the kernel's load address */
+ jal get_physmem
+
/* Add L1 entry for kernel */
lla s1, pagetable_l1
lla s2, pagetable_l2 /* Link to next level PN */
@@ -224,6 +220,17 @@
call _C_LABEL(initriscv) /* Off we go */
call _C_LABEL(mi_startup)
+/*
+ * Get the physical address the kernel is loaded to. Returned in s9.
+ */
+get_physmem:
+ lla t0, virt_map /* physical address of virt_map */
+ ld t1, 0(t0) /* virtual address of virt_map */
+ sub t1, t1, t0 /* calculate phys->virt delta */
+ li t2, KERNBASE
+ sub s9, t2, t1 /* s9 = physmem base */
+ ret
+
.align 4
initstack:
.space (PAGE_SIZE * KSTACK_PAGES)
@@ -302,6 +309,9 @@
/* Setup stack pointer */
lla t0, bootstack
ld sp, 0(t0)
+
+ /* Get the kernel's load address */
+ jal get_physmem
/* Setup supervisor trap vector */
lla t0, mpva
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 13, 2:06 AM (12 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15775021
Default Alt Text
D24495.diff (1 KB)
Attached To
Mode
D24495: Make mpentry independent of _start
Attached
Detach File
Event Timeline
Log In to Comment