| 1 | /// Register used to control or query hardware debug operations and state. |
| 2 | /// |
| 3 | /// Accessing debug registers directly is a privileged operation, but a tracee's debug |
| 4 | /// registers are accessible via the `PEEKUSER` and `POKEUSER` requests. The relevant |
| 5 | /// subset of possible `USER` requests are available via `Tracee::debug_register()` and |
| 6 | /// `Tracee::set_debug_register()`. |
| 7 | /// |
| 8 | /// See: Intel SDM, Vol. 3, 17.2 |
| 9 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 10 | pub enum DebugRegisterrust-analyzer cargo pete 0.13.0 x86/DebugRegister# { |
| 11 | /// Debug address register 0. |
| 12 | Dr0rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr0# = 0, |
| 13 | |
| 14 | /// Debug address register 1. |
| 15 | Dr1rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr1#, |
| 16 | |
| 17 | /// Debug address register 2. |
| 18 | Dr2rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr2#, |
| 19 | |
| 20 | /// Debug address register 3. |
| 21 | Dr3rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr3#, |
| 22 | |
| 23 | /// Reserved. Ignored when used via `ptrace(2)`. |
| 24 | Dr4rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr4#, |
| 25 | |
| 26 | /// Reserved. Ignored when used via `ptrace(2)`. |
| 27 | Dr5rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr5#, |
| 28 | |
| 29 | /// Debug status register. |
| 30 | Dr6rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr6#, |
| 31 | |
| 32 | /// Debug control register. |
| 33 | Dr7rust-analyzer cargo pete 0.13.0 x86/DebugRegister#Dr7#, |
| 34 | } |
| 35 | |
| 36 | impl DebugRegisterrust-analyzer cargo pete 0.13.0 x86/DebugRegister# { |
| 37 | /// Return the offset into debug register array in the virtual `user` struct. |
| 38 | pub(craterust-analyzer cargo pete 0.13.0 crate/) fn user_offsetrust-analyzer cargo pete 0.13.0 x86/impl#[DebugRegister]user_offset().() -> u64 { |
| 39 | memoffsetrust-analyzer cargo memoffset 0.9.1 crate/::offset_ofrust-analyzer cargo memoffset 0.9.1 offset_of/offset_of!!(libcrust-analyzer cargo libc 0.2.176 crate/::userrust-analyzer cargo libc 0.2.176 unix/linux_like/linux/gnu/b64/x86_64/user#, u_debugregrust-analyzer cargo libc 0.2.176 unix/linux_like/linux/gnu/b64/x86_64/user#u_debugreg.) as u64 |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<DebugRegisterrust-analyzer cargo pete 0.13.0 x86/DebugRegister#> for u64 { |
| 44 | fn fromrust-analyzer cargo pete 0.13.0 x86/impl#[u64][`From<DebugRegister>`]from().(dr: DebugRegisterrust-analyzer cargo pete 0.13.0 x86/DebugRegister#) -> u64 { |
| 45 | dr as u64 |
| 46 | } |
| 47 | } |