diff options
Diffstat (limited to 'sys/arch/amd64/include')
-rw-r--r-- | sys/arch/amd64/include/reg.h | 6 | ||||
-rw-r--r-- | sys/arch/amd64/include/segments.h | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/sys/arch/amd64/include/reg.h b/sys/arch/amd64/include/reg.h index d2ab5521203..293d1fbf403 100644 --- a/sys/arch/amd64/include/reg.h +++ b/sys/arch/amd64/include/reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: reg.h,v 1.2 2004/01/29 12:43:35 mickey Exp $ */ +/* $OpenBSD: reg.h,v 1.3 2004/01/29 13:21:10 mickey Exp $ */ /* $NetBSD: reg.h,v 1.1 2003/04/26 18:39:47 fvdl Exp $ */ /*- @@ -125,4 +125,8 @@ struct fpreg { #define fp_st fxstate.fx_st #define fp_xmm fxstate.fx_xmm +#ifdef _KERNEL +int check_context(const struct reg *, struct trapframe *); +#endif + #endif /* !_AMD64_REG_H_ */ diff --git a/sys/arch/amd64/include/segments.h b/sys/arch/amd64/include/segments.h index 636f3a38fee..58890114e6a 100644 --- a/sys/arch/amd64/include/segments.h +++ b/sys/arch/amd64/include/segments.h @@ -1,4 +1,4 @@ -/* $OpenBSD: segments.h,v 1.1 2004/01/28 01:39:39 mickey Exp $ */ +/* $OpenBSD: segments.h,v 1.2 2004/01/29 13:21:10 mickey Exp $ */ /* $NetBSD: segments.h,v 1.1 2003/04/26 18:39:47 fvdl Exp $ */ /*- @@ -302,4 +302,19 @@ void cpu_init_idt(void); #define LSYSRETBASE_SEL LUCODE32_SEL +/* + * Checks for valid user selectors. If USER_LDT ever gets implemented + * for amd64, these must check the ldt length and SEL_UPL if a user + * ldt is active. + */ +#define VALID_USER_DSEL32(s) \ + ((s) == GSEL(GUDATA32_SEL, SEL_UPL) || (s) == LSEL(LUDATA32_SEL, SEL_UPL)) +#define VALID_USER_CSEL32(s) \ + ((s) == GSEL(GUCODE32_SEL, SEL_UPL) || (s) == LSEL(LUCODE32_SEL, SEL_UPL)) + +#define VALID_USER_CSEL(s) \ + ((s) == GSEL(GUCODE_SEL, SEL_UPL) || (s) == LSEL(LUCODE_SEL, SEL_UPL)) +#define VALID_USER_DSEL(s) \ + ((s) == GSEL(GUDATA_SEL, SEL_UPL) || (s) == LSEL(LUDATA_SEL, SEL_UPL)) + #endif /* _AMD64_SEGMENTS_H_ */ |