OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [sparc64/] [sbrk.S] - Blame information for rev 194

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
! sbrk() system call
2
 
3
#include "sys/syscallasm.h"
4
 
5
        DATA_SECTION
6
        ALIGN (4)
7
 
8
! CURBRK contains the current top of allocated space.
9
! END is a private symbol in svr4, but a public one in sunos4.
10
! FIXME: CURBRK is 4 bytes for now.
11
 
12
 
13
        GLOBAL (ASM_PRIVATE_SYMBOL (curbrk))
14
ASM_PRIVATE_SYMBOL (curbrk):
15
#ifdef __svr4__
16
        WORD (ASM_PRIVATE_SYMBOL (end))
17
#else
18
        WORD (ASM_SYMBOL (end))
19
#endif
20
 
21
        TEXT_SECTION
22
        ALIGN (4)
23
#ifdef REENT
24
        GLOBAL (ASM_SYMBOL (_sbrk_r))
25
ASM_SYMBOL (_sbrk_r):
26
        mov     %o0,%o5
27
        mov     %o1,%o0
28
#else
29
        GLOBAL (ASM_SYMBOL (sbrk))
30
ASM_SYMBOL (sbrk):
31
#endif
32
        add     %o0,7,%o0
33
        andn    %o0,7,%o0
34
        sethi   %hi (ASM_PRIVATE_SYMBOL (curbrk)),%o2
35
        lduw    [%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))],%o3
36
        add     %o3,7,%o3
37
        andn    %o3,7,%o3
38
        add     %o3,%o0,%o0
39
        mov     %o0,%o4
40
        mov     SYS_brk,%g1
41
        ta      SYSCALL_TRAP
42
        bcs     err
43
        nop
44
        stw     %o4,[%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))]
45
        jmpl    %o7+8,%g0
46
        mov     %o3,%o0
47
 
48
#ifdef REENT
49
        GLOBAL (ASM_SYMBOL (_brk_r))
50
ASM_SYMBOL (_brk_r):
51
        mov     %o0,%o5
52
        mov     %o1,%o0
53
#else
54
        GLOBAL (ASM_SYMBOL (brk))
55
ASM_SYMBOL (brk):
56
#endif
57
        add     %o0,7,%o0
58
        andn    %o0,7,%o0
59
        mov     %o0,%o2
60
        mov     SYS_brk,%g1
61
        ta      SYSCALL_TRAP
62
        bcs     err
63
        nop
64
        sethi   %hi (ASM_PRIVATE_SYMBOL (curbrk)),%o3
65
        st      %o2,[%o3+%lo (ASM_PRIVATE_SYMBOL (curbrk))]
66
        retl
67
        mov     %g0,%o0
68
 
69
err:
70
#ifdef REENT
71
        sethi   %hi (ASM_PRIVATE_SYMBOL (cerror_r)),%g1
72
        or      %g1,%lo (ASM_PRIVATE_SYMBOL (cerror_r)),%g1
73
#else
74
        sethi   %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1
75
        or      %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1
76
#endif
77
        jmpl    %g1,%g0
78
        mov     %o5,%o1

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.