diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-02-18 23:26:19 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2002-02-18 23:26:19 +0000 |
commit | 337ad73ee60ad5ba7af14b60edbc59afd444838d (patch) | |
tree | b4653a7547b09e8a7abf4792bf187fae4c05352a /sys/arch | |
parent | b802894a8552bd15effbd46856943bfc996b6540 (diff) |
copy the segment regs w/ zeroing upper 16 bits
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/i386/db_interface.c | 10 | ||||
-rw-r--r-- | sys/arch/i386/i386/process_machdep.c | 42 |
2 files changed, 26 insertions, 26 deletions
diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c index 1b648639bd2..a88160028a1 100644 --- a/sys/arch/i386/i386/db_interface.c +++ b/sys/arch/i386/i386/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.9 2001/11/06 19:53:14 miod Exp $ */ +/* $OpenBSD: db_interface.c,v 1.10 2002/02/18 23:26:18 mickey Exp $ */ /* $NetBSD: db_interface.c,v 1.22 1996/05/03 19:42:00 christos Exp $ */ /* @@ -119,8 +119,8 @@ kdb_trap(type, code, regs) db_active--; splx(s); - regs->tf_es = ddb_regs.tf_es; - regs->tf_ds = ddb_regs.tf_ds; + regs->tf_es = ddb_regs.tf_es & 0xffff; + regs->tf_ds = ddb_regs.tf_ds & 0xffff; regs->tf_edi = ddb_regs.tf_edi; regs->tf_esi = ddb_regs.tf_esi; regs->tf_ebp = ddb_regs.tf_ebp; @@ -129,12 +129,12 @@ kdb_trap(type, code, regs) regs->tf_ecx = ddb_regs.tf_ecx; regs->tf_eax = ddb_regs.tf_eax; regs->tf_eip = ddb_regs.tf_eip; - regs->tf_cs = ddb_regs.tf_cs; + regs->tf_cs = ddb_regs.tf_cs & 0xffff; regs->tf_eflags = ddb_regs.tf_eflags; if (!KERNELMODE(regs->tf_cs, regs->tf_eflags)) { /* ring transit - saved esp and ss valid */ regs->tf_esp = ddb_regs.tf_esp; - regs->tf_ss = ddb_regs.tf_ss; + regs->tf_ss = ddb_regs.tf_ss & 0xffff; } return (1); diff --git a/sys/arch/i386/i386/process_machdep.c b/sys/arch/i386/i386/process_machdep.c index c6b67109aa6..26c441dc8d3 100644 --- a/sys/arch/i386/i386/process_machdep.c +++ b/sys/arch/i386/i386/process_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: process_machdep.c,v 1.7 1996/08/27 10:46:52 downsj Exp $ */ +/* $OpenBSD: process_machdep.c,v 1.8 2002/02/18 23:26:18 mickey Exp $ */ /* $NetBSD: process_machdep.c,v 1.22 1996/05/03 19:42:25 christos Exp $ */ /* @@ -110,18 +110,18 @@ process_read_regs(p, regs) #ifdef VM86 if (tf->tf_eflags & PSL_VM) { - regs->r_gs = tf->tf_vm86_gs; - regs->r_fs = tf->tf_vm86_fs; - regs->r_es = tf->tf_vm86_es; - regs->r_ds = tf->tf_vm86_ds; + regs->r_gs = tf->tf_vm86_gs & 0xffff; + regs->r_fs = tf->tf_vm86_fs & 0xffff; + regs->r_es = tf->tf_vm86_es & 0xffff; + regs->r_ds = tf->tf_vm86_ds & 0xffff; regs->r_eflags = get_vflags(p); } else #endif { - regs->r_gs = pcb->pcb_gs; - regs->r_fs = pcb->pcb_fs; - regs->r_es = tf->tf_es; - regs->r_ds = tf->tf_ds; + regs->r_gs = pcb->pcb_gs & 0xffff; + regs->r_fs = pcb->pcb_fs & 0xffff; + regs->r_es = tf->tf_es & 0xffff; + regs->r_ds = tf->tf_ds & 0xffff; regs->r_eflags = tf->tf_eflags; } regs->r_edi = tf->tf_edi; @@ -132,9 +132,9 @@ process_read_regs(p, regs) regs->r_ecx = tf->tf_ecx; regs->r_eax = tf->tf_eax; regs->r_eip = tf->tf_eip; - regs->r_cs = tf->tf_cs; + regs->r_cs = tf->tf_cs & 0xffff; regs->r_esp = tf->tf_esp; - regs->r_ss = tf->tf_ss; + regs->r_ss = tf->tf_ss & 0xffff; return (0); } @@ -170,10 +170,10 @@ process_write_regs(p, regs) #ifdef VM86 if (tf->tf_eflags & PSL_VM) { - tf->tf_vm86_gs = regs->r_gs; - tf->tf_vm86_fs = regs->r_fs; - tf->tf_vm86_es = regs->r_es; - tf->tf_vm86_ds = regs->r_ds; + tf->tf_vm86_gs = regs->r_gs & 0xffff; + tf->tf_vm86_fs = regs->r_fs & 0xffff; + tf->tf_vm86_es = regs->r_es & 0xffff; + tf->tf_vm86_ds = regs->r_ds & 0xffff; set_vflags(p, regs->r_eflags); } else #endif @@ -207,10 +207,10 @@ process_write_regs(p, regs) !valid_sel(regs->r_fs) && !null_sel(regs->r_fs))) return (EINVAL); - pcb->pcb_gs = regs->r_gs; - pcb->pcb_fs = regs->r_fs; - tf->tf_es = regs->r_es; - tf->tf_ds = regs->r_ds; + pcb->pcb_gs = regs->r_gs & 0xffff; + pcb->pcb_fs = regs->r_fs & 0xffff; + tf->tf_es = regs->r_es & 0xffff; + tf->tf_ds = regs->r_ds & 0xffff; tf->tf_eflags = regs->r_eflags; } tf->tf_edi = regs->r_edi; @@ -221,9 +221,9 @@ process_write_regs(p, regs) tf->tf_ecx = regs->r_ecx; tf->tf_eax = regs->r_eax; tf->tf_eip = regs->r_eip; - tf->tf_cs = regs->r_cs; + tf->tf_cs = regs->r_cs & 0xffff; tf->tf_esp = regs->r_esp; - tf->tf_ss = regs->r_ss; + tf->tf_ss = regs->r_ss & 0xffff; return (0); } |