source: trunk/libs/newlib/src/libgloss/mep/syscalls.S @ 536

Last change on this file since 536 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.5 KB
Line 
1/*
2 * Copyright (c) 2003  Red Hat, Inc. All rights reserved.
3 *
4 * This copyrighted material is made available to anyone wishing to use, modify,
5 * copy, or redistribute it subject to the terms and conditions of the BSD
6 * License.  This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY expressed or implied, including the implied
8 * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  A copy
9 * of this license is available at http://www.opensource.org/licenses. Any
10 * Red Hat trademarks that are incorporated in the source code or documentation
11 * are not subject to the BSD License and may only be used or replicated with
12 * the express permission of Red Hat, Inc.
13 */
14#include "syscall.h"
15
16/* Return ABI: $1 is errno, $0 is return value. */
17
18#define S(n) \
19        .global n ; .weak n ; n: ; \
20        .2byte 0x7800 | ((SYS_##n & 0xe) << 7) | ((SYS_##n & 1) << 4) ; bra sysret
21
22        .text
23
24#define SYS___mep_write SYS_write
25#define SYS___mep_read SYS_read
26#define SYS__Sid_config SYS_reconfig
27
28S(open)
29S(close)
30S(__mep_read)
31S(__mep_write)
32S(lseek)
33S(unlink)
34S(getpid)
35S(kill)
36S(fstat)
37
38/* ARGV support.  */
39S(argvlen)
40S(argv)
41
42/* These are extras added for one reason or another.  */
43S(chdir)
44S(stat)
45S(chmod)
46S(utime)
47S(time)
48S(gettimeofday)
49S(times)
50S(link)
51S(_Sid_config)
52
53sysret:
54        add3    $sp, $sp, -16
55        sw      $0, 0($sp)
56        sw      $1, 4($sp)
57        ldc     $2, $lp
58        sw      $2, 8($sp)
59        bsr     __errno
60        lw      $1, 4($sp)
61        sw      $1, ($0)
62        lw      $0, 0($sp)
63        lw      $2, 8($sp)
64        stc     $2, $lp
65        add3    $sp, $sp, 16
66        ret
Note: See TracBrowser for help on using the repository browser.