Port-amd64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys/arch/amd64/amd64
On Fri, Dec 01, 2017 at 09:22:45PM +0000, Maxime Villard wrote:
> Module Name: src
> Committed By: maxv
> Date: Fri Dec 1 21:22:45 UTC 2017
>
> Modified Files:
> src/sys/arch/amd64/amd64: machdep.c process_machdep.c
>
> Log Message:
> Don't even bother with the trap frame, and force the default values.
What's the rationale?
Not getting the correct values for registers in getmcontext is
unexpected and weird.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.278 -r1.279 src/sys/arch/amd64/amd64/machdep.c
> cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/amd64/process_machdep.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>
> Modified files:
>
> Index: src/sys/arch/amd64/amd64/machdep.c
> diff -u src/sys/arch/amd64/amd64/machdep.c:1.278 src/sys/arch/amd64/amd64/machdep.c:1.279
> --- src/sys/arch/amd64/amd64/machdep.c:1.278 Mon Nov 27 09:18:01 2017
> +++ src/sys/arch/amd64/amd64/machdep.c Fri Dec 1 21:22:45 2017
> @@ -1,4 +1,4 @@
> -/* $NetBSD: machdep.c,v 1.278 2017/11/27 09:18:01 maxv Exp $ */
> +/* $NetBSD: machdep.c,v 1.279 2017/12/01 21:22:45 maxv 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.278 2017/11/27 09:18:01 maxv Exp $");
> +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.279 2017/12/01 21:22:45 maxv Exp $");
>
> /* #define XENDEBUG_LOW */
>
> @@ -1892,17 +1892,17 @@ cpu_getmcontext(struct lwp *l, mcontext_
> mcp->__gregs[_REG_RBP] = tf->tf_rbp;
> mcp->__gregs[_REG_RBX] = tf->tf_rbx;
> mcp->__gregs[_REG_RAX] = tf->tf_rax;
> - mcp->__gregs[_REG_GS] = tf->tf_gs & 0xFFFF;
> - mcp->__gregs[_REG_FS] = tf->tf_fs & 0xFFFF;
> - mcp->__gregs[_REG_ES] = tf->tf_es & 0xFFFF;
> - mcp->__gregs[_REG_DS] = tf->tf_ds & 0xFFFF;
> + mcp->__gregs[_REG_GS] = 0;
> + mcp->__gregs[_REG_FS] = 0;
> + mcp->__gregs[_REG_ES] = GSEL(GUDATA_SEL, SEL_UPL);
> + mcp->__gregs[_REG_DS] = GSEL(GUDATA_SEL, SEL_UPL);
> mcp->__gregs[_REG_TRAPNO] = tf->tf_trapno;
> mcp->__gregs[_REG_ERR] = tf->tf_err;
> mcp->__gregs[_REG_RIP] = tf->tf_rip;
> - mcp->__gregs[_REG_CS] = tf->tf_cs & 0xFFFF;
> + mcp->__gregs[_REG_CS] = LSEL(LUCODE_SEL, SEL_UPL);
> mcp->__gregs[_REG_RFLAGS] = tf->tf_rflags;
> mcp->__gregs[_REG_RSP] = tf->tf_rsp;
> - mcp->__gregs[_REG_SS] = tf->tf_ss & 0xFFFF;
> + mcp->__gregs[_REG_SS] = LSEL(LUDATA_SEL, SEL_UPL);
>
> if ((ras_rip = (__greg_t)ras_lookup(l->l_proc,
> (void *) mcp->__gregs[_REG_RIP])) != -1)
> @@ -1949,18 +1949,18 @@ cpu_setmcontext(struct lwp *l, const mco
> tf->tf_rbp = gr[_REG_RBP];
> tf->tf_rbx = gr[_REG_RBX];
> tf->tf_rax = gr[_REG_RAX];
> - tf->tf_gs = gr[_REG_GS] & 0xFFFF;
> - tf->tf_fs = gr[_REG_FS] & 0xFFFF;
> - tf->tf_es = gr[_REG_ES] & 0xFFFF;
> - tf->tf_ds = gr[_REG_DS] & 0xFFFF;
> + tf->tf_gs = 0;
> + tf->tf_fs = 0;
> + tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
> + tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
> /* trapno, err not touched */
> tf->tf_rip = gr[_REG_RIP];
> - tf->tf_cs = gr[_REG_CS] & 0xFFFF;
> + tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
> rflags = tf->tf_rflags;
> rflags &= ~PSL_USER;
> tf->tf_rflags = rflags | (gr[_REG_RFLAGS] & PSL_USER);
> tf->tf_rsp = gr[_REG_RSP];
> - tf->tf_ss = gr[_REG_SS] & 0xFFFF;
> + tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
>
> #ifdef XEN
> /*
>
> Index: src/sys/arch/amd64/amd64/process_machdep.c
> diff -u src/sys/arch/amd64/amd64/process_machdep.c:1.37 src/sys/arch/amd64/amd64/process_machdep.c:1.38
> --- src/sys/arch/amd64/amd64/process_machdep.c:1.37 Mon Nov 27 09:18:01 2017
> +++ src/sys/arch/amd64/amd64/process_machdep.c Fri Dec 1 21:22:45 2017
> @@ -1,4 +1,4 @@
> -/* $NetBSD: process_machdep.c,v 1.37 2017/11/27 09:18:01 maxv Exp $ */
> +/* $NetBSD: process_machdep.c,v 1.38 2017/12/01 21:22:45 maxv Exp $ */
>
> /*
> * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
> @@ -74,7 +74,7 @@
> */
>
> #include <sys/cdefs.h>
> -__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.37 2017/11/27 09:18:01 maxv Exp $");
> +__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.38 2017/12/01 21:22:45 maxv Exp $");
>
> #include "opt_xen.h"
> #include <sys/param.h>
> @@ -125,17 +125,17 @@ process_read_regs(struct lwp *l, struct
> regs->regs[_REG_RBP] = tf->tf_rbp;
> regs->regs[_REG_RBX] = tf->tf_rbx;
> regs->regs[_REG_RAX] = tf->tf_rax;
> - regs->regs[_REG_GS] = tf->tf_gs & 0xFFFF;
> - regs->regs[_REG_FS] = tf->tf_fs & 0xFFFF;
> - regs->regs[_REG_ES] = tf->tf_es & 0xFFFF;
> - regs->regs[_REG_DS] = tf->tf_ds & 0xFFFF;
> + regs->regs[_REG_GS] = 0;
> + regs->regs[_REG_FS] = 0;
> + regs->regs[_REG_ES] = GSEL(GUDATA_SEL, SEL_UPL);
> + regs->regs[_REG_DS] = GSEL(GUDATA_SEL, SEL_UPL);
> regs->regs[_REG_TRAPNO] = tf->tf_trapno;
> regs->regs[_REG_ERR] = tf->tf_err;
> regs->regs[_REG_RIP] = tf->tf_rip;
> - regs->regs[_REG_CS] = tf->tf_cs & 0xFFFF;
> + regs->regs[_REG_CS] = LSEL(LUCODE_SEL, SEL_UPL);
> regs->regs[_REG_RFLAGS] = tf->tf_rflags;
> regs->regs[_REG_RSP] = tf->tf_rsp;
> - regs->regs[_REG_SS] = tf->tf_ss & 0xFFFF;
> + regs->regs[_REG_SS] = LSEL(LUDATA_SEL, SEL_UPL);
>
> return 0;
> }
> @@ -204,16 +204,16 @@ process_write_regs(struct lwp *l, const
> tf->tf_rbp = regs[_REG_RBP];
> tf->tf_rbx = regs[_REG_RBX];
> tf->tf_rax = regs[_REG_RAX];
> - tf->tf_gs = regs[_REG_GS] & 0xFFFF;
> - tf->tf_fs = regs[_REG_FS] & 0xFFFF;
> - tf->tf_es = regs[_REG_ES] & 0xFFFF;
> - tf->tf_ds = regs[_REG_DS] & 0xFFFF;
> + tf->tf_gs = 0;
> + tf->tf_fs = 0;
> + tf->tf_es = GSEL(GUDATA_SEL, SEL_UPL);
> + tf->tf_ds = GSEL(GUDATA_SEL, SEL_UPL);
> /* trapno, err not touched */
> tf->tf_rip = regs[_REG_RIP];
> - tf->tf_cs = regs[_REG_CS] & 0xFFFF;
> + tf->tf_cs = LSEL(LUCODE_SEL, SEL_UPL);
> tf->tf_rflags = regs[_REG_RFLAGS];
> tf->tf_rsp = regs[_REG_RSP];
> - tf->tf_ss = regs[_REG_SS] & 0xFFFF;
> + tf->tf_ss = LSEL(LUDATA_SEL, SEL_UPL);
>
> #ifdef XEN
> /* see comment in cpu_setmcontext */
>
Home |
Main Index |
Thread Index |
Old Index