source: rtems/c/src/lib/libbsp/arm/gdbarmsim/include/swi.h @ 7a6f8d0

4.104.11
Last change on this file since 7a6f8d0 was 44bb5cd0, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 1, 2009 at 9:48:42 PM

2009-10-01 Joel Sherrill <joel.sherrill@…>

  • .cvsignore, ChangeLog?, Makefile.am, bsp_specs, configure.ac, preinstall.am, console/.cvsignore, console/console-io.c, include/.cvsignore, include/bsp.h, include/irq.h, include/swi.h, start/.cvsignore, start/start.S, startup/.cvsignore, startup/bspreset.c, startup/bspstart.c, startup/linkcmds, startup/syscalls.c: New files.
  • Property mode set to 100644
File size: 3.1 KB
Line 
1/*
2 *  Copied from libgloss 1 Oct 2009.
3 *  Minor modifications to work with RTEMS.
4 *
5 *  $Id$
6 */
7
8/* SWI numbers for RDP (Demon) monitor.  */
9#define SWI_WriteC                 0x0
10#define SWI_Write0                 0x2
11#define SWI_ReadC                  0x4
12#define SWI_CLI                    0x5
13#define SWI_GetEnv                 0x10
14#define SWI_Exit                   0x11
15#define SWI_EnterOS                0x16
16
17#define SWI_GetErrno               0x60
18#define SWI_Clock                  0x61
19#define SWI_Time                   0x63
20#define SWI_Remove                 0x64
21#define SWI_Rename                 0x65
22#define SWI_Open                   0x66
23
24#define SWI_Close                  0x68
25#define SWI_Write                  0x69
26#define SWI_Read                   0x6a
27#define SWI_Seek                   0x6b
28#define SWI_Flen                   0x6c
29
30#define SWI_IsTTY                  0x6e
31#define SWI_TmpNam                 0x6f
32#define SWI_InstallHandler         0x70
33#define SWI_GenerateError          0x71
34
35
36/* Now the SWI numbers and reason codes for RDI (Angel) monitors.  */
37#define AngelSWI_ARM                    0x123456
38#ifdef __thumb__
39#define AngelSWI                        0xAB
40#else
41#define AngelSWI                        AngelSWI_ARM
42#endif
43/* For Thumb-2 code use the BKPT instruction instead of SWI.  */
44#ifdef __thumb2__
45#define AngelSWIInsn                    "bkpt"
46#define AngelSWIAsm                     bkpt
47#else
48#define AngelSWIInsn                    "swi"
49#define AngelSWIAsm                     swi
50#endif
51
52/* The reason codes:  */
53#define AngelSWI_Reason_Open            0x01
54#define AngelSWI_Reason_Close           0x02
55#define AngelSWI_Reason_WriteC          0x03
56#define AngelSWI_Reason_Write0          0x04
57#define AngelSWI_Reason_Write           0x05
58#define AngelSWI_Reason_Read            0x06
59#define AngelSWI_Reason_ReadC           0x07
60#define AngelSWI_Reason_IsTTY           0x09
61#define AngelSWI_Reason_Seek            0x0A
62#define AngelSWI_Reason_FLen            0x0C
63#define AngelSWI_Reason_TmpNam          0x0D
64#define AngelSWI_Reason_Remove          0x0E
65#define AngelSWI_Reason_Rename          0x0F
66#define AngelSWI_Reason_Clock           0x10
67#define AngelSWI_Reason_Time            0x11
68#define AngelSWI_Reason_System          0x12
69#define AngelSWI_Reason_Errno           0x13
70#define AngelSWI_Reason_GetCmdLine      0x15
71#define AngelSWI_Reason_HeapInfo        0x16
72#define AngelSWI_Reason_EnterSVC        0x17
73#define AngelSWI_Reason_ReportException 0x18
74#define ADP_Stopped_ApplicationExit     ((2 << 16) + 38)
75#define ADP_Stopped_RunTimeError        ((2 << 16) + 35)
76
77#if defined(ARM_RDI_MONITOR) && !defined(__ASSEMBLER__)
78
79static inline int
80do_AngelSWI (int reason, void * arg)
81{
82  int value;
83  asm volatile ("mov r0, %1; mov r1, %2; " AngelSWIInsn " %a3; mov %0, r0"
84       : "=r" (value) /* Outputs */
85       : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
86       : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"
87                /* Clobbers r0 and r1, and lr if in supervisor mode */);
88                /* Accordingly to page 13-77 of ARM DUI 0040D other registers
89                   can also be clobbered.  Some memory positions may also be
90                   changed by a system call, so they should not be kept in
91                   registers. Note: we are assuming the manual is right and
92                   Angel is respecting the APCS.  */
93  return value;
94}
95
96#endif
Note: See TracBrowser for help on using the repository browser.