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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [newlib-1.18.0/] [newlib/] [libc/] [sys/] [arc/] [sys/] [syscall.h] - Blame information for rev 207

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

Line No. Rev Author Line
1 207 jeremybenn
/* ARC system call interface */
2
 
3
/* A special version of the flag insn is used to distinguish syscalls from
4
   breakpoints (a breakpoint might be set at the same place).
5
 
6
   The upper 23 bits of the argument to a flag insn are not currently used.
7
   By convention, bit 31 is one to indicate this is a specially coded operand.
8
   The next 15 bits (bits 30-16) can be used for software purposes.
9
   The format isn't documented yet, so the pattern we use here may change.  */
10
 
11
#define SYSCALL_MARKER 0x80010000
12
#define SYSCALL_MAGIC 0x61082300
13
 
14
/* Perform a system call.
15
 
16
   If ERR is 0, it succeeded.  Otherwise it is a positive value for errno.  */
17
 
18
#define SYSCALL(op, rc, err, r0, r1, r2) \
19
asm volatile ( "\
20
              mov r0,%2\n\t \
21
              mov r1,%3\n\t \
22
              mov r2,%4\n\t \
23
              mov r3,%5\n\t \
24
              mov r4,%6\n\t \
25
              flag %7\n\t \
26
              nop\n\t \
27
              nop\n\t \
28
              nop\n\t \
29
              mov %0,r0\n\t \
30
              mov %1,r1" \
31
              : "=r" (rc), "=r" (err) \
32
              : "i" (SYSCALL_MAGIC), "r" (op), "r" (r0), "r" (r1), "r" (r2), \
33
                "i" (1 | SYSCALL_MARKER) \
34
              : "r0", "r1", "r2", "r3", "r4");
35
 
36
#define SYS_exit        1
37
#define SYS_open        2
38
#define SYS_close       3
39
#define SYS_read        4
40
#define SYS_write       5
41
#define SYS_lseek       6
42
#define SYS_link        7
43
#define SYS_unlink      8
44
#define SYS_chdir       9
45
#define SYS_chmod       10
46
#define SYS_stat        11
47
#define SYS_fstat       12
48
#define SYS_access      13
49
#define SYS_getpid      14
50
#define SYS_kill        15
51
#define SYS_time        16
52
 
53
#define SYS_MAX         17

powered by: WebSVN 2.1.0

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