File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ Add the special ISA debug exit device by passing the flags:
58
58
-device isa-debug-exit,iobase=0xf4,iosize=0x04
59
59
```
60
60
61
- When instantiating the handle, ` iobase ` must be given as the first parameter.
61
+ When instantiating the handle with ` qemu_exit::X86::new() ` , ` iobase ` must be given as the first
62
+ parameter.
62
63
63
64
The second parameter must be an ` EXIT_SUCCESS ` code of your choice that is an odd number, aka
64
65
bit number zero must be ` 1 ` . This is needed because in QEMU, the provided code is internally
@@ -69,6 +70,18 @@ possible to let QEMU invoke `exit(0)`.
69
70
let qemu_exit_handle = qemu_exit :: X86 :: new (io_base , custom_exit_success );
70
71
```
71
72
73
+ #### x86/x86_64 Linux
74
+
75
+ To use this mechanism from Linux userspace, the kernel must be compiled with
76
+ ` CONFIG_X86_IOPL_IOPERM=y ` (which is the default) and the process must start with root privileges
77
+ (or ` CAP_SYS_RAWIO ` ) and call: [ ` ioperm(2) ` ] ( https://man7.org/linux/man-pages/man2/ioperm.2.html ) :
78
+ ``` rust
79
+ nix :: errno :: Errno :: result (unsafe { libc :: ioperm ( 0xf4 , 4 , 1 )}). expect (" ioperm failed" );
80
+ ```
81
+
82
+ Privileges/capabilities can then be dropped. Normal users can subsequently call
83
+ ` qemu_exit_handle.exit*() ` .
84
+
72
85
## Literature
73
86
74
87
- [ Semihosting for AArch32 and AArch64] ( https://github.com/ARM-software/abi-aa/blob/main/semihosting/semihosting.rst )
You can’t perform that action at this time.
0 commit comments