~mysql/mysql-server/mysql-6.0

« back to all changes in this revision

Viewing changes to mit-pthreads/machdep/syscall-sparc-sunos4.S

  • Committer: bk at mysql
  • Date: 2000-07-31 19:29:14 UTC
  • Revision ID: sp1r-bk@work.mysql.com-20000731192914-08846
Import changeset

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ==== syscall.S ============================================================
 
2
 * Copyright (c) 1994 Chris Provenzano, proven@mit.edu
 
3
 * All rights reserved.
 
4
 *
 
5
 */
 
6
 
 
7
#ifndef lint
 
8
        .text
 
9
        .asciz "$Id$";
 
10
#endif
 
11
 
 
12
#include <sys/syscall.h>
 
13
 
 
14
#define SYSCALL(x)                                      \
 
15
        .globl _machdep_sys_##x;                \
 
16
                                                                        \
 
17
_machdep_sys_##x:;                                      \
 
18
                                                                        \
 
19
        mov SYS_##x, %g1;                       \
 
20
        ta 0;                                                   \
 
21
        bcs,a 2b;                                               \
 
22
        sub %r0,%o0,%o0;                                \
 
23
        retl                                                    
 
24
 
 
25
 
 
26
/*
 
27
 * Initial asm stuff for all functions.
 
28
 */
 
29
        .text
 
30
        .align  4
 
31
 
 
32
/* ==========================================================================
 
33
 * error code for all syscalls. The error value is returned as the negative
 
34
 * of the errno value.
 
35
 */
 
36
 
 
37
1:
 
38
        sub             %r0, %o0, %o0
 
39
2:
 
40
        retl
 
41
        nop
 
42
 
 
43
/* ==========================================================================
 
44
 * machdep_sys_pipe()
 
45
 */
 
46
    .globl _machdep_sys_pipe
 
47
 
 
48
_machdep_sys_pipe:
 
49
    mov  %o0, %o2
 
50
    mov  SYS_pipe, %g1
 
51
    ta  0
 
52
    bcs 1b
 
53
    nop
 
54
    st  %o0, [ %o2 ]
 
55
    st  %o1, [ %o2 + 4 ]
 
56
    retl 
 
57
    mov  %g0, %o0
 
58
 
 
59
/* ==========================================================================
 
60
 * machdep_sys_fork()
 
61
 */
 
62
    .globl _machdep_sys_fork;
 
63
 
 
64
_machdep_sys_fork:;
 
65
 
 
66
    mov SYS_fork, %g1;
 
67
    ta 0;
 
68
    bcs 1b;
 
69
    nop;
 
70
    tst %o1
 
71
    bne,a __fork_parent
 
72
    mov  %g0, %o0
 
73
__fork_parent:;
 
74
    retl
 
75
 
 
76
/* POSIX-compliant getpgrp() takes no arguments.  The SunOS syscall wants
 
77
   one, and gives the POSIXy result if that argument is zero.  */
 
78
        .globl _getpgrp
 
79
_getpgrp:
 
80
        mov SYS_getpgrp, %g1
 
81
        mov 0, %i0
 
82
        ta 0
 
83
        bcs 1b
 
84
        nop
 
85
        retl
 
86
        nop
 
87
 
 
88
#if 0
 
89
/* I think this bit of magic will do the right thing for other syscalls.
 
90
   We get here with the new `errno' code in %o0.  It should get stored in
 
91
   *__error(), and -1 returned to the caller.  */
 
92
        .globl cerror
 
93
cerror:
 
94
        save %sp,-104,%sp
 
95
        /* Now value is in %i0.  Store it in *__error().  */
 
96
        call ___error
 
97
        nop
 
98
        st %i0,[%o0]
 
99
 
 
100
        /* Now also store a copy in global variable errno, for routines
 
101
           like isatty that want to examine it and which haven't been
 
102
           converted yet.  */
 
103
        sethi %hi(_errno), %o0
 
104
        st %i0,[%o0+%lo(_errno)]
 
105
 
 
106
#if 0 /* use this if you want -errno returned */
 
107
        sub %r0,%i0,%i0
 
108
#else /* return -1 */
 
109
        mov -1,%i0
 
110
#endif
 
111
        retl
 
112
        restore
 
113
#endif