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:
5858-device isa-debug-exit,iobase=0xf4,iosize=0x04
5959```
6060
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.
6263
6364The second parameter must be an ` EXIT_SUCCESS ` code of your choice that is an odd number, aka
6465bit 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)`.
6970let qemu_exit_handle = qemu_exit :: X86 :: new (io_base , custom_exit_success );
7071```
7172
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+
7285## Literature
7386
7487- [ 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