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 | |
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')
-rw-r--r-- | sys/arch/alpha/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/amd64/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/arm/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/arm64/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/hppa/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/i386/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/m88k/include/proc.h | 4 | ||||
-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 | ||||
-rw-r--r-- | sys/arch/powerpc/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/sh/include/proc.h | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/include/proc.h | 2 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 7 | ||||
-rw-r--r-- | sys/kern/kern_fork.c | 7 | ||||
-rw-r--r-- | sys/kern/kern_prot.c | 7 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 7 | ||||
-rw-r--r-- | sys/sys/proc.h | 8 |
18 files changed, 26 insertions, 62 deletions
diff --git a/sys/arch/alpha/include/proc.h b/sys/arch/alpha/include/proc.h index 1e4a41939f3..cc4e63074c5 100644 --- a/sys/arch/alpha/include/proc.h +++ b/sys/arch/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.12 2016/05/15 23:37:42 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.13 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.2 1995/03/24 15:01:36 cgd Exp $ */ /* @@ -46,8 +46,6 @@ struct mdproc { struct mdbpt md_sstep[2]; /* two breakpoints for sstep */ }; -#define __HAVE_MD_TCB - /* * md_flags usage * -------------- diff --git a/sys/arch/amd64/include/proc.h b/sys/arch/amd64/include/proc.h index 47c93b892a4..9cb65df8735 100644 --- a/sys/arch/amd64/include/proc.h +++ b/sys/arch/amd64/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.8 2014/03/29 18:09:28 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.9 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -50,6 +50,4 @@ struct mdproc { #define MDP_IRET 0x0002 /* return via iret, not sysret */ /* (iret can restore r11 and rcx) */ -#define __HAVE_MD_TCB - #endif /* _MACHINE_PROC_H_ */ diff --git a/sys/arch/arm/include/proc.h b/sys/arch/arm/include/proc.h index 865d084fff2..740537720ab 100644 --- a/sys/arch/arm/include/proc.h +++ b/sys/arch/arm/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.4 2016/09/24 21:02:31 patrick Exp $ */ +/* $OpenBSD: proc.h,v 1.5 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.5 2003/03/01 04:36:39 thorpej Exp $ */ /* @@ -47,6 +47,4 @@ struct mdproc { void *pmc_state; /* port-specific pmc state */ }; -#define __HAVE_MD_TCB - #endif /* _ARM_PROC_H_ */ diff --git a/sys/arch/arm64/include/proc.h b/sys/arch/arm64/include/proc.h index 178a85c8e1d..caf7100fce0 100644 --- a/sys/arch/arm64/include/proc.h +++ b/sys/arch/arm64/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.1 2016/12/17 23:38:33 patrick Exp $ */ +/* $OpenBSD: proc.h,v 1.2 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.1 2003/04/26 18:39:46 fvdl Exp $ */ /* @@ -42,6 +42,4 @@ struct mdproc { volatile int md_astpending; }; -#define __HAVE_MD_TCB - #endif /* _MACHINE_PROC_H_ */ diff --git a/sys/arch/hppa/include/proc.h b/sys/arch/hppa/include/proc.h index 5f6a93a82bb..137e49afa9a 100644 --- a/sys/arch/hppa/include/proc.h +++ b/sys/arch/hppa/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.5 2011/11/08 15:39:50 kettenis Exp $ */ +/* $OpenBSD: proc.h,v 1.6 2017/04/13 03:52:25 guenther Exp $ */ /* * Copyright (c) 1992, 1993 @@ -43,7 +43,5 @@ struct mdproc { u_int md_bpsave[2]; }; -#define __HAVE_MD_TCB - /* md_flags */ diff --git a/sys/arch/i386/include/proc.h b/sys/arch/i386/include/proc.h index 87af97caf14..811577a20ea 100644 --- a/sys/arch/i386/include/proc.h +++ b/sys/arch/i386/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.6 2011/12/24 04:27:56 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.7 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.10 1995/08/06 05:33:23 mycroft Exp $ */ /* @@ -44,5 +44,3 @@ struct mdproc { /* md_flags */ #define MDP_USEDFPU 0x0001 /* has used the FPU */ - -#define __HAVE_MD_TCB diff --git a/sys/arch/m88k/include/proc.h b/sys/arch/m88k/include/proc.h index 8b5ff9939f3..25c0a4445b0 100644 --- a/sys/arch/m88k/include/proc.h +++ b/sys/arch/m88k/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.7 2014/03/18 22:36:34 miod Exp $ */ +/* $OpenBSD: proc.h,v 1.8 2017/04/13 03:52:25 guenther Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -67,6 +67,4 @@ struct mdproc { u_int md_bp1save; }; -#define __HAVE_MD_TCB - #endif /* _M88K_PROC_H_ */ 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 diff --git a/sys/arch/powerpc/include/proc.h b/sys/arch/powerpc/include/proc.h index e81207c9a24..c6c41e5df90 100644 --- a/sys/arch/powerpc/include/proc.h +++ b/sys/arch/powerpc/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.7 2014/03/29 18:09:30 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.8 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.1 1996/09/30 16:34:31 ws Exp $ */ /*- @@ -42,6 +42,4 @@ struct mdproc { volatile int md_astpending; }; -#define __HAVE_MD_TCB - #endif /* _POWERPC_PROC_H_ */ diff --git a/sys/arch/sh/include/proc.h b/sys/arch/sh/include/proc.h index 7944233f061..b528cea078f 100644 --- a/sys/arch/sh/include/proc.h +++ b/sys/arch/sh/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.3 2016/05/18 20:21:13 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.4 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.10 2005/12/11 12:18:58 christos Exp $ */ /* @@ -57,8 +57,6 @@ struct mdproc { struct md_upte md_upte[UPAGES * 2]; }; -#define __HAVE_MD_TCB - /* md_flags */ #define MDP_USEDFPU 0x0001 /* has used the FPU */ #define MDP_STEP 0x0002 /* single step */ diff --git a/sys/arch/sparc64/include/proc.h b/sys/arch/sparc64/include/proc.h index 59ad6e5a1b6..48c39e47aa9 100644 --- a/sys/arch/sparc64/include/proc.h +++ b/sys/arch/sparc64/include/proc.h @@ -48,5 +48,3 @@ struct mdproc { struct fpstate64 *md_fpstate; /* fpu state, if any; always resident */ volatile int md_astpending; }; - -#define __HAVE_MD_TCB diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 6d12ae1931c..7784d5f4165 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.187 2017/02/11 19:51:06 guenther Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.188 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -61,10 +61,7 @@ #include <sys/syscallargs.h> #include <uvm/uvm_extern.h> - -#ifdef __HAVE_MD_TCB -# include <machine/tcb.h> -#endif +#include <machine/tcb.h> const struct kmem_va_mode kv_exec = { .kv_wait = 1, diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 38c1be4a981..0cb6b56839d 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.195 2017/02/12 04:55:08 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.196 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -64,10 +64,7 @@ #include <sys/syscallargs.h> #include <uvm/uvm.h> - -#ifdef __HAVE_MD_TCB -# include <machine/tcb.h> -#endif +#include <machine/tcb.h> int nprocesses = 1; /* process 0 */ int nthreads = 1; /* proc 0 */ diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 9fae1d747c6..7907f0a5830 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_prot.c,v 1.67 2016/11/07 00:26:32 guenther Exp $ */ +/* $OpenBSD: kern_prot.c,v 1.68 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: kern_prot.c,v 1.33 1996/02/09 18:59:42 christos Exp $ */ /* @@ -51,10 +51,7 @@ #include <sys/mount.h> #include <sys/syscallargs.h> - -#ifdef __HAVE_MD_TCB -# include <machine/tcb.h> -#endif +#include <machine/tcb.h> inline void crset(struct ucred *newcr, const struct ucred *cr) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index e1b2113b197..fd64f0d4ae8 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.208 2017/01/24 00:58:55 mpi Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.209 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -68,10 +68,7 @@ #include <sys/syscallargs.h> #include <uvm/uvm_extern.h> - -#ifdef __HAVE_MD_TCB -# include <machine/tcb.h> -#endif +#include <machine/tcb.h> int filt_sigattach(struct knote *kn); void filt_sigdetach(struct knote *kn); diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 6d3385b4616..3b85a967a01 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.236 2017/03/05 06:40:18 guenther Exp $ */ +/* $OpenBSD: proc.h,v 1.237 2017/04/13 03:52:25 guenther Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -330,12 +330,6 @@ struct proc { u_char p_usrpri; /* User-priority based on p_estcpu and ps_nice. */ int p_pledge_syscall; /* Cache of current syscall */ -#ifndef __HAVE_MD_TCB - void *p_tcb; /* user-space thread-control-block address */ -# define TCB_SET(p, addr) ((p)->p_tcb = (addr)) -# define TCB_GET(p) ((p)->p_tcb) -#endif - struct ucred *p_ucred; /* cached credentials */ struct sigaltstack p_sigstk; /* sp & on stack state variable */ |