Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/target/x86_64 Use knowledge a...
details: https://anonhg.NetBSD.org/src/rev/2e19dedbf096
branches: trunk
changeset: 319137:2e19dedbf096
user: reinoud <reinoud%NetBSD.org@localhost>
date: Fri May 18 20:11:48 2018 +0000
description:
Use knowledge about the mcontext
diffstat:
sys/arch/usermode/target/x86_64/cpu_x86_64.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diffs (108 lines):
diff -r 7f2739fa880a -r 2e19dedbf096 sys/arch/usermode/target/x86_64/cpu_x86_64.c
--- a/sys/arch/usermode/target/x86_64/cpu_x86_64.c Fri May 18 20:10:25 2018 +0000
+++ b/sys/arch/usermode/target/x86_64/cpu_x86_64.c Fri May 18 20:11:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_x86_64.c,v 1.2 2012/01/14 17:42:52 reinoud Exp $ */
+/* $NetBSD: cpu_x86_64.c,v 1.3 2018/05/18 20:11:48 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <reinoud%netbsd.org@localhost>
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_x86_64.c,v 1.2 2012/01/14 17:42:52 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_x86_64.c,v 1.3 2018/05/18 20:11:48 reinoud Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@@ -118,7 +118,7 @@
KASSERT(mutex_owned(p->p_lock));
ucp = &pcb->pcb_userret_ucp;
- reg = (register_t *) &ucp->uc_mcontext;
+ reg = (register_t *) &ucp->uc_mcontext.__gregs;
#if 0
thunk_printf("%s: ", __func__);
thunk_printf("flags %d, ", (int) ksi->ksi_flags);
@@ -195,7 +195,7 @@
/* set up the user context */
ucp = &pcb->pcb_userret_ucp;
- reg = (register_t *) &ucp->uc_mcontext;
+ reg = (register_t *) &ucp->uc_mcontext.__gregs;
for (i = 0; i < 15; i++)
reg[i] = 0;
@@ -213,7 +213,7 @@
void
md_syscall_get_syscallnumber(ucontext_t *ucp, uint32_t *code)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
*code = reg[14]; /* RAX */
}
@@ -221,7 +221,7 @@
md_syscall_getargs(lwp_t *l, ucontext_t *ucp, int nargs, int argsize,
register_t *args)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
register_t *sp = (register_t *) reg[24];/* RSP */
int ret;
@@ -251,7 +251,7 @@
md_syscall_set_returnargs(lwp_t *l, ucontext_t *ucp,
int error, register_t *rval)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
reg[23] &= ~PSL_C; /* RFLAGS */
if (error > 0) {
@@ -270,7 +270,7 @@
register_t
md_get_pc(ucontext_t *ucp)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
return reg[21]; /* RIP */
}
@@ -278,7 +278,7 @@
register_t
md_get_sp(ucontext_t *ucp)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
return reg[24]; /* RSP */
}
@@ -306,7 +306,7 @@
void
md_syscall_get_opcode(ucontext_t *ucp, uint32_t *opcode)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
// uint8_t *p8 = (uint8_t *) (reg[21]);
uint16_t *p16 = (uint16_t*) (reg[21]); /* RIP */
@@ -326,7 +326,7 @@
void
md_syscall_inc_pc(ucontext_t *ucp, uint32_t opcode)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
/* advance program counter */
switch (opcode) {
@@ -346,7 +346,7 @@
void
md_syscall_dec_pc(ucontext_t *ucp, uint32_t opcode)
{
- register_t *reg = (register_t *) &ucp->uc_mcontext;
+ register_t *reg = (register_t *) &ucp->uc_mcontext.__gregs;
switch (opcode) {
case 0xff0f: /* UD1 */
Home |
Main Index |
Thread Index |
Old Index