]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys/solid/abi/mod.rs
Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
[rust.git] / library / std / src / sys / solid / abi / mod.rs
1 use crate::os::raw::c_int;
2
3 mod fs;
4 pub mod sockets;
5 pub use self::fs::*;
6
7 #[inline(always)]
8 pub fn breakpoint_program_exited(tid: usize) {
9     unsafe {
10         match () {
11             // SOLID_BP_PROGRAM_EXITED = 15
12             #[cfg(target_arch = "arm")]
13             () => asm!("bkpt #15", in("r0") tid),
14             #[cfg(target_arch = "aarch64")]
15             () => asm!("hlt #15", in("x0") tid),
16         }
17     }
18 }
19
20 #[inline(always)]
21 pub fn breakpoint_abort() {
22     unsafe {
23         match () {
24             // SOLID_BP_CSABORT = 16
25             #[cfg(target_arch = "arm")]
26             () => asm!("bkpt #16"),
27             #[cfg(target_arch = "aarch64")]
28             () => asm!("hlt #16"),
29         }
30     }
31 }
32
33 // `solid_types.h`
34 pub use super::itron::abi::{ER, ER_ID, E_TMOUT, ID};
35
36 pub const SOLID_ERR_NOTFOUND: ER = -1000;
37 pub const SOLID_ERR_NOTSUPPORTED: ER = -1001;
38 pub const SOLID_ERR_EBADF: ER = -1002;
39 pub const SOLID_ERR_INVALIDCONTENT: ER = -1003;
40 pub const SOLID_ERR_NOTUSED: ER = -1004;
41 pub const SOLID_ERR_ALREADYUSED: ER = -1005;
42 pub const SOLID_ERR_OUTOFBOUND: ER = -1006;
43 pub const SOLID_ERR_BADSEQUENCE: ER = -1007;
44 pub const SOLID_ERR_UNKNOWNDEVICE: ER = -1008;
45 pub const SOLID_ERR_BUSY: ER = -1009;
46 pub const SOLID_ERR_TIMEOUT: ER = -1010;
47 pub const SOLID_ERR_INVALIDACCESS: ER = -1011;
48 pub const SOLID_ERR_NOTREADY: ER = -1012;
49
50 // `solid_rtc.h`
51 #[repr(C)]
52 #[derive(Debug, Copy, Clone)]
53 pub struct SOLID_RTC_TIME {
54     pub tm_sec: c_int,
55     pub tm_min: c_int,
56     pub tm_hour: c_int,
57     pub tm_mday: c_int,
58     pub tm_mon: c_int,
59     pub tm_year: c_int,
60     pub tm_wday: c_int,
61 }
62
63 extern "C" {
64     pub fn SOLID_RTC_ReadTime(time: *mut SOLID_RTC_TIME) -> c_int;
65 }
66
67 // `solid_log.h`
68 extern "C" {
69     pub fn SOLID_LOG_write(s: *const u8, l: usize);
70 }
71
72 // `solid_mem.h`
73 extern "C" {
74     pub fn SOLID_TLS_AddDestructor(id: i32, dtor: unsafe extern "C" fn(*mut u8));
75 }
76
77 // `solid_rng.h`
78 extern "C" {
79     pub fn SOLID_RNG_SampleRandomBytes(buffer: *mut u8, length: usize) -> c_int;
80 }
81
82 // `rwlock.h`
83 extern "C" {
84     pub fn rwl_loc_rdl(id: ID) -> ER;
85     pub fn rwl_loc_wrl(id: ID) -> ER;
86     pub fn rwl_ploc_rdl(id: ID) -> ER;
87     pub fn rwl_ploc_wrl(id: ID) -> ER;
88     pub fn rwl_unl_rwl(id: ID) -> ER;
89     pub fn rwl_acre_rwl() -> ER_ID;
90     pub fn rwl_del_rwl(id: ID) -> ER;
91 }