@@ -140,7 +140,7 @@ psm_stack_manipulation! {
140
140
}
141
141
142
142
impl StackRestoreGuard {
143
- #[ cfg( target_arch = "wasm32" ) ]
143
+ #[ cfg( any ( target_arch = "wasm32" , target_os = "hermit" ) ) ]
144
144
unsafe fn new( stack_bytes: usize , _page_size: usize ) -> StackRestoreGuard {
145
145
let layout = std:: alloc:: Layout :: from_size_align( stack_bytes, 16 ) . unwrap( ) ;
146
146
let ptr = std:: alloc:: alloc( layout) ;
@@ -152,7 +152,7 @@ psm_stack_manipulation! {
152
152
}
153
153
}
154
154
155
- #[ cfg( not( target_arch = "wasm32" ) ) ]
155
+ #[ cfg( not( any ( target_arch = "wasm32" , target_os = "hermit" ) ) ) ]
156
156
unsafe fn new( stack_bytes: usize , page_size: usize ) -> StackRestoreGuard {
157
157
let new_stack = libc:: mmap(
158
158
std:: ptr:: null_mut( ) ,
@@ -202,14 +202,14 @@ psm_stack_manipulation! {
202
202
203
203
impl Drop for StackRestoreGuard {
204
204
fn drop( & mut self ) {
205
- #[ cfg( target_arch = "wasm32" ) ]
205
+ #[ cfg( any ( target_arch = "wasm32" , target_os = "hermit" ) ) ]
206
206
unsafe {
207
207
std:: alloc:: dealloc(
208
208
self . new_stack as * mut u8 ,
209
209
std:: alloc:: Layout :: from_size_align_unchecked( self . stack_bytes, 16 ) ,
210
210
) ;
211
211
}
212
- #[ cfg( not( target_arch = "wasm32" ) ) ]
212
+ #[ cfg( not( any ( target_arch = "wasm32" , target_os = "hermit" ) ) ) ]
213
213
unsafe {
214
214
// FIXME: check the error code and decide what to do with it.
215
215
// Perhaps a debug_assertion?
@@ -258,9 +258,9 @@ psm_stack_manipulation! {
258
258
259
259
fn page_size( ) -> usize {
260
260
// FIXME: consider caching the page size.
261
- #[ cfg( not( target_arch = "wasm32" ) ) ]
261
+ #[ cfg( not( any ( target_arch = "wasm32" , target_os = "hermit" ) ) ) ]
262
262
unsafe { libc:: sysconf( libc:: _SC_PAGE_SIZE) as usize }
263
- #[ cfg( target_arch = "wasm32" ) ]
263
+ #[ cfg( any ( target_arch = "wasm32" , target_os = "hermit" ) ) ]
264
264
{ 65536 }
265
265
}
266
266
}
0 commit comments