diff options
author | 2017-02-19 19:42:40 +0000 | |
---|---|---|
committer | 2017-02-19 19:42:40 +0000 | |
commit | d9cf74874d7c056c1681861c30b326dab3ee26f3 (patch) | |
tree | 73de7a7a0bc23f14b7400404e6fe3a3785b4e364 | |
parent | Remove an unfortunate significant trailing whitespace that ended up passing (diff) | |
download | wireguard-openbsd-d9cf74874d7c056c1681861c30b326dab3ee26f3.tar.xz wireguard-openbsd-d9cf74874d7c056c1681861c30b326dab3ee26f3.zip |
Fix asynchronous system traps so that they actually work. Fixes at
least one regression test and allows processes to be killed using
Ctrl-C. Discussed with Dale Rahn.
-rw-r--r-- | sys/arch/arm64/arm64/ast.c | 4 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/exception.S | 21 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/genassym.cf | 4 |
3 files changed, 18 insertions, 11 deletions
diff --git a/sys/arch/arm64/arm64/ast.c b/sys/arch/arm64/arm64/ast.c index 171eb3a06c9..0cec1177cc9 100644 --- a/sys/arch/arm64/arm64/ast.c +++ b/sys/arch/arm64/arm64/ast.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ast.c,v 1.1 2016/12/17 23:38:33 patrick Exp $ */ +/* $OpenBSD: ast.c,v 1.2 2017/02/19 19:42:40 patrick Exp $ */ /* * Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com> * @@ -39,6 +39,8 @@ ast(struct trapframe *tf) struct proc *p = curcpu()->ci_curproc; int want_resched = curcpu()->ci_want_resched; + p->p_md.md_astpending = 0; + uvmexp.softs++; mi_ast(p, want_resched); userret(p); diff --git a/sys/arch/arm64/arm64/exception.S b/sys/arch/arm64/arm64/exception.S index ba07b5d9daf..ab68e5b9ecb 100644 --- a/sys/arch/arm64/arm64/exception.S +++ b/sys/arch/arm64/arm64/exception.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.S,v 1.2 2016/12/18 17:46:52 patrick Exp $ */ +/* $OpenBSD: exception.S,v 1.3 2017/02/19 19:42:40 patrick Exp $ */ /*- * Copyright (c) 2014 Andrew Turner * All rights reserved. @@ -121,12 +121,12 @@ __FBSDID("$FreeBSD: head/sys/arm64/arm64/exception.S 297028 2016-03-18 16:18:29Z 1: msr daifset, #2 - /* Read the current thread flags */ + /* Check for astpending */ mrs x18, tpidr_el1 - ldrb w1, [x18, #CI_WANT_RESCHED] - /* Check if we have either bits set */ - cmp w1, #0 - b.eq 2f + ldr x1, [x18, #CI_CURPROC] + cbz x1, 2f + ldr w1, [x1, #P_ASTPENDING] + cbz w1, 2f /* Restore interrupts */ msr daif, x19 @@ -134,7 +134,7 @@ __FBSDID("$FreeBSD: head/sys/arm64/arm64/exception.S 297028 2016-03-18 16:18:29Z /* handle the ast */ mov x0, sp bl _C_LABEL(ast) - b 1b + b 1b 2: .endm @@ -160,7 +160,6 @@ handle_el0_sync: mov x0, sp bl do_el0_sync bl _C_LABEL(vfp_enable) -ENTRY(syscall_return) do_ast restore_registers 0 eret @@ -171,6 +170,7 @@ handle_el0_irq: mov x0, sp bl arm_cpu_intr bl _C_LABEL(vfp_enable) + do_ast restore_registers 0 eret @@ -181,6 +181,11 @@ handle_el0_error: brk 0xf23 1: b 1b +ENTRY(syscall_return) + do_ast + restore_registers 0 + eret + .macro vempty .align 7 brk 0xfff diff --git a/sys/arch/arm64/arm64/genassym.cf b/sys/arch/arm64/arm64/genassym.cf index 101dd644505..7ca785549f7 100644 --- a/sys/arch/arm64/arm64/genassym.cf +++ b/sys/arch/arm64/arm64/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.1 2016/12/17 23:38:33 patrick Exp $ +# $OpenBSD: genassym.cf,v 1.2 2017/02/19 19:42:40 patrick Exp $ # $NetBSD: genassym.cf,v 1.27 2003/11/04 10:33:16 dsl Exp$ # Copyright (c) 1982, 1990 The Regents of the University of California. @@ -56,6 +56,7 @@ struct cpu_info member CI_CURPROC ci_curproc struct proc +member P_ASTPENDING p_md.md_astpending member P_STAT p_stat struct pcb @@ -76,7 +77,6 @@ define SONPROC SONPROC struct cpu_info member CI_CURPCB ci_curpcb -member CI_WANT_RESCHED ci_want_resched struct proc member P_ADDR p_addr |