Migrate to 1.82 rustc nightly

This commit is contained in:
2024-07-25 11:58:47 +03:00
parent 8eb5d2ecf1
commit 1bd9d65a5e
65 changed files with 791 additions and 256 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ use kernel_arch_interface::{
mem::{KernelTableManager, PhysicalMemoryAllocator},
task::{ForkFrame, StackBuilder, TaskContext, TaskFrame, UserContextInfo},
};
use libk_mm_interface::address::{AsPhysicalAddress, IntoRaw, PhysicalAddress};
use libk_mm_interface::address::{AsPhysicalAddress, PhysicalAddress};
use yggdrasil_abi::{arch::SavedFrame, error::Error};
use crate::{mem::KERNEL_TABLES, registers::FpuContext};
@@ -423,7 +423,7 @@ impl<K: KernelTableManager, PA: PhysicalMemoryAllocator<Address = PhysicalAddres
setup_common_context(
&mut stack,
__x86_64_task_enter_kernel as _,
unsafe { KERNEL_TABLES.as_physical_address().into_raw() },
unsafe { KERNEL_TABLES.as_physical_address().into_u64() },
0,
);
+1 -7
View File
@@ -1,12 +1,6 @@
#![no_std]
#![allow(clippy::new_without_default)]
#![feature(
effects,
strict_provenance,
asm_const,
naked_functions,
trait_upcasting
)]
#![feature(strict_provenance, asm_const, naked_functions, trait_upcasting)]
extern crate alloc;
+7 -7
View File
@@ -9,8 +9,8 @@ use kernel_arch_interface::mem::{
DeviceMemoryAttributes, KernelTableManager, RawDeviceMemoryMapping,
};
use libk_mm_interface::{
address::{FromRaw, PhysicalAddress},
table::{EntryLevel, EntryLevelExt},
address::PhysicalAddress,
table::{page_index, EntryLevel, EntryLevelExt},
KernelImageObject,
};
use memtables::x86_64::FixedTables;
@@ -32,9 +32,9 @@ const KERNEL_PHYS_BASE: usize = 0x200000;
// Mapped at compile time
const KERNEL_MAPPING_BASE: usize = KERNEL_VIRT_OFFSET + KERNEL_PHYS_BASE;
const KERNEL_L0_INDEX: usize = KERNEL_MAPPING_BASE.page_index::<L0>();
const KERNEL_L1_INDEX: usize = KERNEL_MAPPING_BASE.page_index::<L1>();
const KERNEL_START_L2_INDEX: usize = KERNEL_MAPPING_BASE.page_index::<L2>();
const KERNEL_L0_INDEX: usize = page_index::<L0>(KERNEL_MAPPING_BASE);
const KERNEL_L1_INDEX: usize = page_index::<L1>(KERNEL_MAPPING_BASE);
const KERNEL_START_L2_INDEX: usize = page_index::<L2>(KERNEL_MAPPING_BASE);
// Must not be zero, should be at 4MiB
const_assert_ne!(KERNEL_START_L2_INDEX, 0);
@@ -95,7 +95,7 @@ impl KernelTableManager for KernelTableManagerImpl {
count: usize,
attrs: DeviceMemoryAttributes,
) -> Result<RawDeviceMemoryMapping<Self>, Error> {
map_device_memory(PhysicalAddress::from_raw(base), count, attrs)
map_device_memory(PhysicalAddress::from_u64(base), count, attrs)
}
unsafe fn unmap_device_pages(mapping: &RawDeviceMemoryMapping<Self>) {
@@ -364,7 +364,7 @@ pub unsafe fn init_fixed_tables() {
let ram_mapping_l1_phys = addr_of!(RAM_MAPPING_L1) as usize - KERNEL_VIRT_OFFSET;
for i in 0..DEVICE_MAPPING_L3_COUNT {
let device_mapping_l3_phys = PhysicalAddress::from_raw(
let device_mapping_l3_phys = PhysicalAddress::from_usize(
&DEVICE_MAPPING_L3S[i] as *const _ as usize - KERNEL_VIRT_OFFSET,
);
DEVICE_MAPPING_L2[i] = PageEntry::table(device_mapping_l3_phys, PageAttributes::WRITABLE);
+2 -2
View File
@@ -2,7 +2,7 @@
use core::marker::PhantomData;
use libk_mm_interface::{
address::{AsPhysicalAddress, IntoRaw, PhysicalAddress},
address::{AsPhysicalAddress, PhysicalAddress},
pointer::PhysicalRefMut,
process::ProcessAddressSpaceManager,
table::{
@@ -73,7 +73,7 @@ impl<TA: TableAllocator> ProcessAddressSpaceManager<TA> for ProcessAddressSpaceI
fn as_address_with_asid(&self) -> u64 {
// TODO x86-64 PCID/ASID?
unsafe { self.l0.as_physical_address().into_raw() }
unsafe { self.l0.as_physical_address().into_u64() }
}
unsafe fn clear(&mut self) {
+3 -3
View File
@@ -6,7 +6,7 @@ use core::{
use bitflags::bitflags;
use libk_mm_interface::{
address::{AsPhysicalAddress, FromRaw, PhysicalAddress},
address::{AsPhysicalAddress, PhysicalAddress},
pointer::{PhysicalRef, PhysicalRefMut},
table::{
EntryLevel, EntryLevelDrop, MapAttributes, NextPageTable, NonTerminalEntryLevel,
@@ -98,7 +98,7 @@ impl PageEntry<L3> {
/// not
pub fn as_page(self) -> Option<PhysicalAddress> {
if self.0 & PageAttributes::PRESENT.bits() != 0 {
Some(PhysicalAddress::from_raw(self.0 & !0xFFF))
Some(PhysicalAddress::from_u64(self.0 & !0xFFF))
} else {
None
}
@@ -145,7 +145,7 @@ impl<L: NonTerminalEntryLevel> PageEntry<L> {
if self.0 & PageAttributes::PRESENT.bits() != 0
&& self.0 & PageAttributes::BLOCK.bits() == 0
{
Some(PhysicalAddress::from_raw(self.0 & !0xFFF))
Some(PhysicalAddress::from_u64(self.0 & !0xFFF))
} else {
None
}