From 02586cdb98fb778442a617664afa878924071693 Mon Sep 17 00:00:00 2001 From: WangRunji Date: Fri, 13 Jul 2018 11:23:01 +0800 Subject: [PATCH] Move x86_64 specific external crate to arch mod --- src/arch/x86_64/driver/apic/ioapic.rs | 2 +- src/arch/x86_64/driver/mod.rs | 2 ++ src/arch/x86_64/driver/pic.rs | 2 +- src/arch/x86_64/driver/pit.rs | 2 +- src/arch/x86_64/driver/serial.rs | 5 +++-- src/arch/x86_64/memory.rs | 4 ++-- src/arch/x86_64/mod.rs | 3 ++- src/lib.rs | 6 ------ 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/arch/x86_64/driver/apic/ioapic.rs b/src/arch/x86_64/driver/apic/ioapic.rs index 9d0adc9..755e99d 100644 --- a/src/arch/x86_64/driver/apic/ioapic.rs +++ b/src/arch/x86_64/driver/apic/ioapic.rs @@ -4,7 +4,7 @@ /// http://www.intel.com/design/chipsets/datashts/29056601.pdf /// See also picirq.c. -use redox_syscall::io::{Io, Mmio}; +use super::super::redox_syscall::io::{Io, Mmio}; use bit_field::BitField; use arch::interrupt::consts::T_IRQ0; use spin::Mutex; diff --git a/src/arch/x86_64/driver/mod.rs b/src/arch/x86_64/driver/mod.rs index 65e1f57..4be8d11 100644 --- a/src/arch/x86_64/driver/mod.rs +++ b/src/arch/x86_64/driver/mod.rs @@ -1,3 +1,5 @@ +extern crate syscall as redox_syscall; + pub mod vga; pub mod acpi; pub mod apic; diff --git a/src/arch/x86_64/driver/pic.rs b/src/arch/x86_64/driver/pic.rs index 3ef42c1..96f8643 100644 --- a/src/arch/x86_64/driver/pic.rs +++ b/src/arch/x86_64/driver/pic.rs @@ -1,6 +1,6 @@ // Copy from Redox -use redox_syscall::io::*; +use super::redox_syscall::io::*; use spin::Mutex; static MASTER: Mutex = Mutex::new(Pic::new(0x20)); diff --git a/src/arch/x86_64/driver/pit.rs b/src/arch/x86_64/driver/pit.rs index 01c91a0..2b85923 100644 --- a/src/arch/x86_64/driver/pit.rs +++ b/src/arch/x86_64/driver/pit.rs @@ -1,4 +1,4 @@ -use redox_syscall::io::{Io, Pio}; +use super::redox_syscall::io::{Io, Pio}; static mut PIT: Pit = Pit::new(0x40); diff --git a/src/arch/x86_64/driver/serial.rs b/src/arch/x86_64/driver/serial.rs index bfe9b24..28c9173 100644 --- a/src/arch/x86_64/driver/serial.rs +++ b/src/arch/x86_64/driver/serial.rs @@ -1,9 +1,10 @@ // Copy from Redox +extern crate uart_16550; use core::fmt::{self, Write}; -use redox_syscall::io::{Io, Pio}; +use super::redox_syscall::io::{Io, Pio}; use spin::Mutex; -use uart_16550::SerialPort; +use self::uart_16550::SerialPort; pub static COM1: Mutex = Mutex::new(SerialPort::new(0x3F8)); pub static COM2: Mutex = Mutex::new(SerialPort::new(0x2F8)); diff --git a/src/arch/x86_64/memory.rs b/src/arch/x86_64/memory.rs index bdc7272..00db06e 100644 --- a/src/arch/x86_64/memory.rs +++ b/src/arch/x86_64/memory.rs @@ -2,8 +2,8 @@ use bit_allocator::{BitAlloc, BitAlloc64K}; use consts::KERNEL_OFFSET; // Depends on kernel use memory::{active_table, FRAME_ALLOCATOR, init_heap, MemoryArea, MemoryAttr, MemorySet, Stack}; -use multiboot2::{ElfSection, ElfSectionFlags, ElfSectionsTag}; -use multiboot2::BootInformation; +use super::multiboot2::{ElfSection, ElfSectionFlags, ElfSectionsTag}; +use super::multiboot2::BootInformation; use ucore_memory::PAGE_SIZE; use ucore_memory::paging::PageTable; diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs index 5a5f775..58b1ee3 100644 --- a/src/arch/x86_64/mod.rs +++ b/src/arch/x86_64/mod.rs @@ -1,5 +1,6 @@ +extern crate multiboot2; + use memory::MemorySet; -use multiboot2; pub mod driver; pub mod cpu; diff --git a/src/lib.rs b/src/lib.rs index 03164ab..bbf123f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,18 +30,12 @@ extern crate lazy_static; extern crate linked_list_allocator; #[macro_use] extern crate log; -#[cfg(target_arch = "x86_64")] -extern crate multiboot2; #[macro_use] extern crate once; extern crate rlibc; #[cfg(target_arch = "x86_64")] extern crate simple_filesystem; extern crate spin; -#[cfg(target_arch = "x86_64")] -extern crate syscall as redox_syscall; -#[cfg(target_arch = "x86_64")] -extern crate uart_16550; extern crate ucore_memory; extern crate volatile; #[macro_use]