mirror of
https://github.com/mbilker/vgpu_unlock-rs.git
synced 2025-06-08 13:28:23 +02:00
Add UUID and start call decoding
This commit is contained in:
parent
28a699a184
commit
2a9a81290b
48
src/lib.rs
48
src/lib.rs
@ -30,6 +30,9 @@ use crate::log::{error, info};
|
||||
/// ioctl to read the PCI device ID and type (and possibly other things) from the GPU.
|
||||
const REQ_QUERY_GPU: c_ulong = 0xc020462a;
|
||||
|
||||
/// `result` is a pointer to `VgpuStart`.
|
||||
const OP_READ_START_CALL: u32 = 0xc01;
|
||||
|
||||
/// `result` is a pointer to `uint32_t`.
|
||||
const OP_READ_DEV_TYPE: u32 = 0x800289;
|
||||
|
||||
@ -72,6 +75,37 @@ struct Request {
|
||||
status: u32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[repr(C)]
|
||||
struct Uuid(u32, u16, u16, [u8; 8]);
|
||||
|
||||
impl fmt::Display for Uuid {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{:08x}-{:04x}-{:04x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}",
|
||||
self.0,
|
||||
self.1,
|
||||
self.2,
|
||||
self.3[0],
|
||||
self.3[1],
|
||||
self.3[2],
|
||||
self.3[3],
|
||||
self.3[4],
|
||||
self.3[5],
|
||||
self.3[6],
|
||||
self.3[7]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct VgpuStart {
|
||||
uuid: Uuid,
|
||||
config_params: [u8; 1024],
|
||||
unknown_410: [u8; 16],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
struct VgpuConfig {
|
||||
gpu_type: u32,
|
||||
@ -127,6 +161,16 @@ struct VgpuProfileOverride<'a> {
|
||||
license_type: Option<&'a str>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for VgpuStart {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("VgpuStart")
|
||||
.field("uuid", &format_args!("{{{}}}", self.uuid))
|
||||
.field("config_params", &CStrFormat(&self.config_params))
|
||||
.field("unknown_410", &StraightFormat(&self.unknown_410))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for VgpuConfig {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
f.debug_struct("VgpuConfig")
|
||||
@ -262,6 +306,10 @@ pub unsafe extern "C" fn ioctl(fd: RawFd, request: c_ulong, argp: *mut c_void) -
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
OP_READ_START_CALL => {
|
||||
let config = &*(io_data.result as *const VgpuStart);
|
||||
info!("{:#?}", config);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user