summaryrefslogtreecommitdiff
path: root/src/qemu
diff options
context:
space:
mode:
Diffstat (limited to 'src/qemu')
-rw-r--r--src/qemu/mod.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/qemu/mod.rs b/src/qemu/mod.rs
new file mode 100644
index 0000000..4c1ab37
--- /dev/null
+++ b/src/qemu/mod.rs
@@ -0,0 +1,31 @@
+//! # QEMU Crate
+//!
+//! Provide QEMU bindings
+
+/// # QEMU Exit Codes
+///
+/// Provides QEMU exit codes
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+#[repr(u32)]
+pub enum QemuExitCode {
+ /// # Success
+ ///
+ /// Exit QEMU successfully
+ Success = 0x10,
+ /// # Failure
+ ///
+ /// Exit QEMU with error
+ Failed = 0x11,
+}
+
+/// # Exit QEMU
+///
+/// Exit QEMU with an exit code
+pub fn exit_qemu(exit_code: QemuExitCode) {
+ use x86_64::instructions::port::Port;
+
+ unsafe {
+ let mut port = Port::new(0xf4);
+ port.write(exit_code as u32);
+ }
+}