it compiles
This commit is contained in:
parent
698a859b7c
commit
c2df8effbe
3 changed files with 41 additions and 1 deletions
|
|
@ -54,7 +54,7 @@ $(iso): $(kernel) $(grub.cfg) Makefile
|
|||
|
||||
run: $(iso) Makefile
|
||||
@tmux info >&- || { echo -e "\033[38;5;16m ~~ NOT IN A VALID TMUX SESSION ~~\033[0m" ; exit 1; }
|
||||
tmux new-window 'tmux split-window -h "$(MONITOR)"; tmux split-window -fv "$(GDB)"; tmux select-pane -t 1; tmux resize-pane -x 80 -y 25; $(KERNEL_RUN)'
|
||||
@tmux new-window 'tmux split-window -h "$(MONITOR)"; tmux split-window -fv "$(GDB)"; tmux select-pane -t 1; tmux resize-pane -x 80 -y 25; $(KERNEL_RUN)'
|
||||
@# @$(QEMU) -curses -cdrom $(iso)
|
||||
|
||||
clean:
|
||||
|
|
|
|||
39
kernel-rs/src/cpuio.rs
Normal file
39
kernel-rs/src/cpuio.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
//! Rust wrappers around the x86-family I/O instructions.
|
||||
|
||||
/// Read a `u8`-sized value from `port`.
|
||||
pub unsafe fn inb(port: u16) -> u8 {
|
||||
// The registers for the `in` and `out` instructions are always the
|
||||
// same: `a` for value, and `d` for the port address.
|
||||
let result: u8;
|
||||
asm!("inb %dx, %al" : "={al}"(result) : "{dx}"(port) :: "volatile");
|
||||
result
|
||||
}
|
||||
|
||||
/// Write a `u8`-sized `value` to `port`.
|
||||
pub unsafe fn outb(value: u8, port: u16) {
|
||||
asm!("outb %al, %dx" :: "{dx}"(port), "{al}"(value) :: "volatile");
|
||||
}
|
||||
|
||||
/// Read a `u16`-sized value from `port`.
|
||||
pub unsafe fn inw(port: u16) -> u16 {
|
||||
let result: u16;
|
||||
asm!("inw %dx, %ax" : "={ax}"(result) : "{dx}"(port) :: "volatile");
|
||||
result
|
||||
}
|
||||
|
||||
/// Write a `u8`-sized `value` to `port`.
|
||||
pub unsafe fn outw(value: u16, port: u16) {
|
||||
asm!("outw %ax, %dx" :: "{dx}"(port), "{ax}"(value) :: "volatile");
|
||||
}
|
||||
|
||||
/// Read a `u32`-sized value from `port`.
|
||||
pub unsafe fn inl(port: u16) -> u32 {
|
||||
let result: u32;
|
||||
asm!("inl %dx, %eax" : "={eax}"(result) : "{dx}"(port) :: "volatile");
|
||||
result
|
||||
}
|
||||
|
||||
/// Write a `u32`-sized `value` to `port`.
|
||||
pub unsafe fn outl(value: u32, port: u16) {
|
||||
asm!("outl %eax, %dx" :: "{dx}"(port), "{eax}"(value) :: "volatile");
|
||||
}
|
||||
1
kernel-rs/src/keyboard.rs
Normal file
1
kernel-rs/src/keyboard.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
pub static KEY_CODE_TO_ASCII: [u8; 59] = *b"??1234567890-=??qwertyuiop[]\n?asdfghjkl;'`?\\zxcvbnm,./?*? ?";
|
||||
Loading…
Reference in a new issue