Setup has 3 steps 1. load the AOT-compiled Wasm module via DlOpen 2. MMap and mprotect the linear memory 3. Setup signals (maybe?) It then returns a wave_runtime object with all these things set up
(config: &WaveConfig)
| 30 | // 3. Setup signals (maybe?) |
| 31 | // It then returns a wave_runtime object with all these things set up |
| 32 | fn setup(config: &WaveConfig) -> WaveSandbox { |
| 33 | // 1. Load AOT-compiled Wasm module |
| 34 | let module: Container<Wasm2cBinary> = unsafe { |
| 35 | Container::load(config.module_path.as_str()) // wrapper around dlopen |
| 36 | } |
| 37 | .unwrap(); |
| 38 | |
| 39 | // 2. MMap and mprotect the linear memory |
| 40 | let linmem = wave_alloc_linmem() as *mut u8; |
| 41 | |
| 42 | // 3. Setup signals |
| 43 | wave_setup_signals(); |
| 44 | |
| 45 | let vmctx = create_ctx( |
| 46 | linmem, |
| 47 | &config.homedir, |
| 48 | config.args.clone(), |
| 49 | config.argc, |
| 50 | config.env.clone(), |
| 51 | config.envc, |
| 52 | config.netlist, |
| 53 | ); |
| 54 | |
| 55 | WaveSandbox { |
| 56 | module, |
| 57 | vmctx, |
| 58 | linmem, |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // The execute stage simply consists of calling the __start function |
| 63 | // returns the result code of executing the sandbox |
no test coverage detected