Skip to content

Commit

Permalink
chore: 将工具链更新到2024-07-23 (DragonOS-Community#864)
Browse files Browse the repository at this point in the history
* chore: 将工具链更新到2024-07-23
  • Loading branch information
fslongjin authored Jul 24, 2024
1 parent 634349e commit bd70d2d
Show file tree
Hide file tree
Showing 150 changed files with 237 additions and 200 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/cache-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ jobs:
cargo install cargo-binutils
rustup toolchain install nightly-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-01-21-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-none --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-none --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup target add x86_64-unknown-none --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup toolchain install nightly-2023-01-21-riscv64gc-unknown-linux-gnu --force-non-host
rustup toolchain install nightly-2024-07-23-riscv64gc-unknown-linux-gnu --force-non-host
rustup toolchain install nightly-2023-08-15-riscv64gc-unknown-linux-gnu --force-non-host
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
rustup target add riscv64gc-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
rustup target add riscv64imac-unknown-none-elf --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
Expand All @@ -71,12 +71,12 @@ jobs:
rustup component add rustfmt
rustup component add rustfmt --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-01-21-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-08-15-x86_64-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-01-21-riscv64gc-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2024-07-23-riscv64gc-unknown-linux-gnu
rustup component add rustfmt --toolchain nightly-2023-08-15-riscv64gc-unknown-linux-gnu
rustup default nightly
rustup default nightly-2024-07-23
cargo install dadk --version 0.1.11
Expand All @@ -86,6 +86,9 @@ jobs:
rustup toolchain install ${userapp_musl_toolchain}
rustup component add --toolchain ${userapp_musl_toolchain} rust-src
rustup target add --toolchain ${userapp_musl_toolchain} x86_64-unknown-linux-musl
rustup target add x86_64-unknown-linux-musl --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain nightly-2024-07-23-x86_64-unknown-linux-gnu
2 changes: 1 addition & 1 deletion build-scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ fmt:
clean:
@cargo clean
check:
@cargo +nightly-2023-08-15 check --workspace $(CARGO_ZBUILD) --message-format=json
@cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json
2 changes: 0 additions & 2 deletions build-scripts/kernel_build/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(cfg_target_abi)]

#[macro_use]
extern crate lazy_static;
extern crate cc;
Expand Down
5 changes: 5 additions & 0 deletions kernel/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@
[target.'cfg(target_os = "none")']
runner = "bootimage runner"

[build]
# '-Zlinker-features=-lld' 禁用rustlld(20240723),因为它与linkme0.3版本冲突
rustflags = ["-Zlinker-features=-lld"]
rustdocflags = ["-Zlinker-features=-lld"]

[env]
10 changes: 6 additions & 4 deletions kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ crate-type = ["staticlib"]
[workspace]
members = [
"crates/*",
"src/libs/intertrait"
]

[features]
default = ["backtrace", "kvm"]
default = ["backtrace", "kvm", "fatfs", "fatfs-secure"]
# 内核栈回溯
backtrace = []
# kvm
kvm = []

fatfs = []
fatfs-secure = ["fatfs"]


# 运行时依赖项
[dependencies]
Expand All @@ -37,10 +39,10 @@ driver_base_macros = { "path" = "crates/driver_base_macros" }
elf = { version = "=0.7.2", default-features = false }
hashbrown = "=0.13.2"
ida = { path = "src/libs/ida" }
intertrait = { path = "src/libs/intertrait" }
intertrait = { path = "crates/intertrait" }
kdepends = { path = "crates/kdepends" }
klog_types = { path = "crates/klog_types" }
linkme = "=0.2"
linkme = "=0.3.27"
num = { version = "=0.4.0", default-features = false }
num-derive = "=0.3"
num-traits = { git = "https://git.mirrors.dragonos.org.cn/DragonOS-Community/num-traits.git", rev="1597c1c", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ check: ECHO
# @echo "Checking kernel... ARCH=$(ARCH)"
# @exit 1
ifeq ($(ARCH), x86_64)
@cargo +nightly-2023-08-15 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON)
@cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json --target ./src/$(TARGET_JSON)
else ifeq ($(ARCH), riscv64)
@cargo +nightly-2023-08-15 check --workspace $(CARGO_ZBUILD) --message-format=json --target $(TARGET_JSON)
@cargo +nightly-2024-07-23 check --workspace $(CARGO_ZBUILD) --message-format=json --target $(TARGET_JSON)
endif

test:
# 测试内核库
@cargo +nightly-2023-08-15 test --workspace --exclude dragonos_kernel
@cargo +nightly-2024-07-23 test --workspace --exclude dragonos_kernel

1 change: 1 addition & 0 deletions kernel/crates/bitmap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![feature(core_intrinsics)]
#![allow(incomplete_features)] // for const generics
#![feature(generic_const_exprs)]
#![allow(internal_features)]
#![allow(clippy::needless_return)]

#[macro_use]
Expand Down
9 changes: 9 additions & 0 deletions kernel/crates/bitmap/src/static_bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ where
core: BitMapCore<usize>,
}

