Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/init_main.c
Show First 20 Lines • Show All 383 Lines • ▼ Show 20 Lines | static char diag_warn[] = | ||||
"WARNING: DIAGNOSTIC option enabled, expect reduced performance.\n"; | "WARNING: DIAGNOSTIC option enabled, expect reduced performance.\n"; | ||||
SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_FIFTH, | SYSINIT(diagwarn, SI_SUB_COPYRIGHT, SI_ORDER_FIFTH, | ||||
print_caddr_t, diag_warn); | print_caddr_t, diag_warn); | ||||
SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_FIFTH, | SYSINIT(diagwarn2, SI_SUB_LAST, SI_ORDER_FIFTH, | ||||
print_caddr_t, diag_warn); | print_caddr_t, diag_warn); | ||||
#endif | #endif | ||||
static int | static int | ||||
null_fetch_syscall_args(struct thread *td __unused) | elf_kernel_fetch_syscall_args(struct thread *td __unused) | ||||
{ | { | ||||
panic("null_fetch_syscall_args"); | panic("elf_kernel_fetch_syscall_args"); | ||||
} | } | ||||
static void | static void | ||||
null_set_syscall_retval(struct thread *td __unused, int error __unused) | elf_kernel_set_syscall_retval(struct thread *td __unused, int error __unused) | ||||
{ | { | ||||
panic("null_set_syscall_retval"); | panic("elf_kernel_set_syscall_retval"); | ||||
} | } | ||||
static void | static void | ||||
null_set_fork_retval(struct thread *td __unused) | elf_kernel_set_fork_retval(struct thread *td __unused) | ||||
{ | { | ||||
} | } | ||||
struct sysentvec null_sysvec = { | struct sysentvec elf_kernel_sysvec = { | ||||
.sv_size = 0, | .sv_size = 0, | ||||
.sv_table = NULL, | .sv_table = NULL, | ||||
.sv_transtrap = NULL, | .sv_transtrap = NULL, | ||||
.sv_fixup = NULL, | .sv_fixup = NULL, | ||||
.sv_sendsig = NULL, | .sv_sendsig = NULL, | ||||
.sv_sigcode = NULL, | .sv_sigcode = NULL, | ||||
.sv_szsigcode = NULL, | .sv_szsigcode = NULL, | ||||
.sv_name = "null", | .sv_name = "null", | ||||
.sv_coredump = NULL, | .sv_coredump = NULL, | ||||
.sv_imgact_try = NULL, | .sv_imgact_try = NULL, | ||||
.sv_minsigstksz = 0, | .sv_minsigstksz = 0, | ||||
.sv_minuser = VM_MIN_ADDRESS, | .sv_minuser = VM_MIN_ADDRESS, | ||||
jhb: I wonder if some of these shouldn't be 0 instead? For kernel processes without any userland… | |||||
jrtc27AuthorUnsubmitted Done Inline ActionsYeah, those thoughts crossed my mind... hopefully nothing relies on these but who knows? jrtc27: Yeah, those thoughts crossed my mind... hopefully nothing relies on these but who knows? | |||||
kibUnsubmitted Not Done Inline ActionsThe sv_min/maxuser are only relevant at the exec time, where the values from new sysent are taken. We never evaluate old sysent min/maxuser (or we should not) because it is old vmspace that determines the layout of the address space that goes out. In other words, it should be a nop change if you decide to tweak these. kib: The sv_min/maxuser are only relevant at the exec time, where the values from new sysent are… | |||||
.sv_maxuser = VM_MAXUSER_ADDRESS, | .sv_maxuser = VM_MAXUSER_ADDRESS, | ||||
.sv_usrstack = USRSTACK, | .sv_usrstack = USRSTACK, | ||||
.sv_psstrings = PS_STRINGS, | .sv_psstrings = PS_STRINGS, | ||||
.sv_stackprot = VM_PROT_ALL, | .sv_stackprot = VM_PROT_ALL, | ||||
.sv_copyout_strings = NULL, | .sv_copyout_strings = NULL, | ||||
.sv_setregs = NULL, | .sv_setregs = NULL, | ||||
.sv_fixlimit = NULL, | .sv_fixlimit = NULL, | ||||
.sv_maxssiz = NULL, | .sv_maxssiz = NULL, | ||||
.sv_flags = 0, | .sv_flags = 0, | ||||
.sv_set_syscall_retval = null_set_syscall_retval, | .sv_set_syscall_retval = elf_kernel_set_syscall_retval, | ||||
jhbUnsubmitted Not Done Inline ActionsI guess it is better to use these wrappers vs NULL function pointers (matching existing code). jhb: I guess it is better to use these wrappers vs NULL function pointers (matching existing code). | |||||
jrtc27AuthorUnsubmitted Done Inline ActionsYeah, it's marginally more debuggable jrtc27: Yeah, it's marginally more debuggable | |||||
.sv_fetch_syscall_args = null_fetch_syscall_args, | .sv_fetch_syscall_args = elf_kernel_fetch_syscall_args, | ||||
.sv_syscallnames = NULL, | .sv_syscallnames = NULL, | ||||
.sv_schedtail = NULL, | .sv_schedtail = NULL, | ||||
.sv_thread_detach = NULL, | .sv_thread_detach = NULL, | ||||
.sv_trap = NULL, | .sv_trap = NULL, | ||||
.sv_set_fork_retval = null_set_fork_retval, | .sv_set_fork_retval = elf_kernel_set_fork_retval, | ||||
}; | }; | ||||
/* | /* | ||||
* The two following SYSINIT's are proc0 specific glue code. I am not | * The two following SYSINIT's are proc0 specific glue code. I am not | ||||
* convinced that they can not be safely combined, but their order of | * convinced that they can not be safely combined, but their order of | ||||
* operation has been maintained as the same as the original init_main.c | * operation has been maintained as the same as the original init_main.c | ||||
* for right now. | * for right now. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | proc0_init(void *dummy __unused) | ||||
LIST_INIT(&pgrp0.pg_members); | LIST_INIT(&pgrp0.pg_members); | ||||
LIST_INSERT_HEAD(&pgrp0.pg_members, p, p_pglist); | LIST_INSERT_HEAD(&pgrp0.pg_members, p, p_pglist); | ||||
pgrp0.pg_session = &session0; | pgrp0.pg_session = &session0; | ||||
mtx_init(&session0.s_mtx, "session", NULL, MTX_DEF); | mtx_init(&session0.s_mtx, "session", NULL, MTX_DEF); | ||||
refcount_init(&session0.s_count, 1); | refcount_init(&session0.s_count, 1); | ||||
session0.s_leader = p; | session0.s_leader = p; | ||||
p->p_sysent = &null_sysvec; | p->p_sysent = &elf_kernel_sysvec; | ||||
p->p_flag = P_SYSTEM | P_INMEM | P_KPROC; | p->p_flag = P_SYSTEM | P_INMEM | P_KPROC; | ||||
p->p_flag2 = 0; | p->p_flag2 = 0; | ||||
p->p_state = PRS_NORMAL; | p->p_state = PRS_NORMAL; | ||||
p->p_klist = knlist_alloc(&p->p_mtx); | p->p_klist = knlist_alloc(&p->p_mtx); | ||||
STAILQ_INIT(&p->p_ktr); | STAILQ_INIT(&p->p_ktr); | ||||
p->p_nice = NZERO; | p->p_nice = NZERO; | ||||
td->td_tid = THREAD0_TID; | td->td_tid = THREAD0_TID; | ||||
tidhash_add(td); | tidhash_add(td); | ||||
▲ Show 20 Lines • Show All 394 Lines • Show Last 20 Lines |
I wonder if some of these shouldn't be 0 instead? For kernel processes without any userland memory at all these next 4 things are kind of bogus.