Page MenuHomeFreeBSD

D34274.diff
No OneTemporary

D34274.diff

diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c
--- a/sys/riscv/riscv/elf_machdep.c
+++ b/sys/riscv/riscv/elf_machdep.c
@@ -63,7 +63,7 @@
u_long elf_hwcap;
-struct sysentvec elf64_freebsd_sysvec = {
+static struct sysentvec elf64_freebsd_sysvec = {
.sv_size = SYS_MAXSYSCALL,
.sv_table = sysent,
.sv_transtrap = NULL,
@@ -79,9 +79,9 @@
.sv_imgact_try = NULL,
.sv_minsigstksz = MINSIGSTKSZ,
.sv_minuser = VM_MIN_ADDRESS,
- .sv_maxuser = VM_MAXUSER_ADDRESS,
- .sv_usrstack = USRSTACK,
- .sv_psstrings = PS_STRINGS,
+ .sv_maxuser = 0, /* Filled in during boot. */
+ .sv_usrstack = 0, /* Filled in during boot. */
+ .sv_psstrings = 0, /* Filled in during boot. */
.sv_psstringssz = sizeof(struct ps_strings),
.sv_stackprot = VM_PROT_READ | VM_PROT_WRITE,
.sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs),
@@ -94,7 +94,7 @@
.sv_set_syscall_retval = cpu_set_syscall_retval,
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
.sv_syscallnames = syscallnames,
- .sv_shared_page_base = SHAREDPAGE,
+ .sv_shared_page_base = 0, /* Filled in during boot. */
.sv_shared_page_len = PAGE_SIZE,
.sv_schedtail = NULL,
.sv_thread_detach = NULL,
@@ -129,10 +129,33 @@
.brand_note = &elf64_freebsd_brandnote,
.flags = BI_CAN_EXEC_DYN | BI_BRAND_NOTE
};
-
SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_FIRST,
(sysinit_cfunc_t)elf64_insert_brand_entry, &freebsd_brand_info);
+static void
+elf64_register_sysvec(void *arg)
+{
+ struct sysentvec *sv;
+
+ sv = arg;
+ switch (pmap_mode) {
+ case PMAP_MODE_SV48:
+ sv->sv_maxuser = VM_MAX_USER_ADDRESS_SV48;
+ sv->sv_usrstack = USRSTACK_SV48;
+ sv->sv_psstrings = PS_STRINGS_SV48;
+ sv->sv_shared_page_base = SHAREDPAGE_SV48;
+ break;
+ case PMAP_MODE_SV39:
+ sv->sv_maxuser = VM_MAX_USER_ADDRESS_SV39;
+ sv->sv_usrstack = USRSTACK_SV39;
+ sv->sv_psstrings = PS_STRINGS_SV39;
+ sv->sv_shared_page_base = SHAREDPAGE_SV39;
+ break;
+ }
+}
+SYSINIT(elf64_register_sysvec, SI_SUB_VM, SI_ORDER_ANY, elf64_register_sysvec,
+ &elf64_freebsd_sysvec);
+
static bool debug_kld;
SYSCTL_BOOL(_debug, OID_AUTO, kld_reloc, CTLFLAG_RW, &debug_kld, 0,
"Activate debug prints in elf_reloc_internal()");

File Metadata

Mime Type
text/plain
Expires
Tue, Jan 28, 7:06 AM (4 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16257846
Default Alt Text
D34274.diff (2 KB)

Event Timeline