1 /* 2 * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /** 14 * @brief Perform semihosting call 15 * 16 * See ARM semihosting spec for details. 17 * https://static.docs.arm.com/100863/0200/semihosting.pdf 18 * 19 * @param id semihosting call number 20 * @param data data block to pass to the host; number of items and their 21 * meaning depends on the semihosting call. See the spec for 22 * details. 23 * 24 * @return return value from the host 25 */ semihosting_call_noerrno(long id,long * data)26static inline long semihosting_call_noerrno(long id, long *data) 27 { 28 register long a2 asm ("a2") = id; 29 register long a3 asm ("a3") = (long)data; 30 31 __asm__ __volatile__ ( 32 "break 1, 14\n" 33 : "+r"(a2) : "r"(a3) 34 : "memory"); 35 return a2; 36 } 37 38 #ifdef __cplusplus 39 } 40 #endif 41