summaryrefslogtreecommitdiffstats
path: root/sys/arch
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2017-04-13 03:52:25 +0000
committerguenther <guenther@openbsd.org>2017-04-13 03:52:25 +0000
commitf5d56f6d1abf3988ecad6e5bcc0d9e60de25e475 (patch)
treeac9e473e35f69727b04f30b9dc4b858b32ab61f9 /sys/arch
parentInspired by recent dhcrelay changes, bring in stricter CFLAGS! (diff)
downloadwireguard-openbsd-f5d56f6d1abf3988ecad6e5bcc0d9e60de25e475.tar.xz
wireguard-openbsd-f5d56f6d1abf3988ecad6e5bcc0d9e60de25e475.zip
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')
-rw-r--r--sys/arch/alpha/include/proc.h4
-rw-r--r--sys/arch/amd64/include/proc.h4
-rw-r--r--sys/arch/arm/include/proc.h4
-rw-r--r--sys/arch/arm64/include/proc.h4
-rw-r--r--sys/arch/hppa/include/proc.h4
-rw-r--r--sys/arch/i386/include/proc.h4
-rw-r--r--sys/arch/m88k/include/proc.h4
-rw-r--r--sys/arch/mips64/include/proc.h3
-rw-r--r--sys/arch/mips64/include/tcb.h6
-rw-r--r--sys/arch/mips64/mips64/vm_machdep.c5
-rw-r--r--sys/arch/powerpc/include/proc.h4
-rw-r--r--sys/arch/sh/include/proc.h4
-rw-r--r--sys/arch/sparc64/include/proc.h2
13 files changed, 17 insertions, 35 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