@@ -76,129 +76,6 @@ macro_rules! dbg {
7676 } ;
7777}
7878
79- cfg_if:: cfg_if! {
80- if #[ cfg( not( any(
81- target_arch = "riscv64" ,
82- feature = "common-os"
83- ) ) ) ] {
84- /// Runs `f` on the kernel stack.
85- ///
86- /// All arguments and return values have to fit into registers:
87- ///
88- /// ```
89- /// assert!(mem::size_of::<T>() <= mem::size_of::<usize>());
90- /// ```
91- ///
92- /// When working with bigger types, manually route the data over pointers:
93- ///
94- /// ```
95- /// f(&arg1, &mut ret);
96- /// // instead of
97- /// let ret = f(arg);
98- /// ```
99- #[ allow( unused_macro_rules) ]
100- macro_rules! kernel_function {
101- ( $f: ident( ) ) => { {
102- // This propagates any unsafety requirements of `f` to the caller.
103- if false {
104- $f( ) ;
105- }
106-
107- #[ allow( unreachable_code) ]
108- #[ allow( unused_unsafe) ]
109- unsafe {
110- $crate :: arch:: switch:: kernel_function0( $f)
111- }
112- } } ;
113-
114- ( $f: ident( $arg1: expr) ) => { {
115- // This propagates any unsafety requirements of `f` to the caller.
116- if false {
117- $f( $arg1) ;
118- }
119-
120- #[ allow( unreachable_code) ]
121- #[ allow( unused_unsafe) ]
122- unsafe {
123- $crate :: arch:: switch:: kernel_function1( $f, $arg1)
124- }
125- } } ;
126-
127- ( $f: ident( $arg1: expr, $arg2: expr) ) => { {
128- // This propagates any unsafety requirements of `f` to the caller.
129- if false {
130- $f( $arg1, $arg2) ;
131- }
132-
133- #[ allow( unreachable_code) ]
134- #[ allow( unused_unsafe) ]
135- unsafe {
136- $crate :: arch:: switch:: kernel_function2( $f, $arg1, $arg2)
137- }
138- } } ;
139-
140- ( $f: ident( $arg1: expr, $arg2: expr, $arg3: expr) ) => { {
141- // This propagates any unsafety requirements of `f` to the caller.
142- if false {
143- $f( $arg1, $arg2, $arg3) ;
144- }
145-
146- #[ allow( unreachable_code) ]
147- #[ allow( unused_unsafe) ]
148- unsafe {
149- $crate :: arch:: switch:: kernel_function3( $f, $arg1, $arg2, $arg3)
150- }
151- } } ;
152-
153- ( $f: ident( $arg1: expr, $arg2: expr, $arg3: expr, $arg4: expr) ) => { {
154- // This propagates any unsafety requirements of `f` to the caller.
155- if false {
156- $f( $arg1, $arg2, $arg3, $arg4) ;
157- }
158-
159- #[ allow( unreachable_code) ]
160- #[ allow( unused_unsafe) ]
161- unsafe {
162- $crate :: arch:: switch:: kernel_function4( $f, $arg1, $arg2, $arg3, $arg4)
163- }
164- } } ;
165-
166- ( $f: ident( $arg1: expr, $arg2: expr, $arg3: expr, $arg4: expr, $arg5: expr) ) => { {
167- // This propagates any unsafety requirements of `f` to the caller.
168- if false {
169- $f( $arg1, $arg2, $arg3, $arg4, $arg5) ;
170- }
171-
172- #[ allow( unreachable_code) ]
173- #[ allow( unused_unsafe) ]
174- unsafe {
175- $crate :: arch:: switch:: kernel_function5( $f, $arg1, $arg2, $arg3, $arg4, $arg5)
176- }
177- } } ;
178-
179- ( $f: ident( $arg1: expr, $arg2: expr, $arg3: expr, $arg4: expr, $arg5: expr, $arg6: expr) ) => { {
180- // This propagates any unsafety requirements of `f` to the caller.
181- if false {
182- $f( $arg1, $arg2, $arg3, $arg4, $arg5, $arg6) ;
183- }
184-
185- #[ allow( unreachable_code) ]
186- #[ allow( unused_unsafe) ]
187- unsafe {
188- $crate :: arch:: switch:: kernel_function6( $f, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6)
189- }
190- } } ;
191- }
192- } else {
193- // TODO: Switch kernel stack on RISC-V
194- macro_rules! kernel_function {
195- ( $f: ident( $( $x: tt) * ) ) => { {
196- $f( $( $x) * )
197- } } ;
198- }
199- }
200- }
201-
20279/// Returns the value of the specified environment variable.
20380///
20481/// The value is fetched from the current runtime environment and, if not
0 commit comments