impl<const N: usize> Default for StaticBitmap<N>
where
[(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:,
{
fn default() -> Self {
Self::new()
}
}

impl<const N: usize> StaticBitmap<N>
where
[(); (N + usize::BITS as usize - 1) / (usize::BITS as usize)]:,
Expand Down
5 changes: 0 additions & 5 deletions kernel/crates/bitmap/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ macro_rules! bitops_for {
}
}

#[cfg(feature = "std")]
fn to_hex(bits: &Self) -> String {
format!("{:x}", bits)
}

#[inline]
fn bit_size() -> usize {
<$target>::BITS as usize
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include = ["src/**/*", "Cargo.toml", "LICENSE-*", "README.md"]


[dependencies]
linkme = "0.2"
linkme = "=0.3.27"
hashbrown = "0.13.2"
intertrait-macros = { version = "=0.2.2", path = "macros" }

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Add the following two dependencies to your `Cargo.toml`:
```toml
[dependencies]
intertrait = "0.2"
linkme = "0.2"
linkme = "=0.3.27"
```

The `linkme` dependency is required due to the use of `linkme` macro in the output of `intertrait` macros.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ uuid = { version = "0.8", features = ["v4"] }

[dev-dependencies]
intertrait = { version = "=0.2.2", path = ".." }
linkme = "0.2"
linkme = "=0.3.27"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions kernel/crates/klog_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ impl MMLogCycle {
}
}

impl Default for MMLogCycle {
fn default() -> Self {
Self::new()
}
}

impl kdepends::thingbuf::Recycle<AllocatorLog> for MMLogCycle {
fn new_element(&self) -> AllocatorLog {
AllocatorLog::zeroed()
Expand Down
8 changes: 5 additions & 3 deletions kernel/crates/rust-slabmalloc/src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Bitfield for [AtomicU64] {
fn initialize(&mut self, for_size: usize, capacity: usize) {
// Set everything to allocated
for bitmap in self.iter_mut() {
*bitmap = AtomicU64::new(u64::max_value());
*bitmap = AtomicU64::new(u64::MAX);
}

// Mark actual slots as free
Expand All @@ -64,7 +64,7 @@ impl Bitfield for [AtomicU64] {

for (base_idx, b) in self.iter().enumerate() {
let bitval = b.load(Ordering::Relaxed);
if bitval == u64::max_value() {
if bitval == u64::MAX {
continue;
} else {
let negated = !bitval;
Expand Down Expand Up @@ -125,7 +125,7 @@ impl Bitfield for [AtomicU64] {
#[inline(always)]
fn is_full(&self) -> bool {
self.iter()
.filter(|&x| x.load(Ordering::Relaxed) != u64::max_value())
.filter(|&x| x.load(Ordering::Relaxed) != u64::MAX)
.count()
== 0
}
Expand Down Expand Up @@ -410,6 +410,7 @@ impl<'a, T: AllocablePage> PageList<'a, T> {
}

/// Removes `slab_page` from the list.
#[allow(clippy::manual_inspect)]
pub(crate) fn pop<'b>(&'b mut self) -> Option<&'a mut T> {
match self.head {
None => None,
Expand Down Expand Up @@ -453,6 +454,7 @@ impl<'a, P: AllocablePage + 'a> Iterator for ObjectPageIterMut<'a, P> {
type Item = &'a mut P;

#[inline]
#[allow(clippy::manual_inspect)]
fn next(&mut self) -> Option<&'a mut P> {
unsafe {
self.head.resolve_mut().map(|next| {
Expand Down
2 changes: 1 addition & 1 deletion kernel/crates/unified-init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ path = "src/main.rs"

[dependencies]
unified-init-macros = { path = "macros" }
linkme = "0.2"
linkme = "=0.3.27"
system_error = { path = "../system_error" }
2 changes: 1 addition & 1 deletion kernel/crates/unified-init/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ uuid = { version = "0.8", features = ["v4"] }

[dev-dependencies]
unified-init = { path = ".." }
linkme = "0.2"
linkme = "=0.3.27"
system_error = { path = "../../system_error" }
2 changes: 1 addition & 1 deletion kernel/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-08-15"
channel = "nightly-2024-07-23"
components = ["rust-src", "clippy"]
4 changes: 2 additions & 2 deletions kernel/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ifeq ($(ARCH), x86_64)
endif
endif

RUSTFLAGS = $(RUSTFLAGS_UNWIND)
RUSTFLAGS += $(RUSTFLAGS_UNWIND)

CFLAGS = $(GLOBAL_CFLAGS) -fno-pie $(CFLAGS_UNWIND) -I $(shell pwd) -I $(shell pwd)/include

Expand All @@ -40,7 +40,7 @@ kernel_subdirs := common driver debug syscall libs


kernel_rust:
RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2023-08-15 $(CARGO_ZBUILD) build --release --target $(TARGET_JSON)
RUSTFLAGS="$(RUSTFLAGS)" cargo +nightly-2024-07-23 $(CARGO_ZBUILD) build --release --target $(TARGET_JSON)


all: kernel
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/io.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// 每个架构都需要实现的IO接口
#[allow(unused)]
pub trait PortIOArch {
unsafe fn in8(port: u16) -> u8;
unsafe fn in16(port: u16) -> u16;
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/x86_64/driver/apic/apic_timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ impl LocalApicTimerIntrController {
local_apic_timer.start_current();
}

#[allow(dead_code)]
pub(super) fn disable(&self) {
let cpu_id = smp_get_processor_id();
let local_apic_timer = local_apic_timer_instance_mut(cpu_id);
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/x86_64/driver/apic/lapic_vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ bitflags! {
}
}

#[allow(dead_code)]
pub(super) fn irq_msi_compose_msg(cfg: &HardwareIrqConfig, msg: &mut MsiMsg, dmar: bool) {
*msg = MsiMsg::new_zeroed();

Expand Down
2 changes: 2 additions & 0 deletions kernel/src/arch/x86_64/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ extern "C" {
}

#[no_mangle]
#[allow(static_mut_refs)]
unsafe extern "C" fn kernel_main(
mb2_info: u64,
mb2_magic: u64,
Expand Down Expand Up @@ -66,6 +67,7 @@ unsafe extern "C" fn kernel_main(

/// 在内存管理初始化之前的架构相关的早期初始化
#[inline(never)]
#[allow(static_mut_refs)]
pub fn early_setup_arch() -> Result<(), SystemError> {
let stack_start = unsafe { *(head_stack_start as *const u64) } as usize;
debug!("head_stack_start={:#x}\n", stack_start);
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/x86_64/interrupt/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ pub unsafe fn set_system_trap_gate(irq: u32, ist: u8, vaddr: VirtAddr) {
set_gate(idt_entry, 0xEF, ist, vaddr);
}

#[allow(static_mut_refs)]
unsafe fn get_idt_entry(irq: u32) -> &'static mut [u64] {
assert!(irq < 256);
let mut idt_vaddr =
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/x86_64/interrupt/msi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct X86MsiDataNormal {
}

#[derive(Debug)]
#[allow(dead_code)]
pub struct X86MsiDataDmar {
pub dmar_subhandle: u32,
}
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/x86_64/ipc/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ impl SigContext {
}
}
/// @brief 信号处理备用栈的信息
#[allow(dead_code)]
#[derive(Debug, Clone, Copy)]
pub struct SigStack {
pub sp: *mut c_void,
Expand Down
6 changes: 4 additions & 2 deletions kernel/src/arch/x86_64/kvm/vmx/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub struct MSRBitmap {
pub data: [u8; PAGE_SIZE],
}

#[allow(dead_code)]
#[derive(Debug)]
pub struct VcpuData {
/// The virtual and physical address of the Vmxon naturally aligned 4-KByte region of memory
Expand Down Expand Up @@ -73,6 +74,7 @@ pub enum VcpuState {
Act = 2,
}

#[allow(dead_code)]
#[derive(Debug)]
pub struct VmxVcpu {
pub vcpu_id: u32,
Expand Down Expand Up @@ -318,13 +320,13 @@ impl VmxVcpu {
)?;
vmx_vmwrite(
VmcsFields::HOST_GDTR_BASE as u32,
pseudo_descriptpr.base.to_bits() as u64,
pseudo_descriptpr.base as usize as u64,
)?;
vmx_vmwrite(VmcsFields::HOST_IDTR_BASE as u32, unsafe {
let mut pseudo_descriptpr: x86::dtables::DescriptorTablePointer<u64> =
Default::default();
x86::dtables::sidt(&mut pseudo_descriptpr);
pseudo_descriptpr.base.to_bits() as u64
pseudo_descriptpr.base as usize as u64
})?;

// fast entry into the kernel
Expand Down
4 changes: 2 additions & 2 deletions kernel/src/arch/x86_64/kvm/vmx/vmx_asm_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ pub fn vmx_vmlaunch() -> Result<(), SystemError> {
"push rsi",
"push rdi",
"vmwrite {0:r}, rsp",
"lea rax, 1f[rip]",
"lea rax, 2f[rip]",
"vmwrite {1:r}, rax",
"vmlaunch",
"1:",
"2:",
"pop rdi",
"pop rsi",
"pop rdx",
Expand Down
1 change: 1 addition & 0 deletions kernel/src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub use interrupt::X86_64InterruptArch as CurrentIrqArch;
pub use crate::arch::asm::pio::X86_64PortIOArch as CurrentPortIOArch;
pub use kvm::X86_64KVMArch as KVMArch;

#[allow(unused_imports)]
pub use crate::arch::ipc::signal::X86_64SignalArch as CurrentSignalArch;
pub use crate::arch::time::X86_64TimeArch as CurrentTimeArch;

Expand Down
Loading

0 comments on commit bd70d2d

Please sign in to comment.