Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/amd64 Although this is correct, I will let ma...
details: https://anonhg.NetBSD.org/src/rev/10c6d4cdd88c
branches: trunk
changeset: 962103:10c6d4cdd88c
user: christos <christos%NetBSD.org@localhost>
date: Thu Jun 27 02:00:30 2019 +0000
description:
Although this is correct, I will let maxv commit it. Still waiting.
diffstat:
sys/arch/amd64/amd64/machdep.c | 28 +++++++++++-----------------
1 files changed, 11 insertions(+), 17 deletions(-)
diffs (78 lines):
diff -r 8cca5f37460d -r 10c6d4cdd88c sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Thu Jun 27 01:59:30 2019 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Thu Jun 27 02:00:30 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.333 2019/06/27 01:59:30 christos Exp $ */
+/* $NetBSD: machdep.c,v 1.334 2019/06/27 02:00:30 christos Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.333 2019/06/27 01:59:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.334 2019/06/27 02:00:30 christos Exp $");
#include "opt_modular.h"
#include "opt_user_ldt.h"
@@ -2095,50 +2095,44 @@
int
cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
{
- struct proc *p = l->l_proc;
+ struct proc *p __diagused = l->l_proc;
struct trapframe *tf = l->l_md.md_regs;
const __greg_t *gr;
uint16_t sel;
- const bool pk32 = (p->p_flag & PK_32) != 0;
+ KASSERT((p->p_flag & PK_32) == 0);
gr = mcp->__gregs;
if (((gr[_REG_RFLAGS] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0)
return EINVAL;
-#define VUD(sel) (pk32 ? VALID_USER_DSEL32(sel) : VALID_USER_DSEL(sel))
-#define VUF(sel) (pk32 ? (VALID_USER_DSEL32(sel) || VALID_USER_FSEL32(sel)) \
- : VALID_USER_DSEL(sel))
-#define VUG(sel) (pk32 ? (VALID_USER_DSEL32(sel) || VALID_USER_GSEL32(sel)) \
- : VALID_USER_DSEL(sel))
-#define VUC(sel) (pk32 ? VALID_USER_CSEL32(sel) : VALID_USER_CSEL(sel))
sel = gr[_REG_ES] & 0xffff;
- if (sel != 0 && !VUD(sel))
+ if (sel != 0 && !VALID_USER_DSEL(sel))
return EINVAL;
sel = gr[_REG_FS] & 0xffff;
- if (sel != 0 && !VUF(sel))
+ if (sel != 0 && !VALID_USER_DSEL(sel))
return EINVAL;
sel = gr[_REG_GS] & 0xffff;
- if (sel != 0 && !VUG(sel))
+ if (sel != 0 && !VALID_USER_DSEL(sel))
return EINVAL;
sel = gr[_REG_DS] & 0xffff;
- if (!VUD(sel))
+ if (!VALID_USER_DSEL(sel))
return EINVAL;
#ifndef XENPV
sel = gr[_REG_SS] & 0xffff;
- if (!VUD(sel))
+ if (!VALID_USER_DSEL(sel))
return EINVAL;
sel = gr[_REG_CS] & 0xffff;
- if (!VUC(sel))
+ if (!VALID_USER_CSEL(sel))
return EINVAL;
#endif
- if (gr[_REG_RIP] >= (pk32 ? VM_MAXUSER_ADDRESS32 : VM_MAXUSER_ADDRESS))
+ if (gr[_REG_RIP] >= VM_MAXUSER_ADDRESS)
return EINVAL;
return 0;
Home |
Main Index |
Thread Index |
Old Index