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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [arc/] [sys/] [syscall.h] - Diff between revs 1010 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1010 Rev 1765
/* ARC system call interface */
/* ARC system call interface */
 
 
/* A special version of the flag insn is used to distinguish syscalls from
/* A special version of the flag insn is used to distinguish syscalls from
   breakpoints (a breakpoint might be set at the same place).
   breakpoints (a breakpoint might be set at the same place).
 
 
   The upper 23 bits of the argument to a flag insn are not currently used.
   The upper 23 bits of the argument to a flag insn are not currently used.
   By convention, bit 31 is one to indicate this is a specially coded operand.
   By convention, bit 31 is one to indicate this is a specially coded operand.
   The next 15 bits (bits 30-16) can be used for software purposes.
   The next 15 bits (bits 30-16) can be used for software purposes.
   The format isn't documented yet, so the pattern we use here may change.  */
   The format isn't documented yet, so the pattern we use here may change.  */
 
 
#define SYSCALL_MARKER 0x80010000
#define SYSCALL_MARKER 0x80010000
#define SYSCALL_MAGIC 0x61082300
#define SYSCALL_MAGIC 0x61082300
 
 
/* Perform a system call.
/* Perform a system call.
 
 
   If ERR is 0, it succeeded.  Otherwise it is a positive value for errno.  */
   If ERR is 0, it succeeded.  Otherwise it is a positive value for errno.  */
 
 
#define SYSCALL(op, rc, err, r0, r1, r2) \
#define SYSCALL(op, rc, err, r0, r1, r2) \
asm volatile ( "\
asm volatile ( "\
              mov r0,%2\n\t \
              mov r0,%2\n\t \
              mov r1,%3\n\t \
              mov r1,%3\n\t \
              mov r2,%4\n\t \
              mov r2,%4\n\t \
              mov r3,%5\n\t \
              mov r3,%5\n\t \
              mov r4,%6\n\t \
              mov r4,%6\n\t \
              flag %7\n\t \
              flag %7\n\t \
              nop\n\t \
              nop\n\t \
              nop\n\t \
              nop\n\t \
              nop\n\t \
              nop\n\t \
              mov %0,r0\n\t \
              mov %0,r0\n\t \
              mov %1,r1" \
              mov %1,r1" \
              : "=r" (rc), "=r" (err) \
              : "=r" (rc), "=r" (err) \
              : "i" (SYSCALL_MAGIC), "r" (op), "r" (r0), "r" (r1), "r" (r2), \
              : "i" (SYSCALL_MAGIC), "r" (op), "r" (r0), "r" (r1), "r" (r2), \
                "i" (1 | SYSCALL_MARKER) \
                "i" (1 | SYSCALL_MARKER) \
              : "r0", "r1", "r2", "r3", "r4");
              : "r0", "r1", "r2", "r3", "r4");
 
 
#define SYS_exit        1
#define SYS_exit        1
#define SYS_open        2
#define SYS_open        2
#define SYS_close       3
#define SYS_close       3
#define SYS_read        4
#define SYS_read        4
#define SYS_write       5
#define SYS_write       5
#define SYS_lseek       6
#define SYS_lseek       6
#define SYS_link        7
#define SYS_link        7
#define SYS_unlink      8
#define SYS_unlink      8
#define SYS_chdir       9
#define SYS_chdir       9
#define SYS_chmod       10
#define SYS_chmod       10
#define SYS_stat        11
#define SYS_stat        11
#define SYS_fstat       12
#define SYS_fstat       12
#define SYS_access      13
#define SYS_access      13
#define SYS_getpid      14
#define SYS_getpid      14
#define SYS_kill        15
#define SYS_kill        15
#define SYS_time        16
#define SYS_time        16
 
 
#define SYS_MAX         17
#define SYS_MAX         17
 
 

powered by: WebSVN 2.1.0

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