Fix warnings after updating rustc
Couple of features got stabilized, cpuid was made safe and there is a new lint for function item to integer casts.
This commit is contained in:
@@ -105,7 +105,7 @@ pub(super) fn init(madt: Madt) {
|
||||
ap_args_ptr.write(&args as *const _ as u64);
|
||||
ap_page_table.write(page_table_physaddr as u64);
|
||||
#[expect(clippy::fn_to_numeric_cast)]
|
||||
ap_code.write(kstart_ap as u64);
|
||||
ap_code.write(kstart_ap as *const () as u64);
|
||||
|
||||
// TODO: Is this necessary (this fence)?
|
||||
core::arch::asm!("");
|
||||
|
||||
@@ -27,7 +27,7 @@ pub unsafe fn init() {
|
||||
|
||||
msr::wrmsr(msr::IA32_STAR, u64::from(star_high) << 32);
|
||||
#[expect(clippy::fn_to_numeric_cast)]
|
||||
msr::wrmsr(msr::IA32_LSTAR, syscall_instruction as u64);
|
||||
msr::wrmsr(msr::IA32_LSTAR, syscall_instruction as *const () as u64);
|
||||
|
||||
// DF needs to be cleared, required by the compiler ABI. If DF were not part of FMASK,
|
||||
// userspace would be able to reverse the direction of in-kernel REP MOVS/STOS/(CMPS/SCAS), and
|
||||
|
||||
@@ -4,9 +4,9 @@ pub fn cpuid() -> CpuId {
|
||||
// FIXME check for cpuid availability during early boot and error out if it doesn't exist.
|
||||
CpuId::with_cpuid_fn(|a, c| {
|
||||
#[cfg(target_arch = "x86")]
|
||||
let result = unsafe { core::arch::x86::__cpuid_count(a, c) };
|
||||
let result = core::arch::x86::__cpuid_count(a, c);
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
let result = unsafe { core::arch::x86_64::__cpuid_count(a, c) };
|
||||
let result = core::arch::x86_64::__cpuid_count(a, c);
|
||||
CpuIdResult {
|
||||
eax: result.eax,
|
||||
ebx: result.ebx,
|
||||
|
||||
@@ -99,7 +99,7 @@ pub fn get_kvm_support() -> &'static Option<KvmSupport> {
|
||||
static KVM_SUPPORT: Once<Option<KvmSupport>> = Once::new();
|
||||
|
||||
KVM_SUPPORT.call_once(|| {
|
||||
let res = unsafe { __cpuid(0x4000_0000) };
|
||||
let res = __cpuid(0x4000_0000);
|
||||
if [res.ebx, res.ecx, res.edx].map(u32::to_le_bytes) != [*b"KVMK", *b"VMKV", *b"M\0\0\0"] {
|
||||
return None;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ pub fn get_kvm_support() -> &'static Option<KvmSupport> {
|
||||
if max_leaf < 0x4000_0001 {
|
||||
return None;
|
||||
}
|
||||
let res = unsafe { __cpuid(0x4000_0001) };
|
||||
let res = __cpuid(0x4000_0001);
|
||||
|
||||
let supp_feats = KvmFeatureBits::from_bits_retain(res.eax);
|
||||
|
||||
|
||||
@@ -196,14 +196,15 @@ fn init_generic(cpu_id: LogicalCpuId, idt: &mut Idt, backup_stack_end: usize) {
|
||||
current_idt[18].set_ist(BACKUP_IST);
|
||||
|
||||
assert_eq!(
|
||||
__generic_interrupts_end as usize - __generic_interrupts_start as usize,
|
||||
__generic_interrupts_end as *const () as usize
|
||||
- __generic_interrupts_start as *const () as usize,
|
||||
224 * 8
|
||||
);
|
||||
|
||||
for i in 0..224 {
|
||||
current_idt[i + 32].set_func(unsafe {
|
||||
mem::transmute::<usize, unsafe extern "C" fn()>(
|
||||
__generic_interrupts_start as usize + i * 8,
|
||||
__generic_interrupts_start as *const () as usize + i * 8,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ impl Context {
|
||||
stack_top = stack_top.sub(size_of::<usize>());
|
||||
stack_top
|
||||
.cast::<usize>()
|
||||
.write(crate::arch::interrupt::syscall::enter_usermode as usize);
|
||||
.write(crate::arch::interrupt::syscall::enter_usermode as *const () as usize);
|
||||
}
|
||||
|
||||
stack_top = stack_top.sub(size_of::<usize>());
|
||||
|
||||
+1
-3
@@ -3,10 +3,8 @@
|
||||
//! The Redox OS Kernel is a microkernel that supports `x86_64` systems and
|
||||
//! provides Unix-like syscalls for primarily Rust applications
|
||||
|
||||
#![feature(asm_cfg)] // Stabilized in 1.93
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(int_roundings)]
|
||||
#![feature(iter_next_chunk)]
|
||||
#![cfg_attr(dtb, feature(iter_next_chunk))]
|
||||
#![feature(sync_unsafe_cell)]
|
||||
#![feature(btree_cursors)]
|
||||
#![cfg_attr(not(test), no_std)]
|
||||
|
||||
@@ -113,7 +113,7 @@ impl KernelScheme for SysScheme {
|
||||
}
|
||||
fn kopenat(
|
||||
&self,
|
||||
id: usize,
|
||||
_id: usize,
|
||||
user_buf: StrOrBytes,
|
||||
_flags: usize,
|
||||
_fcntl_flags: u32,
|
||||
|
||||
Reference in New Issue
Block a user