|
|
@ -72,10 +72,13 @@ impl Driver for E1000Interface {
|
|
|
|
fn try_handle_interrupt(&self) -> bool {
|
|
|
|
fn try_handle_interrupt(&self) -> bool {
|
|
|
|
let irq = {
|
|
|
|
let irq = {
|
|
|
|
let driver = self.driver.0.lock();
|
|
|
|
let driver = self.driver.0.lock();
|
|
|
|
let mut current_addr = driver.header;
|
|
|
|
|
|
|
|
while current_addr < driver.header + driver.size {
|
|
|
|
if let None = active_table().get_entry(driver.header) {
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
let mut current_addr = driver.header;
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
while current_addr < driver.header + driver.size {
|
|
|
|
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let e1000 = unsafe {
|
|
|
|
let e1000 = unsafe {
|
|
|
@ -115,11 +118,12 @@ impl Driver for E1000Interface {
|
|
|
|
|
|
|
|
|
|
|
|
impl E1000 {
|
|
|
|
impl E1000 {
|
|
|
|
fn transmit_available(&self) -> bool {
|
|
|
|
fn transmit_available(&self) -> bool {
|
|
|
|
// TODO map it in all cpu
|
|
|
|
if let None = active_table().get_entry(self.header) {
|
|
|
|
let mut current_addr = self.header;
|
|
|
|
let mut current_addr = self.header;
|
|
|
|
while current_addr < self.header + self.size {
|
|
|
|
while current_addr < self.header + self.size {
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let e1000 =
|
|
|
|
let e1000 =
|
|
|
@ -136,11 +140,12 @@ impl E1000 {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn receive_available(&self) -> bool {
|
|
|
|
fn receive_available(&self) -> bool {
|
|
|
|
// TODO map it in all cpu
|
|
|
|
if let None = active_table().get_entry(self.header) {
|
|
|
|
let mut current_addr = self.header;
|
|
|
|
let mut current_addr = self.header;
|
|
|
|
while current_addr < self.header + self.size {
|
|
|
|
while current_addr < self.header + self.size {
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let e1000 =
|
|
|
|
let e1000 =
|
|
|
|