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