1 /* $OpenBSD: ast.c,v 1.7 2018/06/22 16:08:12 drahn Exp $ */ 2 /* 3 * Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 #include <sys/param.h> 19 #include <sys/systm.h> 20 #include <sys/proc.h> 21 #include <sys/signalvar.h> 22 #include <sys/proc.h> 23 #include <sys/user.h> 24 #include <sys/signal.h> 25 #include <sys/syscall.h> 26 #include <sys/syscall_mi.h> 27 #include <machine/pcb.h> 28 29 #include <uvm/uvm_extern.h> 30 31 #include <machine/frame.h> 32 33 /* 34 * Transform cpu ast to mi_ast 35 */ 36 37 void 38 ast(struct trapframe *tf) 39 { 40 struct proc *p = curcpu()->ci_curproc; 41 42 p->p_addr->u_pcb.pcb_tf = tf; 43 44 refreshcreds(p); 45 uvmexp.softs++; 46 mi_ast(p, curcpu()->ci_want_resched); 47 userret(p); 48 } 49