xref: /openbsd/sys/arch/arm64/arm64/ast.c (revision 68cc3983)
1 /* $OpenBSD: ast.c,v 1.8 2023/04/13 02:19:04 jsg 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/user.h>
23 #include <sys/signal.h>
24 #include <sys/syscall.h>
25 #include <sys/syscall_mi.h>
26 #include <machine/pcb.h>
27 
28 #include <uvm/uvm_extern.h>
29 
30 #include <machine/frame.h>
31 
32 /*
33  * Transform cpu ast to mi_ast
34  */
35 
36 void
ast(struct trapframe * tf)37 ast(struct trapframe *tf)
38 {
39 	struct proc *p = curcpu()->ci_curproc;
40 
41 	p->p_addr->u_pcb.pcb_tf = tf;
42 
43 	refreshcreds(p);
44 	uvmexp.softs++;
45 	mi_ast(p, curcpu()->ci_want_resched);
46 	userret(p);
47 }
48