ft(interpreter): expand interrupt functionality

Implement mess2 type, as well as return m_type for existing
and new interrupts.

TODO:
save pointer to message data, as the current write is redundant.
This commit is contained in:
2025-07-02 17:14:05 +09:00
parent 5a81bbf43a
commit 4f161f47f6
2 changed files with 81 additions and 5 deletions

View File

@@ -3,7 +3,6 @@ use core::fmt;
use crate::operands::Word;
// TODO:
// typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;
// typedef struct {int m3i1, m3i2; char *m3p1; char m3ca1[M3_STRING];} mess_3;
// typedef struct {long m4l1, m4l2, m4l3, m4l4, m4l5;} mess_4;
// typedef struct {char m5c1, m5c2; int m5i1, m5i2; long m5l1, m5l2, m5l3;}mess_5;
@@ -22,7 +21,6 @@ pub struct Mess1 {
impl Mess1 {
pub fn new(data: &Vec<u8>) -> Self {
log::debug!("Mess1 from data {data:?}");
Self {
i1: Word::from_le_bytes([data[4], data[5]]),
i2: Word::from_le_bytes([data[6], data[7]]),
@@ -43,6 +41,41 @@ impl fmt::Display for Mess1 {
)
}
}
#[derive(Debug, Clone)]
// typedef struct {int m2i1, m2i2, m2i3; long m2l1, m2l2; char *m2p1;} mess_2;
pub struct Mess2 {
pub i1: Word,
pub i2: Word,
pub i3: Word,
pub l1: Word,
pub l2: Word,
pub p1: Word,
}
impl Mess2 {
pub fn new(data: &Vec<u8>) -> Self {
Self {
i1: Word::from_le_bytes([data[4], data[5]]),
i2: Word::from_le_bytes([data[6], data[7]]),
i3: Word::from_le_bytes([data[8], data[9]]),
l1: Word::from_le_bytes([data[10], data[11]]),
l2: Word::from_le_bytes([data[12], data[13]]),
p1: Word::from_le_bytes([data[14], data[15]]),
}
}
}
impl fmt::Display for Mess2 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
"Mess1({} {} {} {} {} {})",
self.i1, self.i2, self.i3, self.l1, self.l2, self.p1
)
}
}
#[derive(Debug, Clone)]
/// First part of: include/minix/type.h:struct message
/// The union-type will be handled differently, where I the data of each