#![allow(missing_docs)]

use abi_serde::impl_struct_serde;

use super::FrameOps;

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, Default)]
#[repr(C)]
pub struct SavedFrame {
    // General-purpose
    pub ra: usize,
    pub gp: usize,
    pub tn: [usize; 7],
    pub sn: [usize; 12],
    pub an: [usize; 8],
    // Special
    pub sp: usize,
    pub ip: usize,
    pub tp: usize,
}

impl FrameOps for SavedFrame {
    fn set_user_ip(&mut self, value: usize) {
        let _ = value;
        todo!()
    }

    fn user_ip(&self) -> usize {
        todo!()
    }
}

impl_struct_serde!(SavedFrame: [
    ra,
    gp,
    tn,
    sn,
    an,
    sp,
    ip,
    tp,
]);
