Squashed some bugs; implemented first iteration of kernel items
This commit is contained in:
parent
a2311366f2
commit
04ee0a1cb2
13 changed files with 245 additions and 111 deletions
6
user/Cargo.toml
Normal file
6
user/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "user"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
6
user/src/arch/mod.rs
Normal file
6
user/src/arch/mod.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
//! Architecture-specific stuff, mainly syscall methods.
|
||||
|
||||
#[macro_use]
|
||||
mod x86;
|
||||
|
||||
pub use x86::*;
|
62
user/src/arch/x86/mod.rs
Normal file
62
user/src/arch/x86/mod.rs
Normal file
|
@ -0,0 +1,62 @@
|
|||
//! x86 syscall method.
|
||||
|
||||
/// Syscall method.
|
||||
#[macro_export]
|
||||
macro_rules! syscall {
|
||||
($id: expr) => {
|
||||
unsafe {
|
||||
let out = 0u32;
|
||||
asm!(
|
||||
"int 0xA0",
|
||||
id = in("eax") const $id,
|
||||
out("eax") out
|
||||
)
|
||||
out
|
||||
}
|
||||
};
|
||||
($id: expr, $d0: expr) => {
|
||||
unsafe {
|
||||
let out = 0u32;
|
||||
let d0 = $d0;
|
||||
asm!(
|
||||
"int 0xA0",
|
||||
id = in("eax") const $id,
|
||||
d0 = in("ebx") $d0,
|
||||
out("eax") out
|
||||
)
|
||||
out
|
||||
}
|
||||
};
|
||||
($id: expr, $d0: expr, $d1: expr) => {
|
||||
unsafe {
|
||||
let out = 0u32;
|
||||
let d0 = $d0;
|
||||
let d1 = $d1;
|
||||
asm!(
|
||||
"int 0xA0",
|
||||
id = in("eax") const $id,
|
||||
d0 = in("ebx") $d0,
|
||||
d1 = in("ecx") $d1,
|
||||
out("eax") out
|
||||
)
|
||||
out
|
||||
}
|
||||
};
|
||||
($id: expr, $d0: expr, $d1: expr, $d2: expr) => {
|
||||
unsafe {
|
||||
let out = 0u32;
|
||||
let d0 = $d0;
|
||||
let d1 = $d1;
|
||||
let d2 = $d2;
|
||||
asm!(
|
||||
"int 0xA0",
|
||||
id = in("eax") const $id,
|
||||
d0 = in("ebx") $d0,
|
||||
d1 = in("ecx") $d1,
|
||||
d2 = in("edx") $d2,
|
||||
out("eax") out
|
||||
)
|
||||
out
|
||||
}
|
||||
}
|
||||
}
|
5
user/src/lib.rs
Normal file
5
user/src/lib.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#[warn(missing_docs)]
|
||||
|
||||
mod arch;
|
||||
|
||||
use arch::*;
|
Loading…
Add table
Add a link
Reference in a new issue