From dff71b369adec91f3911cee5596ae0d7bbaf6b71 Mon Sep 17 00:00:00 2001 From: Dale Rahn Date: Tue, 9 May 2006 22:52:14 +0000 Subject: The int (32bit) argument must be sign extended on the 64 bit amd64 before the add. ok miod@, toby@. olrite mickey@ --- lib/libc/arch/amd64/sys/sbrk.S | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/libc/arch/amd64/sys/sbrk.S') 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 -- cgit v1.2.3