Module Name: src Committed By: martin Date: Thu Nov 21 14:02:33 UTC 2019
Modified Files: src/sys/arch/amd64/amd64 [netbsd-9]: netbsd32_machdep.c Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.125.2.1 src/sys/arch/amd64/amd64/netbsd32_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/netbsd32_machdep.c diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125.2.1 --- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.125 Sat Jul 20 18:25:11 2019 +++ src/sys/arch/amd64/amd64/netbsd32_machdep.c Thu Nov 21 14:02:33 2019 @@ -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 @@ netbsd32_process_write_dbregs(struct lwp 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(®s64, 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, ®s64); return 0;