1 use anyhow::Result;
2 use core::ops::Range;
3 
4 use crate::runtime::vm::stack_switching::VMHostArray;
5 use crate::runtime::vm::{VMContext, VMFuncRef, ValRaw};
6 
7 #[allow(dead_code)]
8 #[derive(Debug, PartialEq, Eq)]
9 pub enum Allocator {
10     Mmap,
11     Custom,
12 }
13 
14 /// Making sure that this has the same size as the non-dummy version, to
15 /// make some tests happy.
16 #[derive(Debug)]
17 #[repr(C)]
18 pub struct VMContinuationStack {
19     _top: *mut u8,
20     _len: usize,
21     _allocator: Allocator,
22 }
23 
24 impl VMContinuationStack {
25     pub fn new(_size: usize) -> Result<Self> {
26         anyhow::bail!("Stack switching disabled or not implemented on this platform")
27     }
28 
29     pub fn unallocated() -> Self {
30         panic!("Stack switching disabled or not implemented on this platform")
31     }
32 
33     pub fn is_unallocated(&self) -> bool {
34         panic!("Stack switching disabled or not implemented on this platform")
35     }
36 
37     #[allow(clippy::missing_safety_doc)]
38     pub unsafe fn from_raw_parts(_base: *mut u8, _guard_size: usize, _len: usize) -> Result<Self> {
39         anyhow::bail!("Stack switching disabled or not implemented on this platform")
40     }
41 
42     pub fn is_from_raw_parts(&self) -> bool {
43         panic!("Stack switching disabled or not implemented on this platform")
44     }
45 
46     pub fn top(&self) -> Option<*mut u8> {
47         panic!("Stack switching disabled or not implemented on this platform")
48     }
49 
50     pub fn range(&self) -> Option<Range<usize>> {
51         panic!("Stack switching disabled or not implemented on this platform")
52     }
53 
54     pub fn control_context_instruction_pointer(&self) -> usize {
55         panic!("Stack switching disabled or not implemented on this platform")
56     }
57 
58     pub fn control_context_frame_pointer(&self) -> usize {
59         panic!("Stack switching disabled or not implemented on this platform")
60     }
61 
62     pub fn control_context_stack_pointer(&self) -> usize {
63         panic!("Stack switching disabled or not implemented on this platform")
64     }
65 
66     pub fn initialize(
67         &self,
68         _func_ref: *const VMFuncRef,
69         _caller_vmctx: *mut VMContext,
70         _args: *mut VMHostArray<ValRaw>,
71         _parameter_count: u32,
72         _return_value_count: u32,
73     ) {
74     }
75 }
76