I have a structure and method like so
#[derive(Clone, Copy)]
pub struct TrapFrame{
pub regs : [usize;32]
}
impl TrapFrame {
pub const fn new() -> self {
TrapFrame{
regs: [0;32]
}
}
}
I want a new instance of the structure, then set the memory address to a register
let user_frame = TrapFrame::new();
let user_frame_ptr = &user_frame as *const();
mscratch::write(user_frame_ptr as usize);
This gives the following error
casting &TrapFrame as *const() is invalid
What's my problem?