Deleted Added
sdiff udiff text old ( 114313 ) new ( 115279 )
full compact
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 24 unchanged lines hidden (view full) ---

33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#if defined(SYSLIBC_SCCS) && !defined(lint)
38 .asciz "@(#)sbrk.s 5.1 (Berkeley) 4/23/90"
39#endif /* SYSLIBC_SCCS and not lint */
40#include <machine/asm.h>
41__FBSDID("$FreeBSD: head/lib/libc/amd64/sys/sbrk.S 114313 2003-04-30 18:16:33Z peter $");
42
43#include "SYS.h"
44
45 .globl CNAME(_end)
46 .globl HIDENAME(minbrk)
47 .globl HIDENAME(curbrk)
48
49 .data
50HIDENAME(minbrk): .quad CNAME(_end)
51HIDENAME(curbrk): .quad CNAME(_end)
52 .text
53
54ENTRY(sbrk)
55 pushq %rdi
56 movq %rdi,%rcx
57 movq PIC_GOT(HIDENAME(curbrk)),%rax
58 testq %rcx,%rcx
59 jz back
60 addq %rax,%rdi
61 mov $SYS_break,%eax
62 KERNCALL
63 jb err
64 movq PIC_GOT(HIDENAME(curbrk)),%rax
65 movq 0(%rsp), %rcx
66 addq %rcx,PIC_GOT(HIDENAME(curbrk))
67back:
68 addq $8, %rsp
69 ret
70err:
71 addq $8, %rsp
72 jmp PIC_PLT(HIDENAME(cerror))