• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision12979 (tree)
Time2019-09-11 13:18:11
Authorgdisirio

Log Message

Missing files.

Change Summary

Incremental Difference

--- trunk/os/sb/host/sbapi.c (nonexistent)
+++ trunk/os/sb/host/sbapi.c (revision 12979)
@@ -0,0 +1,90 @@
1+/*
2+ ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio.
3+
4+ This file is part of ChibiOS.
5+
6+ ChibiOS is free software; you can redistribute it and/or modify
7+ it under the terms of the GNU General Public License as published by
8+ the Free Software Foundation; either version 3 of the License, or
9+ (at your option) any later version.
10+
11+ ChibiOS is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+*/
19+
20+/**
21+ * @file sb/sbhost.c
22+ * @brief ARMv7-M sandbox host API code.
23+ *
24+ * @addtogroup ARMV7M_SANDBOX_HOSTAPI
25+ * @{
26+ */
27+
28+#include "ch.h"
29+#include "sbhost.h"
30+
31+/*===========================================================================*/
32+/* Module local definitions. */
33+/*===========================================================================*/
34+
35+/*===========================================================================*/
36+/* Module exported variables. */
37+/*===========================================================================*/
38+
39+/*===========================================================================*/
40+/* Module local types. */
41+/*===========================================================================*/
42+
43+/*===========================================================================*/
44+/* Module local variables. */
45+/*===========================================================================*/
46+
47+/*===========================================================================*/
48+/* Module local functions. */
49+/*===========================================================================*/
50+
51+/*===========================================================================*/
52+/* Module exported functions. */
53+/*===========================================================================*/
54+
55+uint32_t sb_api_exit(struct port_extctx *ctxp) {
56+
57+ chThdExit((msg_t)ctxp->r0);
58+
59+ return SB_ERR_NOT_IMPLEMENTED;
60+}
61+
62+uint32_t sb_api_get_systime(struct port_extctx *ctxp) {
63+
64+ (void)ctxp;
65+
66+ return (uint32_t)chVTGetSystemTimeX();
67+}
68+
69+uint32_t sb_api_get_frequency(struct port_extctx *ctxp) {
70+
71+ (void)ctxp;
72+
73+ return (uint32_t)CH_CFG_ST_FREQUENCY;
74+}
75+
76+uint32_t sb_api_sleep(struct port_extctx *ctxp) {
77+
78+ chThdSleepMilliseconds((sysinterval_t)ctxp->r0);
79+
80+ return SB_ERR_NOERROR;
81+}
82+
83+uint32_t sb_api_sleep_until_windowed(struct port_extctx *ctxp) {
84+
85+ chThdSleepUntilWindowed((systime_t)ctxp->r0, (systime_t)ctxp->r1);
86+
87+ return SB_ERR_NOERROR;
88+}
89+
90+/** @} */
--- trunk/os/sb/host/sbapi.h (nonexistent)
+++ trunk/os/sb/host/sbapi.h (revision 12979)
@@ -0,0 +1,88 @@
1+/*
2+ ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio.
3+
4+ This file is part of ChibiOS.
5+
6+ ChibiOS is free software; you can redistribute it and/or modify
7+ it under the terms of the GNU General Public License as published by
8+ the Free Software Foundation; either version 3 of the License, or
9+ (at your option) any later version.
10+
11+ ChibiOS is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+*/
19+
20+/**
21+ * @file sb/sbapi.h
22+ * @brief ARMv7-M sandbox host API macros and structures.
23+ *
24+ * @addtogroup ARMV7M_SANDBOX_HOSTAPI
25+ * @{
26+ */
27+
28+#ifndef SBAPI_H
29+#define SBAPI_H
30+
31+/*===========================================================================*/
32+/* Module constants. */
33+/*===========================================================================*/
34+
35+#define SB_SVC1_HANDLER sb_api_exit
36+#define SB_SVC2_HANDLER sb_api_get_systime
37+#define SB_SVC3_HANDLER sb_api_get_frequency
38+#define SB_SVC4_HANDLER sb_api_sleep
39+#define SB_SVC5_HANDLER sb_api_sleep_until_windowed
40+
41+/*===========================================================================*/
42+/* Module pre-compile time settings. */
43+/*===========================================================================*/
44+
45+/*===========================================================================*/
46+/* Derived constants and error checks. */
47+/*===========================================================================*/
48+
49+#if CH_CFG_ST_RESOLUTION != 32
50+#error "SandBox requires CH_CFG_ST_RESOLUTION == 32"
51+#endif
52+
53+#if CH_CFG_INTERVALS_SIZE != 32
54+#error "SandBox requires CH_CFG_INTERVALS_SIZE == 32"
55+#endif
56+
57+/*===========================================================================*/
58+/* Module data structures and types. */
59+/*===========================================================================*/
60+
61+/*===========================================================================*/
62+/* Module macros. */
63+/*===========================================================================*/
64+
65+
66+/*===========================================================================*/
67+/* External declarations. */
68+/*===========================================================================*/
69+
70+#ifdef __cplusplus
71+extern "C" {
72+#endif
73+ uint32_t sb_api_exit(struct port_extctx *ctxp);
74+ uint32_t sb_api_get_systime(struct port_extctx *ctxp);
75+ uint32_t sb_api_get_frequency(struct port_extctx *ctxp);
76+ uint32_t sb_api_sleep(struct port_extctx *ctxp);
77+ uint32_t sb_api_sleep_until_windowed(struct port_extctx *ctxp);
78+#ifdef __cplusplus
79+}
80+#endif
81+
82+/*===========================================================================*/
83+/* Module inline functions. */
84+/*===========================================================================*/
85+
86+#endif /* SBAPI_H */
87+
88+/** @} */
--- trunk/os/sb/host/sbhost.c (nonexistent)
+++ trunk/os/sb/host/sbhost.c (revision 12979)
@@ -0,0 +1,183 @@
1+/*
2+ ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio.
3+
4+ This file is part of ChibiOS.
5+
6+ ChibiOS is free software; you can redistribute it and/or modify
7+ it under the terms of the GNU General Public License as published by
8+ the Free Software Foundation; either version 3 of the License, or
9+ (at your option) any later version.
10+
11+ ChibiOS is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+*/
19+
20+/**
21+ * @file sb/sbhost.c
22+ * @brief ARMv7-M sandbox code.
23+ *
24+ * @addtogroup ARMV7M_SANDBOX
25+ * @{
26+ */
27+
28+#include "ch.h"
29+#include "sbhost.h"
30+
31+/*===========================================================================*/
32+/* Module local definitions. */
33+/*===========================================================================*/
34+
35+/*===========================================================================*/
36+/* Module exported variables. */
37+/*===========================================================================*/
38+
39+uint32_t sb_undef_handler(struct port_extctx *ectxp);
40+
41+const port_syscall_t sb_syscalls[256] = {
42+ SB_SVC0_HANDLER, SB_SVC1_HANDLER, SB_SVC2_HANDLER, SB_SVC3_HANDLER,
43+ SB_SVC4_HANDLER, SB_SVC5_HANDLER, SB_SVC6_HANDLER, SB_SVC7_HANDLER,
44+ SB_SVC8_HANDLER, SB_SVC9_HANDLER, SB_SVC10_HANDLER, SB_SVC11_HANDLER,
45+ SB_SVC12_HANDLER, SB_SVC13_HANDLER, SB_SVC14_HANDLER, SB_SVC15_HANDLER,
46+ SB_SVC16_HANDLER, SB_SVC17_HANDLER, SB_SVC18_HANDLER, SB_SVC19_HANDLER,
47+ SB_SVC20_HANDLER, SB_SVC21_HANDLER, SB_SVC22_HANDLER, SB_SVC23_HANDLER,
48+ SB_SVC24_HANDLER, SB_SVC25_HANDLER, SB_SVC26_HANDLER, SB_SVC27_HANDLER,
49+ SB_SVC28_HANDLER, SB_SVC29_HANDLER, SB_SVC30_HANDLER, SB_SVC31_HANDLER,
50+ SB_SVC32_HANDLER, SB_SVC33_HANDLER, SB_SVC34_HANDLER, SB_SVC35_HANDLER,
51+ SB_SVC36_HANDLER, SB_SVC37_HANDLER, SB_SVC38_HANDLER, SB_SVC39_HANDLER,
52+ SB_SVC40_HANDLER, SB_SVC41_HANDLER, SB_SVC42_HANDLER, SB_SVC43_HANDLER,
53+ SB_SVC44_HANDLER, SB_SVC45_HANDLER, SB_SVC46_HANDLER, SB_SVC47_HANDLER,
54+ SB_SVC48_HANDLER, SB_SVC49_HANDLER, SB_SVC50_HANDLER, SB_SVC51_HANDLER,
55+ SB_SVC52_HANDLER, SB_SVC53_HANDLER, SB_SVC54_HANDLER, SB_SVC55_HANDLER,
56+ SB_SVC56_HANDLER, SB_SVC57_HANDLER, SB_SVC58_HANDLER, SB_SVC59_HANDLER,
57+ SB_SVC60_HANDLER, SB_SVC61_HANDLER, SB_SVC62_HANDLER, SB_SVC63_HANDLER,
58+ SB_SVC64_HANDLER, SB_SVC65_HANDLER, SB_SVC66_HANDLER, SB_SVC67_HANDLER,
59+ SB_SVC68_HANDLER, SB_SVC69_HANDLER, SB_SVC70_HANDLER, SB_SVC71_HANDLER,
60+ SB_SVC72_HANDLER, SB_SVC73_HANDLER, SB_SVC74_HANDLER, SB_SVC75_HANDLER,
61+ SB_SVC76_HANDLER, SB_SVC77_HANDLER, SB_SVC78_HANDLER, SB_SVC79_HANDLER,
62+ SB_SVC80_HANDLER, SB_SVC81_HANDLER, SB_SVC82_HANDLER, SB_SVC83_HANDLER,
63+ SB_SVC84_HANDLER, SB_SVC85_HANDLER, SB_SVC86_HANDLER, SB_SVC87_HANDLER,
64+ SB_SVC88_HANDLER, SB_SVC89_HANDLER, SB_SVC90_HANDLER, SB_SVC91_HANDLER,
65+ SB_SVC92_HANDLER, SB_SVC93_HANDLER, SB_SVC94_HANDLER, SB_SVC95_HANDLER,
66+ SB_SVC96_HANDLER, SB_SVC97_HANDLER, SB_SVC98_HANDLER, SB_SVC99_HANDLER,
67+ SB_SVC100_HANDLER, SB_SVC101_HANDLER, SB_SVC102_HANDLER, SB_SVC103_HANDLER,
68+ SB_SVC104_HANDLER, SB_SVC105_HANDLER, SB_SVC106_HANDLER, SB_SVC107_HANDLER,
69+ SB_SVC108_HANDLER, SB_SVC109_HANDLER, SB_SVC110_HANDLER, SB_SVC111_HANDLER,
70+ SB_SVC112_HANDLER, SB_SVC113_HANDLER, SB_SVC114_HANDLER, SB_SVC115_HANDLER,
71+ SB_SVC116_HANDLER, SB_SVC117_HANDLER, SB_SVC118_HANDLER, SB_SVC119_HANDLER,
72+ SB_SVC120_HANDLER, SB_SVC121_HANDLER, SB_SVC122_HANDLER, SB_SVC123_HANDLER,
73+ SB_SVC124_HANDLER, SB_SVC125_HANDLER, SB_SVC126_HANDLER, SB_SVC127_HANDLER,
74+ SB_SVC128_HANDLER, SB_SVC129_HANDLER, SB_SVC130_HANDLER, SB_SVC131_HANDLER,
75+ SB_SVC132_HANDLER, SB_SVC133_HANDLER, SB_SVC134_HANDLER, SB_SVC135_HANDLER,
76+ SB_SVC136_HANDLER, SB_SVC137_HANDLER, SB_SVC138_HANDLER, SB_SVC139_HANDLER,
77+ SB_SVC140_HANDLER, SB_SVC141_HANDLER, SB_SVC142_HANDLER, SB_SVC143_HANDLER,
78+ SB_SVC144_HANDLER, SB_SVC145_HANDLER, SB_SVC146_HANDLER, SB_SVC147_HANDLER,
79+ SB_SVC148_HANDLER, SB_SVC149_HANDLER, SB_SVC150_HANDLER, SB_SVC151_HANDLER,
80+ SB_SVC152_HANDLER, SB_SVC153_HANDLER, SB_SVC154_HANDLER, SB_SVC155_HANDLER,
81+ SB_SVC156_HANDLER, SB_SVC157_HANDLER, SB_SVC158_HANDLER, SB_SVC159_HANDLER,
82+ SB_SVC160_HANDLER, SB_SVC161_HANDLER, SB_SVC162_HANDLER, SB_SVC163_HANDLER,
83+ SB_SVC164_HANDLER, SB_SVC165_HANDLER, SB_SVC166_HANDLER, SB_SVC167_HANDLER,
84+ SB_SVC168_HANDLER, SB_SVC169_HANDLER, SB_SVC170_HANDLER, SB_SVC171_HANDLER,
85+ SB_SVC172_HANDLER, SB_SVC173_HANDLER, SB_SVC174_HANDLER, SB_SVC175_HANDLER,
86+ SB_SVC176_HANDLER, SB_SVC177_HANDLER, SB_SVC178_HANDLER, SB_SVC179_HANDLER,
87+ SB_SVC180_HANDLER, SB_SVC181_HANDLER, SB_SVC182_HANDLER, SB_SVC183_HANDLER,
88+ SB_SVC184_HANDLER, SB_SVC185_HANDLER, SB_SVC186_HANDLER, SB_SVC187_HANDLER,
89+ SB_SVC188_HANDLER, SB_SVC189_HANDLER, SB_SVC190_HANDLER, SB_SVC191_HANDLER,
90+ SB_SVC192_HANDLER, SB_SVC193_HANDLER, SB_SVC194_HANDLER, SB_SVC195_HANDLER,
91+ SB_SVC196_HANDLER, SB_SVC197_HANDLER, SB_SVC198_HANDLER, SB_SVC199_HANDLER,
92+ SB_SVC200_HANDLER, SB_SVC201_HANDLER, SB_SVC202_HANDLER, SB_SVC203_HANDLER,
93+ SB_SVC204_HANDLER, SB_SVC205_HANDLER, SB_SVC206_HANDLER, SB_SVC207_HANDLER,
94+ SB_SVC208_HANDLER, SB_SVC209_HANDLER, SB_SVC210_HANDLER, SB_SVC211_HANDLER,
95+ SB_SVC212_HANDLER, SB_SVC213_HANDLER, SB_SVC214_HANDLER, SB_SVC215_HANDLER,
96+ SB_SVC216_HANDLER, SB_SVC217_HANDLER, SB_SVC218_HANDLER, SB_SVC219_HANDLER,
97+ SB_SVC220_HANDLER, SB_SVC221_HANDLER, SB_SVC222_HANDLER, SB_SVC223_HANDLER,
98+ SB_SVC224_HANDLER, SB_SVC225_HANDLER, SB_SVC226_HANDLER, SB_SVC227_HANDLER,
99+ SB_SVC228_HANDLER, SB_SVC229_HANDLER, SB_SVC230_HANDLER, SB_SVC231_HANDLER,
100+ SB_SVC232_HANDLER, SB_SVC233_HANDLER, SB_SVC234_HANDLER, SB_SVC235_HANDLER,
101+ SB_SVC236_HANDLER, SB_SVC237_HANDLER, SB_SVC238_HANDLER, SB_SVC239_HANDLER,
102+ SB_SVC240_HANDLER, SB_SVC241_HANDLER, SB_SVC242_HANDLER, SB_SVC243_HANDLER,
103+ SB_SVC244_HANDLER, SB_SVC245_HANDLER, SB_SVC246_HANDLER, SB_SVC247_HANDLER,
104+ SB_SVC248_HANDLER, SB_SVC249_HANDLER, SB_SVC250_HANDLER, SB_SVC251_HANDLER,
105+ SB_SVC252_HANDLER, SB_SVC253_HANDLER, SB_SVC254_HANDLER, SB_SVC255_HANDLER
106+};
107+
108+/*===========================================================================*/
109+/* Module local types. */
110+/*===========================================================================*/
111+
112+/*===========================================================================*/
113+/* Module local variables. */
114+/*===========================================================================*/
115+
116+/*===========================================================================*/
117+/* Module local functions. */
118+/*===========================================================================*/
119+
120+/*===========================================================================*/
121+/* Module exported functions. */
122+/*===========================================================================*/
123+
124+__attribute__((weak))
125+uint32_t sb_undef_handler(struct port_extctx *ectxp) {
126+
127+ (void)ectxp;
128+
129+ return SB_ERR_NOT_IMPLEMENTED;
130+}
131+
132+/**
133+ * @brief Starts a sandboxed thread.
134+ *
135+ * @param[in] sbhp pointer to the sandbox binary header
136+ * @param[in] rp pointer to the regions descriptor
137+ * @return The function returns only if the operation failed.
138+ */
139+void sbStart(const sb_header_t *sbhp,
140+ const sb_regions_t *rp) {
141+ uint32_t pc, psp;
142+
143+ /* Checking header magic numbers.*/
144+ if ((sbhp->hdr_magic1 != SB_MAGIC1) || (sbhp->hdr_magic2 != SB_MAGIC2)) {
145+ return;
146+ }
147+
148+ /* Checking header size and alignment.*/
149+ if (sbhp->hdr_size != sizeof (sb_header_t)) {
150+ return;
151+ }
152+
153+ /* Checking regions, applet regions and sandbox regions must match.*/
154+ if ((sbhp->r0_base != rp->r0_base) || (sbhp->r0_end != rp->r0_end) ||
155+ (sbhp->r1_base != rp->r1_base) || (sbhp->r1_end != rp->r1_end)) {
156+ return;
157+ }
158+
159+ /* PC initial address, by convention it is immediately after the header.*/
160+ pc = (sbhp->r0_base + sbhp->hdr_size) | 1U;
161+
162+ /* PSP initial address, it is placed at end of the last region.*/
163+ if (rp->r1_base == 0U) {
164+ /* Must be in region 1.*/
165+ psp = rp->r0_end;
166+ }
167+ else {
168+ /* Must be in region 2.*/
169+ psp = rp->r1_end;
170+ }
171+
172+ /* Additional context information.*/
173+ chThdGetSelfX()->ctx.syscall.p = (const void *)rp;
174+ chThdGetSelfX()->ctx.syscall.psp = (regarm_t)__get_PSP();
175+
176+ /* Jumping to the unprivileged code.*/
177+ port_unprivileged_jump((regarm_t)pc, (regarm_t)psp);
178+
179+ /* Must never happen condition.*/
180+ chSysHalt("returned");
181+}
182+
183+/** @} */
--- trunk/os/sb/host/sbhost.h (nonexistent)
+++ trunk/os/sb/host/sbhost.h (revision 12979)
@@ -0,0 +1,940 @@
1+/*
2+ ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio.
3+
4+ This file is part of ChibiOS.
5+
6+ ChibiOS is free software; you can redistribute it and/or modify
7+ it under the terms of the GNU General Public License as published by
8+ the Free Software Foundation; either version 3 of the License, or
9+ (at your option) any later version.
10+
11+ ChibiOS is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+*/
19+
20+/**
21+ * @file sb/sbhost.h
22+ * @brief ARMv7-M sandbox macros and structures.
23+ *
24+ * @addtogroup ARMV7M_SANDBOX
25+ * @{
26+ */
27+
28+#ifndef SBHOST_H
29+#define SBHOST_H
30+
31+#include "sbapi.h"
32+#if defined(SB_INCLUDE_USERAPI)
33+#include "sbuserapi.h"
34+#endif
35+
36+/*===========================================================================*/
37+/* Module constants. */
38+/*===========================================================================*/
39+
40+/**
41+ * @brief Magic numbers
42+ * @{
43+ */
44+#define SB_MAGIC1 0xFE9154C0U
45+#define SB_MAGIC2 0x0C4519EFU
46+/** @} */
47+
48+/**
49+ * @brief Sandbox error codes
50+ * @{
51+ */
52+#define SB_ERR_NOERROR 0U
53+#define SB_ERR_NOT_IMPLEMENTED 0xFFFFFFFFU
54+#define SB_ERR_MEMORY_FAULT 0xFFFFFFFEU
55+/** @} */
56+
57+/*===========================================================================*/
58+/* Module pre-compile time settings. */
59+/*===========================================================================*/
60+
61+/*===========================================================================*/
62+/* Derived constants and error checks. */
63+/*===========================================================================*/
64+
65+#if PORT_USE_SYSCALL == FALSE
66+#error "sandbox requires PORT_USE_SYSCALL"
67+#endif
68+
69+/*===========================================================================*/
70+/* Module data structures and types. */
71+/*===========================================================================*/
72+
73+/**
74+ * @brief Type of a syscall handler.
75+ */
76+typedef uint32_t (*port_syscall_t)(struct port_extctx *ctx);
77+
78+/**
79+ * @brief Type of a sandbox memory region.
80+ */
81+typedef struct {
82+ /**
83+ * @brief Region 0 start address.
84+ */
85+ uint32_t r0_base;
86+ /**
87+ * @brief Region 0 size.
88+ */
89+ uint32_t r0_end;
90+ /**
91+ * @brief Region 2 start address.
92+ * @note Zero if not used.
93+ */
94+ uint32_t r1_base;
95+ /**
96+ * @brief Region 2 end address.
97+ * @note Zero if not used.
98+ */
99+ uint32_t r1_end;
100+} sb_regions_t;
101+
102+/**
103+ * @brief Type of a sandbox applet headers.
104+ */
105+typedef struct {
106+ /**
107+ * @brief Magic number 1.
108+ */
109+ uint32_t hdr_magic1;
110+ /**
111+ * @brief Magic number 2.
112+ */
113+ uint32_t hdr_magic2;
114+ /**
115+ * @brief Header size, inclusive of magic numbers.
116+ */
117+ uint32_t hdr_size;
118+ /**
119+ * @brief Used-defined parameters, defaulted to zero.
120+ */
121+ uint32_t user;
122+ /**
123+ * @brief Region 0 start address.
124+ */
125+ uint32_t r0_base;
126+ /**
127+ * @brief Region 0 size.
128+ */
129+ uint32_t r0_end;
130+ /**
131+ * @brief Region 2 start address.
132+ * @note Zero if not used.
133+ */
134+ uint32_t r1_base;
135+ /**
136+ * @brief Region 2 end address.
137+ * @note Zero if not used.
138+ */
139+ uint32_t r1_end;
140+} sb_header_t;
141+
142+/*===========================================================================*/
143+/* Module macros. */
144+/*===========================================================================*/
145+
146+#define __SVC(x) asm volatile ("svc " #x)
147+
148+/*
149+ * All handlers defaulted to a common function.
150+ */
151+#if !defined(SB_SVC0_HANDLER)
152+#define SB_SVC0_HANDLER sb_undef_handler
153+#endif
154+#if !defined(SB_SVC1_HANDLER)
155+#define SB_SVC1_HANDLER sb_undef_handler
156+#endif
157+#if !defined(SB_SVC2_HANDLER)
158+#define SB_SVC2_HANDLER sb_undef_handler
159+#endif
160+#if !defined(SB_SVC3_HANDLER)
161+#define SB_SVC3_HANDLER sb_undef_handler
162+#endif
163+#if !defined(SB_SVC4_HANDLER)
164+#define SB_SVC4_HANDLER sb_undef_handler
165+#endif
166+#if !defined(SB_SVC5_HANDLER)
167+#define SB_SVC5_HANDLER sb_undef_handler
168+#endif
169+#if !defined(SB_SVC6_HANDLER)
170+#define SB_SVC6_HANDLER sb_undef_handler
171+#endif
172+#if !defined(SB_SVC7_HANDLER)
173+#define SB_SVC7_HANDLER sb_undef_handler
174+#endif
175+#if !defined(SB_SVC8_HANDLER)
176+#define SB_SVC8_HANDLER sb_undef_handler
177+#endif
178+#if !defined(SB_SVC9_HANDLER)
179+#define SB_SVC9_HANDLER sb_undef_handler
180+#endif
181+#if !defined(SB_SVC10_HANDLER)
182+#define SB_SVC10_HANDLER sb_undef_handler
183+#endif
184+#if !defined(SB_SVC11_HANDLER)
185+#define SB_SVC11_HANDLER sb_undef_handler
186+#endif
187+#if !defined(SB_SVC12_HANDLER)
188+#define SB_SVC12_HANDLER sb_undef_handler
189+#endif
190+#if !defined(SB_SVC13_HANDLER)
191+#define SB_SVC13_HANDLER sb_undef_handler
192+#endif
193+#if !defined(SB_SVC14_HANDLER)
194+#define SB_SVC14_HANDLER sb_undef_handler
195+#endif
196+#if !defined(SB_SVC15_HANDLER)
197+#define SB_SVC15_HANDLER sb_undef_handler
198+#endif
199+#if !defined(SB_SVC16_HANDLER)
200+#define SB_SVC16_HANDLER sb_undef_handler
201+#endif
202+#if !defined(SB_SVC17_HANDLER)
203+#define SB_SVC17_HANDLER sb_undef_handler
204+#endif
205+#if !defined(SB_SVC18_HANDLER)
206+#define SB_SVC18_HANDLER sb_undef_handler
207+#endif
208+#if !defined(SB_SVC19_HANDLER)
209+#define SB_SVC19_HANDLER sb_undef_handler
210+#endif
211+#if !defined(SB_SVC20_HANDLER)
212+#define SB_SVC20_HANDLER sb_undef_handler
213+#endif
214+#if !defined(SB_SVC21_HANDLER)
215+#define SB_SVC21_HANDLER sb_undef_handler
216+#endif
217+#if !defined(SB_SVC22_HANDLER)
218+#define SB_SVC22_HANDLER sb_undef_handler
219+#endif
220+#if !defined(SB_SVC23_HANDLER)
221+#define SB_SVC23_HANDLER sb_undef_handler
222+#endif
223+#if !defined(SB_SVC24_HANDLER)
224+#define SB_SVC24_HANDLER sb_undef_handler
225+#endif
226+#if !defined(SB_SVC25_HANDLER)
227+#define SB_SVC25_HANDLER sb_undef_handler
228+#endif
229+#if !defined(SB_SVC26_HANDLER)
230+#define SB_SVC26_HANDLER sb_undef_handler
231+#endif
232+#if !defined(SB_SVC27_HANDLER)
233+#define SB_SVC27_HANDLER sb_undef_handler
234+#endif
235+#if !defined(SB_SVC28_HANDLER)
236+#define SB_SVC28_HANDLER sb_undef_handler
237+#endif
238+#if !defined(SB_SVC29_HANDLER)
239+#define SB_SVC29_HANDLER sb_undef_handler
240+#endif
241+#if !defined(SB_SVC30_HANDLER)
242+#define SB_SVC30_HANDLER sb_undef_handler
243+#endif
244+#if !defined(SB_SVC31_HANDLER)
245+#define SB_SVC31_HANDLER sb_undef_handler
246+#endif
247+#if !defined(SB_SVC32_HANDLER)
248+#define SB_SVC32_HANDLER sb_undef_handler
249+#endif
250+#if !defined(SB_SVC33_HANDLER)
251+#define SB_SVC33_HANDLER sb_undef_handler
252+#endif
253+#if !defined(SB_SVC34_HANDLER)
254+#define SB_SVC34_HANDLER sb_undef_handler
255+#endif
256+#if !defined(SB_SVC35_HANDLER)
257+#define SB_SVC35_HANDLER sb_undef_handler
258+#endif
259+#if !defined(SB_SVC36_HANDLER)
260+#define SB_SVC36_HANDLER sb_undef_handler
261+#endif
262+#if !defined(SB_SVC37_HANDLER)
263+#define SB_SVC37_HANDLER sb_undef_handler
264+#endif
265+#if !defined(SB_SVC38_HANDLER)
266+#define SB_SVC38_HANDLER sb_undef_handler
267+#endif
268+#if !defined(SB_SVC39_HANDLER)
269+#define SB_SVC39_HANDLER sb_undef_handler
270+#endif
271+#if !defined(SB_SVC40_HANDLER)
272+#define SB_SVC40_HANDLER sb_undef_handler
273+#endif
274+#if !defined(SB_SVC41_HANDLER)
275+#define SB_SVC41_HANDLER sb_undef_handler
276+#endif
277+#if !defined(SB_SVC42_HANDLER)
278+#define SB_SVC42_HANDLER sb_undef_handler
279+#endif
280+#if !defined(SB_SVC43_HANDLER)
281+#define SB_SVC43_HANDLER sb_undef_handler
282+#endif
283+#if !defined(SB_SVC44_HANDLER)
284+#define SB_SVC44_HANDLER sb_undef_handler
285+#endif
286+#if !defined(SB_SVC45_HANDLER)
287+#define SB_SVC45_HANDLER sb_undef_handler
288+#endif
289+#if !defined(SB_SVC46_HANDLER)
290+#define SB_SVC46_HANDLER sb_undef_handler
291+#endif
292+#if !defined(SB_SVC47_HANDLER)
293+#define SB_SVC47_HANDLER sb_undef_handler
294+#endif
295+#if !defined(SB_SVC48_HANDLER)
296+#define SB_SVC48_HANDLER sb_undef_handler
297+#endif
298+#if !defined(SB_SVC49_HANDLER)
299+#define SB_SVC49_HANDLER sb_undef_handler
300+#endif
301+#if !defined(SB_SVC50_HANDLER)
302+#define SB_SVC50_HANDLER sb_undef_handler
303+#endif
304+#if !defined(SB_SVC51_HANDLER)
305+#define SB_SVC51_HANDLER sb_undef_handler
306+#endif
307+#if !defined(SB_SVC52_HANDLER)
308+#define SB_SVC52_HANDLER sb_undef_handler
309+#endif
310+#if !defined(SB_SVC53_HANDLER)
311+#define SB_SVC53_HANDLER sb_undef_handler
312+#endif
313+#if !defined(SB_SVC54_HANDLER)
314+#define SB_SVC54_HANDLER sb_undef_handler
315+#endif
316+#if !defined(SB_SVC55_HANDLER)
317+#define SB_SVC55_HANDLER sb_undef_handler
318+#endif
319+#if !defined(SB_SVC56_HANDLER)
320+#define SB_SVC56_HANDLER sb_undef_handler
321+#endif
322+#if !defined(SB_SVC57_HANDLER)
323+#define SB_SVC57_HANDLER sb_undef_handler
324+#endif
325+#if !defined(SB_SVC58_HANDLER)
326+#define SB_SVC58_HANDLER sb_undef_handler
327+#endif
328+#if !defined(SB_SVC59_HANDLER)
329+#define SB_SVC59_HANDLER sb_undef_handler
330+#endif
331+#if !defined(SB_SVC60_HANDLER)
332+#define SB_SVC60_HANDLER sb_undef_handler
333+#endif
334+#if !defined(SB_SVC61_HANDLER)
335+#define SB_SVC61_HANDLER sb_undef_handler
336+#endif
337+#if !defined(SB_SVC62_HANDLER)
338+#define SB_SVC62_HANDLER sb_undef_handler
339+#endif
340+#if !defined(SB_SVC63_HANDLER)
341+#define SB_SVC63_HANDLER sb_undef_handler
342+#endif
343+#if !defined(SB_SVC64_HANDLER)
344+#define SB_SVC64_HANDLER sb_undef_handler
345+#endif
346+#if !defined(SB_SVC65_HANDLER)
347+#define SB_SVC65_HANDLER sb_undef_handler
348+#endif
349+#if !defined(SB_SVC66_HANDLER)
350+#define SB_SVC66_HANDLER sb_undef_handler
351+#endif
352+#if !defined(SB_SVC67_HANDLER)
353+#define SB_SVC67_HANDLER sb_undef_handler
354+#endif
355+#if !defined(SB_SVC68_HANDLER)
356+#define SB_SVC68_HANDLER sb_undef_handler
357+#endif
358+#if !defined(SB_SVC69_HANDLER)
359+#define SB_SVC69_HANDLER sb_undef_handler
360+#endif
361+#if !defined(SB_SVC70_HANDLER)
362+#define SB_SVC70_HANDLER sb_undef_handler
363+#endif
364+#if !defined(SB_SVC71_HANDLER)
365+#define SB_SVC71_HANDLER sb_undef_handler
366+#endif
367+#if !defined(SB_SVC72_HANDLER)
368+#define SB_SVC72_HANDLER sb_undef_handler
369+#endif
370+#if !defined(SB_SVC73_HANDLER)
371+#define SB_SVC73_HANDLER sb_undef_handler
372+#endif
373+#if !defined(SB_SVC74_HANDLER)
374+#define SB_SVC74_HANDLER sb_undef_handler
375+#endif
376+#if !defined(SB_SVC75_HANDLER)
377+#define SB_SVC75_HANDLER sb_undef_handler
378+#endif
379+#if !defined(SB_SVC76_HANDLER)
380+#define SB_SVC76_HANDLER sb_undef_handler
381+#endif
382+#if !defined(SB_SVC77_HANDLER)
383+#define SB_SVC77_HANDLER sb_undef_handler
384+#endif
385+#if !defined(SB_SVC78_HANDLER)
386+#define SB_SVC78_HANDLER sb_undef_handler
387+#endif
388+#if !defined(SB_SVC79_HANDLER)
389+#define SB_SVC79_HANDLER sb_undef_handler
390+#endif
391+#if !defined(SB_SVC80_HANDLER)
392+#define SB_SVC80_HANDLER sb_undef_handler
393+#endif
394+#if !defined(SB_SVC81_HANDLER)
395+#define SB_SVC81_HANDLER sb_undef_handler
396+#endif
397+#if !defined(SB_SVC82_HANDLER)
398+#define SB_SVC82_HANDLER sb_undef_handler
399+#endif
400+#if !defined(SB_SVC83_HANDLER)
401+#define SB_SVC83_HANDLER sb_undef_handler
402+#endif
403+#if !defined(SB_SVC84_HANDLER)
404+#define SB_SVC84_HANDLER sb_undef_handler
405+#endif
406+#if !defined(SB_SVC85_HANDLER)
407+#define SB_SVC85_HANDLER sb_undef_handler
408+#endif
409+#if !defined(SB_SVC86_HANDLER)
410+#define SB_SVC86_HANDLER sb_undef_handler
411+#endif
412+#if !defined(SB_SVC87_HANDLER)
413+#define SB_SVC87_HANDLER sb_undef_handler
414+#endif
415+#if !defined(SB_SVC88_HANDLER)
416+#define SB_SVC88_HANDLER sb_undef_handler
417+#endif
418+#if !defined(SB_SVC89_HANDLER)
419+#define SB_SVC89_HANDLER sb_undef_handler
420+#endif
421+#if !defined(SB_SVC90_HANDLER)
422+#define SB_SVC90_HANDLER sb_undef_handler
423+#endif
424+#if !defined(SB_SVC91_HANDLER)
425+#define SB_SVC91_HANDLER sb_undef_handler
426+#endif
427+#if !defined(SB_SVC92_HANDLER)
428+#define SB_SVC92_HANDLER sb_undef_handler
429+#endif
430+#if !defined(SB_SVC93_HANDLER)
431+#define SB_SVC93_HANDLER sb_undef_handler
432+#endif
433+#if !defined(SB_SVC94_HANDLER)
434+#define SB_SVC94_HANDLER sb_undef_handler
435+#endif
436+#if !defined(SB_SVC95_HANDLER)
437+#define SB_SVC95_HANDLER sb_undef_handler
438+#endif
439+#if !defined(SB_SVC96_HANDLER)
440+#define SB_SVC96_HANDLER sb_undef_handler
441+#endif
442+#if !defined(SB_SVC97_HANDLER)
443+#define SB_SVC97_HANDLER sb_undef_handler
444+#endif
445+#if !defined(SB_SVC98_HANDLER)
446+#define SB_SVC98_HANDLER sb_undef_handler
447+#endif
448+#if !defined(SB_SVC99_HANDLER)
449+#define SB_SVC99_HANDLER sb_undef_handler
450+#endif
451+#if !defined(SB_SVC100_HANDLER)
452+#define SB_SVC100_HANDLER sb_undef_handler
453+#endif
454+#if !defined(SB_SVC101_HANDLER)
455+#define SB_SVC101_HANDLER sb_undef_handler
456+#endif
457+#if !defined(SB_SVC102_HANDLER)
458+#define SB_SVC102_HANDLER sb_undef_handler
459+#endif
460+#if !defined(SB_SVC103_HANDLER)
461+#define SB_SVC103_HANDLER sb_undef_handler
462+#endif
463+#if !defined(SB_SVC104_HANDLER)
464+#define SB_SVC104_HANDLER sb_undef_handler
465+#endif
466+#if !defined(SB_SVC105_HANDLER)
467+#define SB_SVC105_HANDLER sb_undef_handler
468+#endif
469+#if !defined(SB_SVC106_HANDLER)
470+#define SB_SVC106_HANDLER sb_undef_handler
471+#endif
472+#if !defined(SB_SVC107_HANDLER)
473+#define SB_SVC107_HANDLER sb_undef_handler
474+#endif
475+#if !defined(SB_SVC108_HANDLER)
476+#define SB_SVC108_HANDLER sb_undef_handler
477+#endif
478+#if !defined(SB_SVC109_HANDLER)
479+#define SB_SVC109_HANDLER sb_undef_handler
480+#endif
481+#if !defined(SB_SVC110_HANDLER)
482+#define SB_SVC110_HANDLER sb_undef_handler
483+#endif
484+#if !defined(SB_SVC111_HANDLER)
485+#define SB_SVC111_HANDLER sb_undef_handler
486+#endif
487+#if !defined(SB_SVC112_HANDLER)
488+#define SB_SVC112_HANDLER sb_undef_handler
489+#endif
490+#if !defined(SB_SVC113_HANDLER)
491+#define SB_SVC113_HANDLER sb_undef_handler
492+#endif
493+#if !defined(SB_SVC114_HANDLER)
494+#define SB_SVC114_HANDLER sb_undef_handler
495+#endif
496+#if !defined(SB_SVC115_HANDLER)
497+#define SB_SVC115_HANDLER sb_undef_handler
498+#endif
499+#if !defined(SB_SVC116_HANDLER)
500+#define SB_SVC116_HANDLER sb_undef_handler
501+#endif
502+#if !defined(SB_SVC117_HANDLER)
503+#define SB_SVC117_HANDLER sb_undef_handler
504+#endif
505+#if !defined(SB_SVC118_HANDLER)
506+#define SB_SVC118_HANDLER sb_undef_handler
507+#endif
508+#if !defined(SB_SVC119_HANDLER)
509+#define SB_SVC119_HANDLER sb_undef_handler
510+#endif
511+#if !defined(SB_SVC120_HANDLER)
512+#define SB_SVC120_HANDLER sb_undef_handler
513+#endif
514+#if !defined(SB_SVC121_HANDLER)
515+#define SB_SVC121_HANDLER sb_undef_handler
516+#endif
517+#if !defined(SB_SVC122_HANDLER)
518+#define SB_SVC122_HANDLER sb_undef_handler
519+#endif
520+#if !defined(SB_SVC123_HANDLER)
521+#define SB_SVC123_HANDLER sb_undef_handler
522+#endif
523+#if !defined(SB_SVC124_HANDLER)
524+#define SB_SVC124_HANDLER sb_undef_handler
525+#endif
526+#if !defined(SB_SVC125_HANDLER)
527+#define SB_SVC125_HANDLER sb_undef_handler
528+#endif
529+#if !defined(SB_SVC126_HANDLER)
530+#define SB_SVC126_HANDLER sb_undef_handler
531+#endif
532+#if !defined(SB_SVC127_HANDLER)
533+#define SB_SVC127_HANDLER sb_undef_handler
534+#endif
535+#if !defined(SB_SVC128_HANDLER)
536+#define SB_SVC128_HANDLER sb_undef_handler
537+#endif
538+#if !defined(SB_SVC129_HANDLER)
539+#define SB_SVC129_HANDLER sb_undef_handler
540+#endif
541+#if !defined(SB_SVC130_HANDLER)
542+#define SB_SVC130_HANDLER sb_undef_handler
543+#endif
544+#if !defined(SB_SVC131_HANDLER)
545+#define SB_SVC131_HANDLER sb_undef_handler
546+#endif
547+#if !defined(SB_SVC132_HANDLER)
548+#define SB_SVC132_HANDLER sb_undef_handler
549+#endif
550+#if !defined(SB_SVC133_HANDLER)
551+#define SB_SVC133_HANDLER sb_undef_handler
552+#endif
553+#if !defined(SB_SVC134_HANDLER)
554+#define SB_SVC134_HANDLER sb_undef_handler
555+#endif
556+#if !defined(SB_SVC135_HANDLER)
557+#define SB_SVC135_HANDLER sb_undef_handler
558+#endif
559+#if !defined(SB_SVC136_HANDLER)
560+#define SB_SVC136_HANDLER sb_undef_handler
561+#endif
562+#if !defined(SB_SVC137_HANDLER)
563+#define SB_SVC137_HANDLER sb_undef_handler
564+#endif
565+#if !defined(SB_SVC138_HANDLER)
566+#define SB_SVC138_HANDLER sb_undef_handler
567+#endif
568+#if !defined(SB_SVC139_HANDLER)
569+#define SB_SVC139_HANDLER sb_undef_handler
570+#endif
571+#if !defined(SB_SVC140_HANDLER)
572+#define SB_SVC140_HANDLER sb_undef_handler
573+#endif
574+#if !defined(SB_SVC141_HANDLER)
575+#define SB_SVC141_HANDLER sb_undef_handler
576+#endif
577+#if !defined(SB_SVC142_HANDLER)
578+#define SB_SVC142_HANDLER sb_undef_handler
579+#endif
580+#if !defined(SB_SVC143_HANDLER)
581+#define SB_SVC143_HANDLER sb_undef_handler
582+#endif
583+#if !defined(SB_SVC144_HANDLER)
584+#define SB_SVC144_HANDLER sb_undef_handler
585+#endif
586+#if !defined(SB_SVC145_HANDLER)
587+#define SB_SVC145_HANDLER sb_undef_handler
588+#endif
589+#if !defined(SB_SVC146_HANDLER)
590+#define SB_SVC146_HANDLER sb_undef_handler
591+#endif
592+#if !defined(SB_SVC147_HANDLER)
593+#define SB_SVC147_HANDLER sb_undef_handler
594+#endif
595+#if !defined(SB_SVC148_HANDLER)
596+#define SB_SVC148_HANDLER sb_undef_handler
597+#endif
598+#if !defined(SB_SVC149_HANDLER)
599+#define SB_SVC149_HANDLER sb_undef_handler
600+#endif
601+#if !defined(SB_SVC150_HANDLER)
602+#define SB_SVC150_HANDLER sb_undef_handler
603+#endif
604+#if !defined(SB_SVC151_HANDLER)
605+#define SB_SVC151_HANDLER sb_undef_handler
606+#endif
607+#if !defined(SB_SVC152_HANDLER)
608+#define SB_SVC152_HANDLER sb_undef_handler
609+#endif
610+#if !defined(SB_SVC153_HANDLER)
611+#define SB_SVC153_HANDLER sb_undef_handler
612+#endif
613+#if !defined(SB_SVC154_HANDLER)
614+#define SB_SVC154_HANDLER sb_undef_handler
615+#endif
616+#if !defined(SB_SVC155_HANDLER)
617+#define SB_SVC155_HANDLER sb_undef_handler
618+#endif
619+#if !defined(SB_SVC156_HANDLER)
620+#define SB_SVC156_HANDLER sb_undef_handler
621+#endif
622+#if !defined(SB_SVC157_HANDLER)
623+#define SB_SVC157_HANDLER sb_undef_handler
624+#endif
625+#if !defined(SB_SVC158_HANDLER)
626+#define SB_SVC158_HANDLER sb_undef_handler
627+#endif
628+#if !defined(SB_SVC159_HANDLER)
629+#define SB_SVC159_HANDLER sb_undef_handler
630+#endif
631+#if !defined(SB_SVC160_HANDLER)
632+#define SB_SVC160_HANDLER sb_undef_handler
633+#endif
634+#if !defined(SB_SVC161_HANDLER)
635+#define SB_SVC161_HANDLER sb_undef_handler
636+#endif
637+#if !defined(SB_SVC162_HANDLER)
638+#define SB_SVC162_HANDLER sb_undef_handler
639+#endif
640+#if !defined(SB_SVC163_HANDLER)
641+#define SB_SVC163_HANDLER sb_undef_handler
642+#endif
643+#if !defined(SB_SVC164_HANDLER)
644+#define SB_SVC164_HANDLER sb_undef_handler
645+#endif
646+#if !defined(SB_SVC165_HANDLER)
647+#define SB_SVC165_HANDLER sb_undef_handler
648+#endif
649+#if !defined(SB_SVC166_HANDLER)
650+#define SB_SVC166_HANDLER sb_undef_handler
651+#endif
652+#if !defined(SB_SVC167_HANDLER)
653+#define SB_SVC167_HANDLER sb_undef_handler
654+#endif
655+#if !defined(SB_SVC168_HANDLER)
656+#define SB_SVC168_HANDLER sb_undef_handler
657+#endif
658+#if !defined(SB_SVC169_HANDLER)
659+#define SB_SVC169_HANDLER sb_undef_handler
660+#endif
661+#if !defined(SB_SVC170_HANDLER)
662+#define SB_SVC170_HANDLER sb_undef_handler
663+#endif
664+#if !defined(SB_SVC171_HANDLER)
665+#define SB_SVC171_HANDLER sb_undef_handler
666+#endif
667+#if !defined(SB_SVC172_HANDLER)
668+#define SB_SVC172_HANDLER sb_undef_handler
669+#endif
670+#if !defined(SB_SVC173_HANDLER)
671+#define SB_SVC173_HANDLER sb_undef_handler
672+#endif
673+#if !defined(SB_SVC174_HANDLER)
674+#define SB_SVC174_HANDLER sb_undef_handler
675+#endif
676+#if !defined(SB_SVC175_HANDLER)
677+#define SB_SVC175_HANDLER sb_undef_handler
678+#endif
679+#if !defined(SB_SVC176_HANDLER)
680+#define SB_SVC176_HANDLER sb_undef_handler
681+#endif
682+#if !defined(SB_SVC177_HANDLER)
683+#define SB_SVC177_HANDLER sb_undef_handler
684+#endif
685+#if !defined(SB_SVC178_HANDLER)
686+#define SB_SVC178_HANDLER sb_undef_handler
687+#endif
688+#if !defined(SB_SVC179_HANDLER)
689+#define SB_SVC179_HANDLER sb_undef_handler
690+#endif
691+#if !defined(SB_SVC180_HANDLER)
692+#define SB_SVC180_HANDLER sb_undef_handler
693+#endif
694+#if !defined(SB_SVC181_HANDLER)
695+#define SB_SVC181_HANDLER sb_undef_handler
696+#endif
697+#if !defined(SB_SVC182_HANDLER)
698+#define SB_SVC182_HANDLER sb_undef_handler
699+#endif
700+#if !defined(SB_SVC183_HANDLER)
701+#define SB_SVC183_HANDLER sb_undef_handler
702+#endif
703+#if !defined(SB_SVC184_HANDLER)
704+#define SB_SVC184_HANDLER sb_undef_handler
705+#endif
706+#if !defined(SB_SVC185_HANDLER)
707+#define SB_SVC185_HANDLER sb_undef_handler
708+#endif
709+#if !defined(SB_SVC186_HANDLER)
710+#define SB_SVC186_HANDLER sb_undef_handler
711+#endif
712+#if !defined(SB_SVC187_HANDLER)
713+#define SB_SVC187_HANDLER sb_undef_handler
714+#endif
715+#if !defined(SB_SVC188_HANDLER)
716+#define SB_SVC188_HANDLER sb_undef_handler
717+#endif
718+#if !defined(SB_SVC189_HANDLER)
719+#define SB_SVC189_HANDLER sb_undef_handler
720+#endif
721+#if !defined(SB_SVC190_HANDLER)
722+#define SB_SVC190_HANDLER sb_undef_handler
723+#endif
724+#if !defined(SB_SVC191_HANDLER)
725+#define SB_SVC191_HANDLER sb_undef_handler
726+#endif
727+#if !defined(SB_SVC192_HANDLER)
728+#define SB_SVC192_HANDLER sb_undef_handler
729+#endif
730+#if !defined(SB_SVC193_HANDLER)
731+#define SB_SVC193_HANDLER sb_undef_handler
732+#endif
733+#if !defined(SB_SVC194_HANDLER)
734+#define SB_SVC194_HANDLER sb_undef_handler
735+#endif
736+#if !defined(SB_SVC195_HANDLER)
737+#define SB_SVC195_HANDLER sb_undef_handler
738+#endif
739+#if !defined(SB_SVC196_HANDLER)
740+#define SB_SVC196_HANDLER sb_undef_handler
741+#endif
742+#if !defined(SB_SVC197_HANDLER)
743+#define SB_SVC197_HANDLER sb_undef_handler
744+#endif
745+#if !defined(SB_SVC198_HANDLER)
746+#define SB_SVC198_HANDLER sb_undef_handler
747+#endif
748+#if !defined(SB_SVC199_HANDLER)
749+#define SB_SVC199_HANDLER sb_undef_handler
750+#endif
751+#if !defined(SB_SVC200_HANDLER)
752+#define SB_SVC200_HANDLER sb_undef_handler
753+#endif
754+#if !defined(SB_SVC201_HANDLER)
755+#define SB_SVC201_HANDLER sb_undef_handler
756+#endif
757+#if !defined(SB_SVC202_HANDLER)
758+#define SB_SVC202_HANDLER sb_undef_handler
759+#endif
760+#if !defined(SB_SVC203_HANDLER)
761+#define SB_SVC203_HANDLER sb_undef_handler
762+#endif
763+#if !defined(SB_SVC204_HANDLER)
764+#define SB_SVC204_HANDLER sb_undef_handler
765+#endif
766+#if !defined(SB_SVC205_HANDLER)
767+#define SB_SVC205_HANDLER sb_undef_handler
768+#endif
769+#if !defined(SB_SVC206_HANDLER)
770+#define SB_SVC206_HANDLER sb_undef_handler
771+#endif
772+#if !defined(SB_SVC207_HANDLER)
773+#define SB_SVC207_HANDLER sb_undef_handler
774+#endif
775+#if !defined(SB_SVC208_HANDLER)
776+#define SB_SVC208_HANDLER sb_undef_handler
777+#endif
778+#if !defined(SB_SVC209_HANDLER)
779+#define SB_SVC209_HANDLER sb_undef_handler
780+#endif
781+#if !defined(SB_SVC210_HANDLER)
782+#define SB_SVC210_HANDLER sb_undef_handler
783+#endif
784+#if !defined(SB_SVC211_HANDLER)
785+#define SB_SVC211_HANDLER sb_undef_handler
786+#endif
787+#if !defined(SB_SVC212_HANDLER)
788+#define SB_SVC212_HANDLER sb_undef_handler
789+#endif
790+#if !defined(SB_SVC213_HANDLER)
791+#define SB_SVC213_HANDLER sb_undef_handler
792+#endif
793+#if !defined(SB_SVC214_HANDLER)
794+#define SB_SVC214_HANDLER sb_undef_handler
795+#endif
796+#if !defined(SB_SVC215_HANDLER)
797+#define SB_SVC215_HANDLER sb_undef_handler
798+#endif
799+#if !defined(SB_SVC216_HANDLER)
800+#define SB_SVC216_HANDLER sb_undef_handler
801+#endif
802+#if !defined(SB_SVC217_HANDLER)
803+#define SB_SVC217_HANDLER sb_undef_handler
804+#endif
805+#if !defined(SB_SVC218_HANDLER)
806+#define SB_SVC218_HANDLER sb_undef_handler
807+#endif
808+#if !defined(SB_SVC219_HANDLER)
809+#define SB_SVC219_HANDLER sb_undef_handler
810+#endif
811+#if !defined(SB_SVC220_HANDLER)
812+#define SB_SVC220_HANDLER sb_undef_handler
813+#endif
814+#if !defined(SB_SVC221_HANDLER)
815+#define SB_SVC221_HANDLER sb_undef_handler
816+#endif
817+#if !defined(SB_SVC222_HANDLER)
818+#define SB_SVC222_HANDLER sb_undef_handler
819+#endif
820+#if !defined(SB_SVC223_HANDLER)
821+#define SB_SVC223_HANDLER sb_undef_handler
822+#endif
823+#if !defined(SB_SVC224_HANDLER)
824+#define SB_SVC224_HANDLER sb_undef_handler
825+#endif
826+#if !defined(SB_SVC225_HANDLER)
827+#define SB_SVC225_HANDLER sb_undef_handler
828+#endif
829+#if !defined(SB_SVC226_HANDLER)
830+#define SB_SVC226_HANDLER sb_undef_handler
831+#endif
832+#if !defined(SB_SVC227_HANDLER)
833+#define SB_SVC227_HANDLER sb_undef_handler
834+#endif
835+#if !defined(SB_SVC228_HANDLER)
836+#define SB_SVC228_HANDLER sb_undef_handler
837+#endif
838+#if !defined(SB_SVC229_HANDLER)
839+#define SB_SVC229_HANDLER sb_undef_handler
840+#endif
841+#if !defined(SB_SVC230_HANDLER)
842+#define SB_SVC230_HANDLER sb_undef_handler
843+#endif
844+#if !defined(SB_SVC231_HANDLER)
845+#define SB_SVC231_HANDLER sb_undef_handler
846+#endif
847+#if !defined(SB_SVC232_HANDLER)
848+#define SB_SVC232_HANDLER sb_undef_handler
849+#endif
850+#if !defined(SB_SVC233_HANDLER)
851+#define SB_SVC233_HANDLER sb_undef_handler
852+#endif
853+#if !defined(SB_SVC234_HANDLER)
854+#define SB_SVC234_HANDLER sb_undef_handler
855+#endif
856+#if !defined(SB_SVC235_HANDLER)
857+#define SB_SVC235_HANDLER sb_undef_handler
858+#endif
859+#if !defined(SB_SVC236_HANDLER)
860+#define SB_SVC236_HANDLER sb_undef_handler
861+#endif
862+#if !defined(SB_SVC237_HANDLER)
863+#define SB_SVC237_HANDLER sb_undef_handler
864+#endif
865+#if !defined(SB_SVC238_HANDLER)
866+#define SB_SVC238_HANDLER sb_undef_handler
867+#endif
868+#if !defined(SB_SVC239_HANDLER)
869+#define SB_SVC239_HANDLER sb_undef_handler
870+#endif
871+#if !defined(SB_SVC240_HANDLER)
872+#define SB_SVC240_HANDLER sb_undef_handler
873+#endif
874+#if !defined(SB_SVC241_HANDLER)
875+#define SB_SVC241_HANDLER sb_undef_handler
876+#endif
877+#if !defined(SB_SVC242_HANDLER)
878+#define SB_SVC242_HANDLER sb_undef_handler
879+#endif
880+#if !defined(SB_SVC243_HANDLER)
881+#define SB_SVC243_HANDLER sb_undef_handler
882+#endif
883+#if !defined(SB_SVC244_HANDLER)
884+#define SB_SVC244_HANDLER sb_undef_handler
885+#endif
886+#if !defined(SB_SVC245_HANDLER)
887+#define SB_SVC245_HANDLER sb_undef_handler
888+#endif
889+#if !defined(SB_SVC246_HANDLER)
890+#define SB_SVC246_HANDLER sb_undef_handler
891+#endif
892+#if !defined(SB_SVC247_HANDLER)
893+#define SB_SVC247_HANDLER sb_undef_handler
894+#endif
895+#if !defined(SB_SVC248_HANDLER)
896+#define SB_SVC248_HANDLER sb_undef_handler
897+#endif
898+#if !defined(SB_SVC249_HANDLER)
899+#define SB_SVC249_HANDLER sb_undef_handler
900+#endif
901+#if !defined(SB_SVC250_HANDLER)
902+#define SB_SVC250_HANDLER sb_undef_handler
903+#endif
904+#if !defined(SB_SVC251_HANDLER)
905+#define SB_SVC251_HANDLER sb_undef_handler
906+#endif
907+#if !defined(SB_SVC252_HANDLER)
908+#define SB_SVC252_HANDLER sb_undef_handler
909+#endif
910+#if !defined(SB_SVC253_HANDLER)
911+#define SB_SVC253_HANDLER sb_undef_handler
912+#endif
913+#if !defined(SB_SVC254_HANDLER)
914+#define SB_SVC254_HANDLER sb_undef_handler
915+#endif
916+#if !defined(SB_SVC255_HANDLER)
917+#define SB_SVC255_HANDLER sb_undef_handler
918+#endif
919+
920+/*===========================================================================*/
921+/* External declarations. */
922+/*===========================================================================*/
923+
924+#ifdef __cplusplus
925+extern "C" {
926+#endif
927+ void port_syscall(struct port_extctx *ctxp, uint32_t n);
928+ void sbStart(const sb_header_t *sbhp,
929+ const sb_regions_t *rp);
930+#ifdef __cplusplus
931+}
932+#endif
933+
934+/*===========================================================================*/
935+/* Module inline functions. */
936+/*===========================================================================*/
937+
938+#endif /* SBHOST_H */
939+
940+/** @} */
--- trunk/os/sb/user/sbuser.c (nonexistent)
+++ trunk/os/sb/user/sbuser.c (revision 12979)
@@ -0,0 +1,57 @@
1+/*
2+ ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio.
3+
4+ This file is part of ChibiOS.
5+
6+ ChibiOS is free software; you can redistribute it and/or modify
7+ it under the terms of the GNU General Public License as published by
8+ the Free Software Foundation; either version 3 of the License, or
9+ (at your option) any later version.
10+
11+ ChibiOS is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+*/
19+
20+/**
21+ * @file sb/sbuser.c
22+ * @brief ARMv7-M sandbox user API code.
23+ *
24+ * @addtogroup ARMV7M_SANDBOX_API
25+ * @{
26+ */
27+
28+#include <stdint.h>
29+#include <stdbool.h>
30+
31+#include "sbuser.h"
32+
33+/*===========================================================================*/
34+/* Module local definitions. */
35+/*===========================================================================*/
36+
37+/*===========================================================================*/
38+/* Module exported variables. */
39+/*===========================================================================*/
40+
41+/*===========================================================================*/
42+/* Module local types. */
43+/*===========================================================================*/
44+
45+/*===========================================================================*/
46+/* Module local variables. */
47+/*===========================================================================*/
48+
49+/*===========================================================================*/
50+/* Module local functions. */
51+/*===========================================================================*/
52+
53+/*===========================================================================*/
54+/* Module exported functions. */
55+/*===========================================================================*/
56+
57+/** @} */
--- trunk/os/sb/user/sbuser.h (nonexistent)
+++ trunk/os/sb/user/sbuser.h (revision 12979)
@@ -0,0 +1,143 @@
1+/*
2+ ChibiOS - Copyright (C) 2006..2019 Giovanni Di Sirio.
3+
4+ This file is part of ChibiOS.
5+
6+ ChibiOS is free software; you can redistribute it and/or modify
7+ it under the terms of the GNU General Public License as published by
8+ the Free Software Foundation; either version 3 of the License, or
9+ (at your option) any later version.
10+
11+ ChibiOS is distributed in the hope that it will be useful,
12+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ GNU General Public License for more details.
15+
16+ You should have received a copy of the GNU General Public License
17+ along with this program. If not, see <http://www.gnu.org/licenses/>.
18+*/
19+
20+/**
21+ * @file sb/sbapi.h
22+ * @brief ARMv7-M sandbox user API macros and structures.
23+ *
24+ * @addtogroup ARMV7M_SANDBOX_USERAPI
25+ * @{
26+ */
27+
28+#ifndef SBUSER_H
29+#define SBUSER_H
30+
31+/*===========================================================================*/
32+/* Module constants. */
33+/*===========================================================================*/
34+
35+/*===========================================================================*/
36+/* Module pre-compile time settings. */
37+/*===========================================================================*/
38+
39+/*===========================================================================*/
40+/* Derived constants and error checks. */
41+/*===========================================================================*/
42+
43+/*===========================================================================*/
44+/* Module data structures and types. */
45+/*===========================================================================*/
46+
47+/**
48+ * @brief Type of system time counter.
49+ */
50+typedef uint32_t sb_systime_t;
51+
52+/**
53+ * @brief Type of a message.
54+ */
55+typedef uint32_t sb_msg_t;
56+
57+/*===========================================================================*/
58+/* Module macros. */
59+/*===========================================================================*/
60+
61+/**
62+ * @name SVC instruction wrappers.
63+ *
64+ * @{
65+ */
66+#define __syscall0(x) \
67+ asm volatile ("svc " #x : : : "memory")
68+
69+#define __syscall0r(x) \
70+ register uint32_t r0 asm ("r0"); \
71+ asm volatile ("svc " #x : "=r" (r0) : : "memory")
72+
73+#define __syscall1r(x, p1) \
74+ register uint32_t r0 asm ("r0") = (uint32_t)(p1); \
75+ asm volatile ("svc " #x : "=r" (r0) : "r" (r0) : "memory")
76+
77+#define __syscall2r(x, p1, p2) \
78+ register uint32_t r0 asm ("r0") = (uint32_t)(p1); \
79+ register uint32_t r1 asm ("r1") = (uint32_t)(p2); \
80+ asm volatile ("svc " #x : "=r" (r0) : "r" (r0), "r" (r1) : "memory")
81+
82+#define __syscall3r(x, p1, p2, p3) \
83+ register uint32_t r0 asm ("r0") = (uint32_t)(p1); \
84+ register uint32_t r1 asm ("r1") = (uint32_t)(p2); \
85+ register uint32_t r2 asm ("r2") = (uint32_t)(p3); \
86+ asm volatile ("svc " #x : "=r" (r0) : "r" (r0), "r" (r1), \
87+ "r" (r2) : "memory")
88+
89+#define __syscall4r(x, p1, p2, p3, p4) \
90+ register uint32_t r0 asm ("r0") = (uint32_t)(p1); \
91+ register uint32_t r1 asm ("r1") = (uint32_t)(p2); \
92+ register uint32_t r2 asm ("r2") = (uint32_t)(p3); \
93+ register uint32_t r3 asm ("r3") = (uint32_t)(p4); \
94+ asm volatile ("svc " #x : "=r" (r0) : "r" (r0), "r" (r1), \
95+ "r" (r2), "r" (r3) : "memory")
96+/** @} */
97+
98+/*===========================================================================*/
99+/* External declarations. */
100+/*===========================================================================*/
101+
102+#ifdef __cplusplus
103+extern "C" {
104+#endif
105+
106+#ifdef __cplusplus
107+}
108+#endif
109+
110+/*===========================================================================*/
111+/* Module inline functions. */
112+/*===========================================================================*/
113+
114+static inline void sbExit(sb_msg_t msg) {
115+
116+ __syscall1r(1, msg);
117+}
118+
119+static inline sb_systime_t sbGetSystemTime(void) {
120+
121+ __syscall0r(2);
122+ return (sb_systime_t)r0;
123+}
124+
125+static inline uint32_t sbGetFrequency(void) {
126+
127+ __syscall0r(3);
128+ return (uint32_t)r0;
129+}
130+
131+static inline void sbSleepMilliseconds(uint32_t milliseconds) {
132+
133+ __syscall1r(4, milliseconds);
134+}
135+
136+static inline void sbSleepUntil(sb_systime_t start, sb_systime_t end) {
137+
138+ __syscall2r(5, start, end);
139+}
140+
141+#endif /* SBUSER_H */
142+
143+/** @} */
Show on old repository browser