RTEMS 6.1-rc1
semihosting.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2020 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef _BSPS_ARM_FVP_SEMIHOSTING_H
37#define _BSPS_ARM_FVP_SEMIHOSTING_H
38
39#include <stdint.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
51#define SYS_CLOCK 0x10
52#define SYS_CLOSE 0x02
53#define SYS_ELAPSED 0x30
54#define SYS_ERRNO 0x13
55#define SYS_EXIT 0x18
56#define SYS_EXIT_EXTENDED 0x20
57#define SYS_FLEN 0x0c
58#define SYS_GET_CMDLINE 0x15
59#define SYS_HEAPINFO 0x16
60#define SYS_ISERROR 0x08
61#define SYS_ISTTY 0x09
62#define SYS_OPEN 0x01
63#define SYS_READ 0x06
64#define SYS_READC 0x07
65#define SYS_REMOVE 0x0e
66#define SYS_RENAME 0x0f
67#define SYS_SEEK 0x0a
68#define SYS_SYSTEM 0x12
69#define SYS_TICKFREQ 0x31
70#define SYS_TIME 0x11
71#define SYS_TMPNAM 0x0d
72#define SYS_WRITE 0x05
73#define SYS_WRITEC 0x03
74#define SYS_WRITE0 0x04
75
76#define ADP_Stopped_BranchThroughZero 0x20000
77#define ADP_Stopped_UndefinedInstr 0x20001
78#define ADP_Stopped_SoftwareInterrupt 0x20002
79#define ADP_Stopped_PrefetchAbort 0x20003
80#define ADP_Stopped_DataAbort 0x20004
81#define ADP_Stopped_AddressException 0x20005
82#define ADP_Stopped_IRQ 0x20006
83#define ADP_Stopped_FIQ 0x20007
84#define ADP_Stopped_BreakPoint 0x20020
85#define ADP_Stopped_WatchPoint 0x20021
86#define ADP_Stopped_StepComplete 0x20022
87#define ADP_Stopped_RunTimeErrorUnknown 0x20023
88#define ADP_Stopped_InternalError 0x20024
89#define ADP_Stopped_UserInterruption 0x20025
90#define ADP_Stopped_ApplicationExit 0x20026
91#define ADP_Stopped_StackOverflow 0x20027
92#define ADP_Stopped_DivisionByZero 0x20028
93#define ADP_Stopped_OSSpecific 0x20029
94
95static inline uintptr_t arm_fvp_semihosting_call(
96 uintptr_t op,
97 uintptr_t params
98)
99{
100 register uintptr_t op_and_return_reg __asm__("r0");
101 register uintptr_t params_reg __asm__("r1");
102
103 op_and_return_reg = op;
104 params_reg = params;
105
106 __asm__ volatile (
107#ifdef __thumb__
108 "svc #0xab"
109#else
110 "svc #0x123456"
111#endif
112 : "=r" (op_and_return_reg)
113 : "0" (op_and_return_reg), "r" (params_reg)
114 : "memory"
115 );
116
117 return op_and_return_reg;
118}
119
120void arm_fvp_console_output( char c );
121
122int arm_fvp_console_input( void );
123
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* _BSPS_ARM_FVP_SEMIHOSTING_H */
register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__("g6")
The pointer to the current per-CPU control is available via register g6.