summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2006-05-09 22:52:14 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2006-05-09 22:52:14 +0000
commitdff71b369adec91f3911cee5596ae0d7bbaf6b71 (patch)
tree8fe3ae5a6fbd67207772c6d40e80436413c8ee07
parent37e9904680175d1fee8a4bdddf1e7d317eb5de0e (diff)
The int (32bit) argument must be sign extended on the 64 bit amd64 before
the add. ok miod@, toby@. olrite mickey@
-rw-r--r--lib/libc/arch/amd64/sys/sbrk.S8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libc/arch/amd64/sys/sbrk.S b/lib/libc/arch/amd64/sys/sbrk.S
index 677068c4978..98fceaf9e0a 100644
--- a/lib/libc/arch/amd64/sys/sbrk.S
+++ b/lib/libc/arch/amd64/sys/sbrk.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: sbrk.S,v 1.2 2004/02/10 00:22:51 drahn Exp $ */
+/* $OpenBSD: sbrk.S,v 1.3 2006/05/09 22:52:13 drahn Exp $ */
/* $NetBSD: sbrk.S,v 1.1 2001/06/19 00:25:06 fvdl Exp $ */
/*-
@@ -57,7 +57,8 @@ __curbrk: .quad _end
SYSENTRY(_sbrk)
#ifdef PIC
movq PIC_GOT(__curbrk),%rdx
- movq (%rdx),%rax
+ movslq %edi, %rax
+ movq (%rdx),%rdi
addq %rax,%rdi
SYSTRAP(break)
jc err
@@ -70,7 +71,8 @@ err:
jmp *%rdx
#else
movq __curbrk(%rip),%rax
- movq %rdi,%rsi
+ movslq %edi,%rsi
+ movq %rsi,%rdi
addq %rax,%rdi
SYSTRAP(break)
jc err