summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-01-04 00:40:39 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-01-04 00:40:39 +0000
commit140a7c373f94a56fd6c871d6e0dcfa195ef67a89 (patch)
treee5d6d7446717af4bbf89b271bba288d5e755b606 /sys/arch/sparc64
parent333ed5feab54c7c5414b953c44af9268bfcd56ec (diff)
Prevent sign-extension when setting ASI in %tstate.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/sparc64/machdep.c7
-rw-r--r--sys/arch/sparc64/sparc64/vm_machdep.c13
2 files changed, 10 insertions, 10 deletions
diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c
index 842177f6fe7..e4a8665d455 100644
--- a/sys/arch/sparc64/sparc64/machdep.c
+++ b/sys/arch/sparc64/sparc64/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.104 2007/12/22 15:14:58 kettenis Exp $ */
+/* $OpenBSD: machdep.c,v 1.105 2008/01/04 00:40:38 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */
/*-
@@ -378,9 +378,8 @@ setregs(p, pack, stack, retval)
break;
}
- tstate = (ASI_PRIMARY_NO_FAULT<<TSTATE_ASI_SHIFT) |
- ((pstate)<<TSTATE_PSTATE_SHIFT) |
- (tf->tf_tstate & TSTATE_CWP);
+ tstate = ((u_int64_t)ASI_PRIMARY_NO_FAULT << TSTATE_ASI_SHIFT) |
+ (pstate << TSTATE_PSTATE_SHIFT) | (tf->tf_tstate & TSTATE_CWP);
if (p->p_md.md_fpstate != NULL) {
/*
* We hold an FPU state. If we own *the* FPU chip state
diff --git a/sys/arch/sparc64/sparc64/vm_machdep.c b/sys/arch/sparc64/sparc64/vm_machdep.c
index fd4080f3cc7..7437fb50ae2 100644
--- a/sys/arch/sparc64/sparc64/vm_machdep.c
+++ b/sys/arch/sparc64/sparc64/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.22 2008/01/03 22:50:04 kettenis Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.23 2008/01/04 00:40:38 kettenis Exp $ */
/* $NetBSD: vm_machdep.c,v 1.38 2001/06/30 00:02:20 eeh Exp $ */
/*
@@ -283,14 +283,15 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
npcb->pcb_pc = (long)proc_trampoline - 8;
npcb->pcb_sp = (long)rp - STACK_OFFSET;
- /* Need to create a %tstate if we're forking from proc0 */
+ /* Need to create a %tstate if we're forking from proc0. */
if (p1 == &proc0)
- tf2->tf_tstate = (ASI_PRIMARY_NO_FAULT<<TSTATE_ASI_SHIFT) |
- ((PSTATE_USER)<<TSTATE_PSTATE_SHIFT);
+ tf2->tf_tstate =
+ ((u_int64_t)ASI_PRIMARY_NO_FAULT << TSTATE_ASI_SHIFT) |
+ ((PSTATE_USER) << TSTATE_PSTATE_SHIFT);
else
- /* clear condition codes and disable FPU */
+ /* Clear condition codes and disable FPU. */
tf2->tf_tstate &=
- ~((PSTATE_PEF<<TSTATE_PSTATE_SHIFT)|TSTATE_CCR);
+ ~((PSTATE_PEF << TSTATE_PSTATE_SHIFT) | TSTATE_CCR);
#ifdef NOTDEF_DEBUG
printf("cpu_fork: Copying over trapframe: otf=%p ntf=%p sp=%p opcb=%p npcb=%p\n",