Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/arch/amd64/amd64 Pull up following revision(s) (reque...



details:   https://anonhg.NetBSD.org/src/rev/dd905bef9574
branches:  netbsd-9
changeset: 461264:dd905bef9574
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Nov 21 14:02:33 2019 +0000

description:
Pull up following revision(s) (requested by rin in ticket #460):

        sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.130

Fix netbsd32_process_write_dbregs() for amd64:
- Zero-clear regs64 so that random values are not written into the
   preserved registers.
- Cast 32-bit registers (int) to u_int, in order to avoid undesired
   sign extension when filled into 64-bit registers (long).

XXX
pullup to netbsd-9

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r 735fb7e12bdd -r dd905bef9574 sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Thu Nov 21 14:00:49 2019 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Thu Nov 21 14:02:33 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.125 2019/07/20 18:25:11 christos Exp $  */
+/*     $NetBSD: netbsd32_machdep.c,v 1.125.2.1 2019/11/21 14:02:33 martin Exp $        */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.125 2019/07/20 18:25:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.125.2.1 2019/11/21 14:02:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -489,13 +489,15 @@
                return EINVAL;
        }
 
-       regs64.dr[0] = regs->dr[0];
-       regs64.dr[1] = regs->dr[1];
-       regs64.dr[2] = regs->dr[2];
-       regs64.dr[3] = regs->dr[3];
+       memset(&regs64, 0, sizeof(regs64));
 
-       regs64.dr[6] = regs->dr[6];
-       regs64.dr[7] = regs->dr[7];
+       regs64.dr[0] = (u_int)regs->dr[0];
+       regs64.dr[1] = (u_int)regs->dr[1];
+       regs64.dr[2] = (u_int)regs->dr[2];
+       regs64.dr[3] = (u_int)regs->dr[3];
+
+       regs64.dr[6] = (u_int)regs->dr[6];
+       regs64.dr[7] = (u_int)regs->dr[7];
 
        x86_dbregs_write(l, &regs64);
        return 0;



Home | Main Index | Thread Index | Old Index