1 /* syscall.h -- CR16 virtual I/O and trap service codes 2 * 3 * Copyright (c) 2004 National Semiconductor Corporation 4 * 5 * The authors hereby grant permission to use, copy, modify, distribute, 6 * and license this software and its documentation for any purpose, provided 7 * that existing copyright notices are retained in all copies and that this 8 * notice is included verbatim in any distributions. No written agreement, 9 * license, or royalty fee is required for any of the authorized uses. 10 * Modifications to this software may be copyrighted by their authors 11 * and need not follow the licensing terms described here, provided that 12 * the new terms are clearly indicated on the first page of each file where 13 * they apply. 14 */ 15 16 #ifndef _SYSCALL_H 17 #define _SYSCALL_H 18 19 #include <sys/asm.h> 20 21 /* SVC codes to pass to the debugger */ 22 23 /* Virtual I/O services */ 24 #define SVC_OPEN 0x401 25 #define SVC_CLOSE 0x402 26 #define SVC_READ 0x403 27 #define SVC_WRITE 0x404 28 #define SVC_LSEEK 0x405 29 #define SVC_RENAME 0x406 30 #define SVC_UNLINK 0x407 31 #define SVC_GETENV 0x408 32 33 /* Time service */ 34 #define SVC_TIME 0x300 35 36 /* Start/end of program services */ 37 #define SVC_EOP 0x410 38 39 /* Trap services */ 40 #define SVC_SVC 0x505 41 #define SVC_DVZ 0x506 42 #define SVC_FLG 0x507 43 #define SVC_UND 0x50a 44 #define SVC_IAD 0x50c 45 46 47 /* Places the code of the requested service in R0, then transfers control 48 to the debugger using the BPT exception. 49 It is called from the start routine, VIO functions and the trap 50 handlers. */ 51 52 #define STRINGIFY(x) #x 53 #define HOST_SERVICE(service) \ 54 do { \ 55 __asm__("movd\t$" STRINGIFY(service) ",(r1,r0)"); \ 56 _excp_(svc); \ 57 } while (0) 58 59 #endif /* _SYSCALL_H */ 60 61