aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86_64/context.rs4
-rw-r--r--src/arch/x86_64/cpu.rs0
-rw-r--r--src/arch/x86_64/mod.rs3
-rw-r--r--src/ds/mod.rs2
-rw-r--r--src/ds/queue.rs0
-rw-r--r--src/machine/keyctrl.rs16
-rw-r--r--src/mm/pma.rs12
7 files changed, 22 insertions, 15 deletions
diff --git a/src/arch/x86_64/context.rs b/src/arch/x86_64/context.rs
index 08fd3b6..37b6c2f 100644
--- a/src/arch/x86_64/context.rs
+++ b/src/arch/x86_64/context.rs
@@ -13,7 +13,7 @@ pub struct Context {
}
/// prepare the thread (coroutine) for the first execution
-pub unsafe fn settle(){
+pub unsafe fn settle() {
todo!()
// it will be something like this...
// void **sp = (void**)tos;
@@ -23,6 +23,6 @@ pub unsafe fn settle(){
// regs->rsp = sp;
}
-pub unsafe fn switch(ctx_curr:usize, ctx_next:usize){
+pub unsafe fn switch(ctx_curr: usize, ctx_next: usize) {
todo!()
}
diff --git a/src/arch/x86_64/cpu.rs b/src/arch/x86_64/cpu.rs
deleted file mode 100644
index e69de29..0000000
--- a/src/arch/x86_64/cpu.rs
+++ /dev/null
diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs
index 03d2af0..4da1970 100644
--- a/src/arch/x86_64/mod.rs
+++ b/src/arch/x86_64/mod.rs
@@ -1,6 +1,5 @@
-pub mod cpu;
+pub mod context;
pub mod interrupt;
pub mod io_port;
pub mod mem;
pub mod misc;
-pub mod context;
diff --git a/src/ds/mod.rs b/src/ds/mod.rs
index e8ae652..8b13789 100644
--- a/src/ds/mod.rs
+++ b/src/ds/mod.rs
@@ -1 +1 @@
-pub mod queue;
+
diff --git a/src/ds/queue.rs b/src/ds/queue.rs
deleted file mode 100644
index e69de29..0000000
--- a/src/ds/queue.rs
+++ /dev/null
diff --git a/src/machine/keyctrl.rs b/src/machine/keyctrl.rs
index dc3402d..9bdada5 100644
--- a/src/machine/keyctrl.rs
+++ b/src/machine/keyctrl.rs
@@ -92,7 +92,9 @@ impl KeyboardController {
// TODO perhaps disable interrupts here
// TODO set a timeout. The ACK reply may never come
// 1. write command
- unsafe {self.__block_until_cmd_buffer_empty();}
+ unsafe {
+ self.__block_until_cmd_buffer_empty();
+ }
self.dport.outb(Cmd::SetLed as u8);
// 2. wait for ack
let ack = unsafe { self.__block_for_ack() };
@@ -188,7 +190,9 @@ impl KeyboardController {
pub fn fetch_key(&mut self) {
// mask keyboard interrupts when polling.
let was_masked = Self::is_int_masked();
- if !was_masked {Self::disable_keyboard_int();}
+ if !was_masked {
+ Self::disable_keyboard_int();
+ }
// I'd like to see if this panics....
let sr = self.read_status().unwrap();
@@ -197,7 +201,9 @@ impl KeyboardController {
return;
}
self.update_state(self.dport.inb());
- if !was_masked {Self::enable_keyboard_int();}
+ if !was_masked {
+ Self::enable_keyboard_int();
+ }
}
// this should be called by the "epilogue"
@@ -273,7 +279,9 @@ impl KeyboardController {
unsafe fn __block_until_cmd_buffer_empty(&self) {
loop {
let s = self.read_status().unwrap();
- if !s.contains(StatusReg::INB) {break;};
+ if !s.contains(StatusReg::INB) {
+ break;
+ };
}
}
}
diff --git a/src/mm/pma.rs b/src/mm/pma.rs
index af789e8..f9a6811 100644
--- a/src/mm/pma.rs
+++ b/src/mm/pma.rs
@@ -15,8 +15,8 @@ pub struct FMap {
pub skip_byte: usize,
}
-pub enum PMAError{
- DoubleFree
+pub enum PMAError {
+ DoubleFree,
}
impl FMap {
@@ -34,25 +34,25 @@ impl FMap {
/// return : index to the bitmap u8 , bit mask to retrive the bit.
fn locate_bit(addr: usize) -> Option<(usize, u8)> {
if addr >= Mem::PHY_TOP {
- return None
+ return None;
}
let pn = addr >> Mem::PAGE_SHIFT;
let idx = pn / 8;
- let mask:u8 = 1 << (pn % 8);
+ let mask: u8 = 1 << (pn % 8);
Some((idx, mask))
}
pub fn alloc_frame(&mut self) -> usize {
for i in self.skip_byte..self.bm.len() {
if self.bm[i] == 0xff {
- continue
+ continue;
}
todo!()
}
0
}
- pub fn dealloc_frame(&mut self) -> Result<(),PMAError>{
+ pub fn dealloc_frame(&mut self) -> Result<(), PMAError> {
Ok(())
}