virtual-machine 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,14 +206,14 @@ if (!("encodeInto" in cachedTextEncoder)) {
206
206
  };
207
207
  }
208
208
  var WASM_VECTOR_LEN = 0;
209
+ function wasm_bindgen__convert__closures_____invoke__hd05ca86c0645d8c5(arg0, arg1) {
210
+ wasm.wasm_bindgen__convert__closures_____invoke__hd05ca86c0645d8c5(arg0, arg1);
211
+ }
209
212
  function wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919(arg0, arg1, arg2) {
210
213
  wasm.wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919(arg0, arg1, arg2);
211
214
  }
212
- function wasm_bindgen__convert__closures_____invoke__he79f784db500caf3(arg0, arg1) {
213
- wasm.wasm_bindgen__convert__closures_____invoke__he79f784db500caf3(arg0, arg1);
214
- }
215
- function wasm_bindgen__convert__closures_____invoke__h0a797a416de56032(arg0, arg1) {
216
- wasm.wasm_bindgen__convert__closures_____invoke__h0a797a416de56032(arg0, arg1);
215
+ function wasm_bindgen__convert__closures_____invoke__h547d729665743d2e(arg0, arg1) {
216
+ wasm.wasm_bindgen__convert__closures_____invoke__h547d729665743d2e(arg0, arg1);
217
217
  }
218
218
  var WasmVmFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
219
219
  }, unregister: () => {
@@ -303,9 +303,12 @@ var WasmVm = class {
303
303
  }
304
304
  /**
305
305
  * Execute a single instruction.
306
+ * Returns true if the VM is still running, false if halted.
307
+ * @returns {boolean}
306
308
  */
307
309
  step() {
308
- wasm.wasmvm_step(this.__wbg_ptr);
310
+ const ret = wasm.wasmvm_step(this.__wbg_ptr);
311
+ return ret !== 0;
309
312
  }
310
313
  /**
311
314
  * Push an input byte to the UART.
@@ -314,6 +317,23 @@ var WasmVm = class {
314
317
  input(byte) {
315
318
  wasm.wasmvm_input(this.__wbg_ptr, byte);
316
319
  }
320
+ /**
321
+ * Get the halt code if the VM has halted.
322
+ * Code 0x5555 typically means successful shutdown (PASS).
323
+ * @returns {bigint}
324
+ */
325
+ halt_code() {
326
+ const ret = wasm.wasmvm_halt_code(this.__wbg_ptr);
327
+ return BigInt.asUintN(64, ret);
328
+ }
329
+ /**
330
+ * Check if the VM has halted (e.g., due to shutdown command).
331
+ * @returns {boolean}
332
+ */
333
+ is_halted() {
334
+ const ret = wasm.wasmvm_is_halted(this.__wbg_ptr);
335
+ return ret !== 0;
336
+ }
317
337
  /**
318
338
  * Load a disk image and attach it as a VirtIO block device.
319
339
  * This should be called before starting execution if the kernel needs a filesystem.
@@ -558,10 +578,6 @@ function __wbg_get_imports() {
558
578
  const ret = arg0.write(arg1);
559
579
  return ret;
560
580
  };
561
- imports.wbg.__wbindgen_cast_1874f711bea6a2a5 = function(arg0, arg1) {
562
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1ffb72edd765103d, wasm_bindgen__convert__closures_____invoke__h0a797a416de56032);
563
- return ret;
564
- };
565
581
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
566
582
  const ret = getStringFromWasm0(arg0, arg1);
567
583
  return ret;
@@ -570,8 +586,12 @@ function __wbg_get_imports() {
570
586
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hb099e2ae98169675, wasm_bindgen__convert__closures_____invoke__h6709295d3f31b919);
571
587
  return ret;
572
588
  };
573
- imports.wbg.__wbindgen_cast_c47184c56ac918cb = function(arg0, arg1) {
574
- const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h1ffb72edd765103d, wasm_bindgen__convert__closures_____invoke__he79f784db500caf3);
589
+ imports.wbg.__wbindgen_cast_3dba8e634cba348f = function(arg0, arg1) {
590
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h7f6c7bd142c99517, wasm_bindgen__convert__closures_____invoke__hd05ca86c0645d8c5);
591
+ return ret;
592
+ };
593
+ imports.wbg.__wbindgen_cast_8184f83d0f362634 = function(arg0, arg1) {
594
+ const ret = makeClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h7f6c7bd142c99517, wasm_bindgen__convert__closures_____invoke__h547d729665743d2e);
575
595
  return ret;
576
596
  };
577
597
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {