From 6ae16cc6dfa851b366ef617ad81f4499df64904b Mon Sep 17 00:00:00 2001 From: GuillaumeDIDIER Date: Fri, 29 May 2020 16:26:53 +0200 Subject: [PATCH] Update to work with latest nightly --- Cargo.lock | 22 +++++++++++----------- Cargo.toml | 6 +++--- cache_utils/Cargo.toml | 2 +- polling_serial/Cargo.toml | 4 ++-- src/allocator.rs | 2 +- src/interrupts.rs | 4 ++-- src/lib.rs | 2 +- src/main.rs | 6 +++--- src/memory.rs | 8 +++----- vga_buffer/Cargo.toml | 2 +- 10 files changed, 28 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 446e206..3d1f6b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,7 +22,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bootloader" -version = "0.9.0" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -39,7 +39,7 @@ dependencies = [ "polling_serial 0.1.0", "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "vga_buffer 0.1.0", - "x86_64 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", + "x86_64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -64,14 +64,14 @@ name = "dendrobates_tinctoreus_azureus" version = "0.1.0" dependencies = [ "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "bootloader 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bootloader 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "cache_utils 0.1.0", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "linked_list_allocator 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "linked_list_allocator 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "polling_serial 0.1.0", "vga_buffer 0.1.0", "volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "x86_64 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", + "x86_64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -102,7 +102,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "linked_list_allocator" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "spinning_top 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -134,7 +134,7 @@ version = "0.1.0" dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "x86_64 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", + "x86_64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -181,7 +181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "x86_64" -version = "0.9.6" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -193,14 +193,14 @@ dependencies = [ "checksum bit_field 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a165d606cf084741d4ac3a28fb6e9b1eb0bd31f6cd999098cfddb0b2ab381dc0" "checksum bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed8765909f9009617974ab6b7d332625b320b33c326b1e9321382ef1999b5d56" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum bootloader 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "47a31d0af1b59774ea1470bf40b4bf9fed0bbead2f2d9d614c4c2e13382414dd" +"checksum bootloader 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "56452f4da420d25cf4bbf5b8fdc1529a8bde79a081f2619ce7ebc6d581117261" "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" -"checksum linked_list_allocator 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5825aea823c659d0fdcdbe8c9b78baf56f3a10365d783db874f6d360df72626f" +"checksum linked_list_allocator 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e70e46c13c0e8374c26cec5752e3347ca1087d9711de8f45aa513a7700efd73d" "checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" "checksum nix 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50e4785f2c3b7589a0d0c1dd60285e1188adac4006e8abd6dd578e1567027363" "checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" @@ -209,4 +209,4 @@ dependencies = [ "checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6af0edf5b4faacc31fc51159244d78d65ec580f021afcef7bd53c04aeabc7f29" -"checksum x86_64 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4206b60c9f99766329b66962aa8ddc01df6c7edd02edc046b7a69d5df9fcdbcf" +"checksum x86_64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "365de37eb7c6da582cbb510dd0f3f1235d24ff6309a8a96e8a9909cc9bfd608f" diff --git a/Cargo.toml b/Cargo.toml index d033beb..a2cd549 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,11 +25,11 @@ test-success-exit-code = 33 # (0x10 << 1) | 1 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -x86_64 = "0.9.6" +x86_64 = "0.11.0" vga_buffer = { path = "vga_buffer" } polling_serial = { path = "polling_serial" } volatile = "0.2.6" -linked_list_allocator = "0.8.1" +linked_list_allocator = "0.8.4" cache_utils = { path = "cache_utils", features = ["no_std"], default-features = false } arrayref = "0.3.6" @@ -38,7 +38,7 @@ version = "1.4.0" features = ["spin_no_std"] [dependencies.bootloader] -version = "0.9.0" +version = "0.9.4" features = ["sse", "map_physical_memory"] #[patch.crates-io] diff --git a/cache_utils/Cargo.toml b/cache_utils/Cargo.toml index de8ed53..d0b1bde 100644 --- a/cache_utils/Cargo.toml +++ b/cache_utils/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" polling_serial = { path = "../polling_serial", optional = true } vga_buffer = { path = "../vga_buffer", optional = true } cpuid = { path = "../cpuid", default-features = false } -x86_64 = "0.9.2" +x86_64 = "0.11.0" static_assertions = "1.1.0" itertools = { version = "0.9.0", default-features = false } diff --git a/polling_serial/Cargo.toml b/polling_serial/Cargo.toml index a5c416d..71dd003 100644 --- a/polling_serial/Cargo.toml +++ b/polling_serial/Cargo.toml @@ -7,9 +7,9 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -x86_64 = "0.9.2" +x86_64 = "0.11.0" spin = "0.5.2" [dependencies.lazy_static] -version = "1.0" +version = "1.4.0" features = ["spin_no_std"] diff --git a/src/allocator.rs b/src/allocator.rs index 5a4d4c1..f4904c1 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -25,7 +25,7 @@ pub fn init_heap( .allocate_frame() .ok_or(MapToError::FrameAllocationFailed)?; let flags = PageTableFlags::PRESENT | PageTableFlags::WRITABLE; - mapper.map_to(page, frame, flags, frame_allocator)?.flush(); + unsafe {mapper.map_to(page, frame, flags, frame_allocator)}?.flush(); } unsafe { diff --git a/src/interrupts.rs b/src/interrupts.rs index 6cdaf4b..130640c 100644 --- a/src/interrupts.rs +++ b/src/interrupts.rs @@ -39,7 +39,7 @@ extern "x86-interrupt" fn double_fault_handler(sf: &mut InterruptStackFrame, e: let error_code: u64; unsafe { - asm!("push rax" :::: "intel"); + llvm_asm!("push rax" :::: "intel"); let s = sf as *mut InterruptStackFrame; stack_frame = &mut *((s as *mut u64).offset(1) as *mut InterruptStackFrame); error_code = *(&e as *const u64).offset(1); @@ -71,7 +71,7 @@ extern "x86-interrupt" fn page_fault_handler(sf: &mut InterruptStackFrame, e: Pa use x86_64::registers::control::Cr2; unsafe { - asm!("push rax" :::: "intel"); + llvm_asm!("push rax" :::: "intel"); let s = sf as *mut InterruptStackFrame; stack_frame = &mut *((s as *mut u64).offset(1) as *mut InterruptStackFrame); error_code = *(&e as *const PageFaultErrorCode).offset(1) as PageFaultErrorCode; diff --git a/src/lib.rs b/src/lib.rs index 13d2ce0..255f67a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ #![test_runner(crate::test_runner)] #![reexport_test_harness_main = "test_main"] #![feature(abi_x86_interrupt)] -#![feature(asm)] +#![feature(llvm_asm)] #![feature(alloc_error_handler)] extern crate alloc; diff --git a/src/main.rs b/src/main.rs index 6d9f89c..4d8cf0b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -175,13 +175,13 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! { }) { //serial_println!("Mapping page {:x} on frame {:?}", page, frame); - mapper + unsafe {mapper .map_to( Page::::containing_address(VirtAddr::new(page)), - unsafe { UnusedPhysFrame::new(frame) }, + frame, PageTableFlags::PRESENT | PageTableFlags::WRITABLE, &mut frame_allocator, - ) + )} .expect("Failed to map the experiment buffer") .flush(); let phys = mapper.translate_addr(VirtAddr::new(page)); diff --git a/src/memory.rs b/src/memory.rs index 524668b..1cbe34b 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -1,7 +1,6 @@ use x86_64::{ structures::paging::{ FrameAllocator, Mapper, OffsetPageTable, Page, PageTable, PhysFrame, Size4KiB, - UnusedPhysFrame, }, PhysAddr, VirtAddr, }; @@ -46,10 +45,9 @@ pub fn create_example_mapping( use x86_64::structures::paging::PageTableFlags as Flags; let frame = PhysFrame::containing_address(PhysAddr::new(0xb8000)); - let not_really_unused_frame = unsafe { UnusedPhysFrame::new(frame) }; let flags = Flags::PRESENT | Flags::WRITABLE; - let map_to_result = mapper.map_to(page, not_really_unused_frame, flags, frame_allocator); + let map_to_result = unsafe {mapper.map_to(page, frame, flags, frame_allocator)}; map_to_result.expect("map_to failed").flush(); } @@ -87,9 +85,9 @@ impl BootInfoFrameAllocator { // We only allocate 4k pages unsafe impl FrameAllocator for BootInfoFrameAllocator { - fn allocate_frame(&mut self) -> Option { + fn allocate_frame(&mut self) -> Option { let frame = self.usable_frames().nth(self.next); self.next += 1; - frame.map(|f| unsafe { UnusedPhysFrame::new(f) }) + frame } } diff --git a/vga_buffer/Cargo.toml b/vga_buffer/Cargo.toml index 88a5e4d..e11ef1d 100644 --- a/vga_buffer/Cargo.toml +++ b/vga_buffer/Cargo.toml @@ -11,5 +11,5 @@ volatile = "0.2.6" spin = "0.5.2" [dependencies.lazy_static] -version = "1.0" +version = "1.4.0" features = ["spin_no_std"]