diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2017-04-13 03:52:26 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2017-04-13 03:52:26 +0000 |
commit | 0a56ad550d93f3f682ca8025cf0551076161de8d (patch) | |
tree | 936e76255cde4d19880af1bc256734c1ee2fdb1e /sys/arch/mips64 | |
parent | 2cb4e233b2f5b01c7c2be614b500f906457581d4 (diff) |
Provide mips64 with kernel-facing TCB_{GET,SET} macros that store it
in struct mdproc. With that, all archs have those and the __HAVE_MD_TCB
macro can be unifdef'ed as always defined.
ok kettenis@ visa@ jsing@
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r-- | sys/arch/mips64/include/proc.h | 3 | ||||
-rw-r--r-- | sys/arch/mips64/include/tcb.h | 6 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/vm_machdep.c | 5 |
3 files changed, 8 insertions, 6 deletions
diff --git a/sys/arch/mips64/include/proc.h b/sys/arch/mips64/include/proc.h index 44dd452163a..192efec0594 100644 --- a/sys/arch/mips64/include/proc.h +++ b/sys/arch/mips64/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.10 2016/08/16 13:03:58 visa Exp $ */ +/* $OpenBSD: proc.h,v 1.11 2017/04/13 03:52:25 guenther Exp $ */ /* * Copyright (c) 1992, 1993 @@ -45,6 +45,7 @@ struct mdproc { volatile int md_astpending; /* AST pending for this process */ int md_flags; /* machine-dependent flags */ vaddr_t md_uarea; /* allocated uarea virtual addr */ + void *md_tcb; /* user-space thread-control-block */ /* ptrace fields */ vaddr_t md_ss_addr; /* single step address */ diff --git a/sys/arch/mips64/include/tcb.h b/sys/arch/mips64/include/tcb.h index 1305f9fb96d..9596c9aba71 100644 --- a/sys/arch/mips64/include/tcb.h +++ b/sys/arch/mips64/include/tcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcb.h,v 1.1 2011/10/27 04:01:17 guenther Exp $ */ +/* $OpenBSD: tcb.h,v 1.2 2017/04/13 03:52:25 guenther Exp $ */ /* * Copyright (c) 2011 Philip Guenther <guenther@openbsd.org> @@ -21,7 +21,9 @@ #ifdef _KERNEL -#error "not yet" +/* Not a real register; just saved in struct mdproc */ +#define TCB_SET(p, addr) ((p)->p_md.md_tcb = (addr)) +#define TCB_GET(p) ((p)->p_md.md_tcb) #else /* _KERNEL */ diff --git a/sys/arch/mips64/mips64/vm_machdep.c b/sys/arch/mips64/mips64/vm_machdep.c index 366d7c6969a..ab3149ce449 100644 --- a/sys/arch/mips64/mips64/vm_machdep.c +++ b/sys/arch/mips64/mips64/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.34 2017/02/12 04:55:08 guenther Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.35 2017/04/13 03:52:25 guenther Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 @@ -117,8 +117,7 @@ cpu_fork(struct proc *p1, struct proc *p2, void *stack, void *tcb, */ if (stack != NULL) p2->p_md.md_regs->sp = (u_int64_t)stack; - if (tcb != NULL) - TCB_SET(p2, tcb); + p2->p_md.md_tcb = tcb != NULL ? tcb : p1->p_md.md_tcb; /* * Copy the process control block to the new proc and |