MCPcopy Create free account
hub / github.com/F-Stack/f-stack / syscall

Function syscall

freebsd/i386/i386/trap.c:1108–1149  ·  view source on GitHub ↗

* syscall - system call request C handler. A system call is * essentially treated as a trap by reusing the frame layout. */

Source from the content-addressed store, hash-verified

1106 * essentially treated as a trap by reusing the frame layout.
1107 */
1108void
1109syscall(struct trapframe *frame)
1110{
1111 struct thread *td;
1112 register_t orig_tf_eflags;
1113 ksiginfo_t ksi;
1114
1115#ifdef DIAGNOSTIC
1116 if (!(TRAPF_USERMODE(frame) &&
1117 (curpcb->pcb_flags & PCB_VM86CALL) == 0)) {
1118 panic("syscall");
1119 /* NOT REACHED */
1120 }
1121#endif
1122 orig_tf_eflags = frame->tf_eflags;
1123
1124 td = curthread;
1125 td->td_frame = frame;
1126
1127 syscallenter(td);
1128
1129 /*
1130 * Traced syscall.
1131 */
1132 if ((orig_tf_eflags & PSL_T) && !(orig_tf_eflags & PSL_VM)) {
1133 frame->tf_eflags &= ~PSL_T;
1134 ksiginfo_init_trap(&ksi);
1135 ksi.ksi_signo = SIGTRAP;
1136 ksi.ksi_code = TRAP_TRACE;
1137 ksi.ksi_addr = (void *)frame->tf_eip;
1138 trapsignal(td, &ksi);
1139 }
1140
1141 KASSERT(PCB_USER_FPU(td->td_pcb),
1142 ("System call %s returning with kernel FPU ctx leaked",
1143 syscallname(td->td_proc, td->td_sa.code)));
1144 KASSERT(td->td_pcb->pcb_save == get_pcb_user_save_td(td),
1145 ("System call %s returning with mangled pcb_save",
1146 syscallname(td->td_proc, td->td_sa.code)));
1147
1148 syscallret(td);
1149}

Callers 15

rte_sys_gettidFunction · 0.50
memfd_createFunction · 0.50
sys_bpfFunction · 0.50
os_overcommits_procFunction · 0.50
init_thp_stateFunction · 0.50
malloc_write_fdFunction · 0.50
malloc_read_fdFunction · 0.50
io_submitFunction · 0.50
ngx_thread_tidFunction · 0.50

Calls 6

syscallenterFunction · 0.85
trapsignalFunction · 0.85
syscallnameFunction · 0.85
syscallretFunction · 0.85
get_pcb_user_save_tdFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected