More moving things around and deleting obsolete code

This commit is contained in:
greg
2015-11-23 22:49:33 -08:00
parent 49c49cb349
commit cf9c7085c6
2 changed files with 25 additions and 35 deletions

View File

@@ -8,16 +8,36 @@ extern crate std;
extern crate rlibc;
extern {
fn asm_printchar() -> u32;
fn call_interrupt();
}
/* externs */
#[no_mangle]
pub extern fn rust_setup_PIC() {
PIC::setup_PIC();
}
#[no_mangle]
pub extern fn rust_handle_keyboard(x: u8) {
checkerboard(vga_buffer::Color::Green);
vga_buffer::print_u32(x as u32, 0);
}
#[no_mangle]
pub extern fn rust_interrupt_handler() {
checkerboard(vga_buffer::Color::White);
}
static mut global_timer_count: u64 = 0;
#[no_mangle]
pub extern fn rust_handle_timer() {
let gtc = unsafe { global_timer_count };
unsafe {
global_timer_count += 1;
}
timer_callback(gtc);
}
mod PIC {
use x86_asm::{outb, inb, iowait};
@@ -84,29 +104,6 @@ mod x86_asm {
}
}
#[no_mangle]
pub extern fn rust_interrupt_handler() {
checkerboard(vga_buffer::Color::White);
}
#[no_mangle]
pub extern fn rust_handle_keyboard(x: u8) {
checkerboard(vga_buffer::Color::Green);
vga_buffer::print_u32(x as u32, 0);
}
static mut global_timer_count: u64 = 0;
#[no_mangle]
pub extern fn rust_handle_timer() {
let gtc = unsafe { global_timer_count };
unsafe {
global_timer_count += 1;
}
timer_callback(gtc);
}
fn timer_callback(count: u64) {
if count % 1000 == 0 {
checkerboard(vga_buffer::Color::White);

View File

@@ -1,6 +1,5 @@
global long_mode_start
global asm_printchar
global call_interrupt
extern rust_interrupt_handler
extern rust_handle_keyboard
extern rust_handle_timer
@@ -63,12 +62,6 @@ setup_SSE:
mov al, "a"
jmp error
asm_printchar:
mov rax, 0xf056
mov [0xb8000], ax
mov rax, 0x1
ret
; ----------- IDT section ---------------------