diff options
author | 2016-07-04 14:08:17 +0200 | |
---|---|---|
committer | 2016-07-04 14:08:17 +0200 | |
commit | c12e050a69dd1a9b04f07ab78a166c6371d35a6f (patch) | |
tree | fea35bcf5b507efdd4c1c0f5dab146360c70478a /src/io.rs | |
parent | 32257991aaa3700620f1d6c180cfec3e2d65a360 (diff) | |
parent | bd2950de1a48d72cbb718cc9a367142e0eb97b72 (diff) | |
download | rust-x86-c12e050a69dd1a9b04f07ab78a166c6371d35a6f.tar.gz rust-x86-c12e050a69dd1a9b04f07ab78a166c6371d35a6f.tar.zst rust-x86-c12e050a69dd1a9b04f07ab78a166c6371d35a6f.zip |
Merge pull request #16 from QuiltOS/master
Fix #15: Combine with https://github.com/Tobba/libcpu
Diffstat (limited to 'src/io.rs')
-rw-r--r-- | src/io.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/io.rs b/src/io.rs deleted file mode 100644 index bb7cfb0..0000000 --- a/src/io.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! I/O port functionality. - -/// Write 8 bits to port -pub unsafe fn outb(port: u16, val: u8) { - asm!("outb %al, %dx" :: "{dx}"(port), "{al}"(val)); -} - -/// Read 8 bits from port -pub unsafe fn inb(port: u16) -> u8 { - let ret: u8; - asm!("inb %dx, %al" : "={ax}"(ret) : "{dx}"(port) :: "volatile"); - return ret; -} - -/// Write 16 bits to port -pub unsafe fn outw(port: u16, val: u16) { - asm!("outw %ax, %dx" :: "{dx}"(port), "{al}"(val)); -} - -/// Read 16 bits from port -pub unsafe fn inw(port: u16) -> u16 { - let ret: u16; - asm!("inw %dx, %ax" : "={ax}"(ret) : "{dx}"(port) :: "volatile"); - return ret; -} - -/// Write 32 bits to port -pub unsafe fn outl(port: u16, val: u32) { - asm!("outl %eax, %dx" :: "{dx}"(port), "{al}"(val)); -} - -/// Read 32 bits from port -pub unsafe fn inl(port: u16) -> u32 { - let ret: u32; - asm!("inl %dx, %eax" : "={ax}"(ret) : "{dx}"(port) :: "volatile"); - return ret; -} |