This commit is contained in:
NGnius (Graham) 2024-01-10 20:24:29 -05:00
parent 93ef2b931b
commit 23209f13e0
3 changed files with 7 additions and 3 deletions

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
/target
**/target
/Cargo.lock

View file

@ -1,3 +1,4 @@
workspace = { members = ["ecplorer"] }
[package]
name = "smokepatio"
version = "0.1.0"

View file

@ -1,8 +1,10 @@
// x86 and x86_64
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
pub(crate) fn outb(port: u16, val: u8) {
//let val: i16 = val.into();
unsafe {
std::arch::asm!("outb", in("dx") port, in("al") val);
std::arch::asm!("out dx, al", in("dx") port, in("al") val);
//std::arch::asm!("outb %al, %dx", in("al") val, in("dx") port, options(att_syntax));
}
}
@ -10,7 +12,8 @@ pub(crate) fn outb(port: u16, val: u8) {
pub(crate) fn inb(port: u16) -> u8 {
let out: u8;
unsafe {
std::arch::asm!("inb", in("dx") port, lateout("al") out);
std::arch::asm!("in al, dx", in("dx") port, lateout("al") out);
// asm!("inb %dx, %al", in("dx") port, out("al") ret, options(att_syntax));
}
out
}