Skip to content

Commit

Permalink
Update to Rust 1.61; nightly version from 2022-03-21 (theseus-os#498)
Browse files Browse the repository at this point in the history
* Remove `llvm_asm!()` and convert everything to the new `asm!()` syntax

* The `__truncdfsf2` family of functions is now in the compiler_builtins crate, so we can remove our own version.

* Remove lots of outdated or stabilized features.

* `Debug` and `Clone` derivations now warn about unused struct fields, so we allow those or pre-pend a `_` before the field name as necessary.

* The target spec `.json` files now need to be cleaned up to avoid warnings, with no fake comment lines.

* Cleanup SSE builds and simd_personality cfg imports.

* Makefile: ensure that `ENABLE_AVX` is defined as part of `CFLAGS` for `nasm` even when building in debug mode.

* Update `linked_list_allocator` dependency.

* Note: other changed crates include `irq_safety`, `spin`, `x86_64`
  • Loading branch information
kevinaboos authored Mar 23, 2022
1 parent 23bcfce commit be9e9ed
Show file tree
Hide file tree
Showing 43 changed files with 194 additions and 591 deletions.
86 changes: 77 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ APP_CRATE_NAMES += $(EXTRA_APP_CRATE_NAMES)
### If we compile for SIMD targets newer than SSE (e.g., AVX or newer),
### then we need to define a preprocessor variable
### that will cause the AVX flag to be enabled in the boot-up assembly code.
ifneq (,$(findstring avx, $(TARGET)))
$(eval CFLAGS += -DENABLE_AVX)
ifneq (,$(findstring avx,$(TARGET)))
export override CFLAGS+=-DENABLE_AVX
endif


Expand Down
1 change: 1 addition & 0 deletions applications/loadc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ struct LoadedExecutable {

/// Represents an ELF program segment that has been loaded into memory.
#[derive(Debug)]
#[allow(dead_code)]
pub struct LoadedSegment {
/// The memory region allocated to hold this program segment.
mp: MappedPages,
Expand Down
2 changes: 1 addition & 1 deletion applications/ping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ macro_rules! hpet_ticks {
match get_hpet().as_ref().ok_or("coudln't get HPET timer") {
Ok(time) => time.get_counter(),
Err(_) => return println!("couldnt get HPET timer"),
};
}
};
}

Expand Down
1 change: 0 additions & 1 deletion applications/test_panic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ build = "../../build.rs"

[dependencies]


[dependencies.log]
version = "0.4.8"

Expand Down
4 changes: 1 addition & 3 deletions cfg/x86_64-theseus-avx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"has-elf-tls": true,
"arch": "x86_64",
"os": "theseus",
"features": "+avx",
"disable-redzone": true,
"panic": "unwind"
"disable-redzone": true
}
5 changes: 1 addition & 4 deletions cfg/x86_64-theseus-sse.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"has-elf-tls": true,
"arch": "x86_64",
"os": "theseus",
"__features": "TODO: may also need sse4.1",
"features": "+sse2",
"disable-redzone": true,
"panic": "unwind"
"disable-redzone": true
}
7 changes: 1 addition & 6 deletions cfg/x86_64-theseus.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
{
"llvm-target": "x86_64-unknown-none-elf",
"__data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"linker-flavor": "gcc",
"__env": "tlibc",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"has-elf-tls": true,
"arch": "x86_64",
"os": "theseus",
"features": "-mmx,-sse,+soft-float",
"__features": "-pclmulqdq,-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float",
"disable-redzone": true,
"panic": "unwind"
"disable-redzone": true
}
1 change: 1 addition & 0 deletions kernel/acpi/dmar/src/device_scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct DmarDeviceScope<'t> {
path_starting_offset: usize,
/// The total size in bytes of all dynamic Path entries.
/// The number of Path entries is `path_total_size / 2`.
#[allow(dead_code)]
path_total_size: usize,
}

Expand Down
2 changes: 1 addition & 1 deletion kernel/acpi/dmar/src/drhd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::*;
#[derive(Clone, Copy, Debug, FromBytes)]
#[repr(packed)]
pub(crate) struct Drhd {
header: DmarEntryRecord,
_header: DmarEntryRecord,
flags: u8,
_reserved: u8,
segment_number: u16,
Expand Down
5 changes: 5 additions & 0 deletions kernel/acpi/dmar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ impl<'t> DmarEntry<'t> {
/// An instance of this struct describes a memory region
#[derive(Clone, Copy, Debug, FromBytes)]
#[repr(packed)]
#[allow(dead_code)]
pub struct DmarRmrr {
header: DmarEntryRecord,
_reserved: u16,
Expand All @@ -243,6 +244,7 @@ const_assert_eq!(core::mem::size_of::<DmarRmrr>(), 24);
/// ATSR: DMAR Root Port ATS (Address Translation Services) Capability Reporting Structure.
#[derive(Clone, Copy, Debug, FromBytes)]
#[repr(packed)]
#[allow(dead_code)]
pub struct DmarAtsr {
header: DmarEntryRecord,
flags: u8,
Expand All @@ -257,6 +259,7 @@ const_assert_eq!(core::mem::size_of::<DmarAtsr>(), 8);
/// RHSA: DMAR Remapping Hardware Static Affinity Structure.
#[derive(Clone, Copy, Debug, FromBytes)]
#[repr(packed)]
#[allow(dead_code)]
pub struct DmarRhsa {
header: DmarEntryRecord,
_reserved: u32,
Expand All @@ -269,6 +272,7 @@ const_assert_eq!(core::mem::size_of::<DmarRhsa>(), 20);
/// ANDD: DMAR ACPI Name-space Device Declaration Structure.
#[derive(Clone, Copy, Debug, FromBytes)]
#[repr(packed)]
#[allow(dead_code)]
pub struct DmarAndd {
header: DmarEntryRecord,
_reserved: [u8; 3],
Expand All @@ -284,6 +288,7 @@ const_assert_eq!(core::mem::size_of::<DmarAndd>(), 8);
/// SATC: DMAR SoC Integrated Address Translation Cache Reorting Structure.
#[derive(Clone, Copy, Debug, FromBytes)]
#[repr(packed)]
#[allow(dead_code)]
pub struct DmarSatc {
header: DmarEntryRecord,
flags: u8,
Expand Down
10 changes: 5 additions & 5 deletions kernel/acpi/madt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub enum MadtEntry<'t> {
#[derive(Copy, Clone, Debug, FromBytes)]
#[repr(packed)]
pub struct MadtLocalApic {
header: EntryRecord,
_header: EntryRecord,
/// Processor ID
pub processor: u8,
/// Local APIC ID
Expand All @@ -244,7 +244,7 @@ pub struct MadtLocalApic {
#[derive(Copy, Clone, Debug, FromBytes)]
#[repr(packed)]
pub struct MadtIoApic {
header: EntryRecord,
_header: EntryRecord,
/// I/O APIC ID
pub id: u8,
_reserved: u8,
Expand All @@ -258,7 +258,7 @@ pub struct MadtIoApic {
#[derive(Copy, Clone, Debug, FromBytes)]
#[repr(packed)]
pub struct MadtIntSrcOverride {
header: EntryRecord,
_header: EntryRecord,
/// Bus Source
pub bus_source: u8,
/// IRQ Source
Expand All @@ -275,7 +275,7 @@ pub struct MadtIntSrcOverride {
#[derive(Copy, Clone, Debug, FromBytes)]
#[repr(packed)]
pub struct MadtNonMaskableInterrupt {
header: EntryRecord,
_header: EntryRecord,
/// which processor this is for, 0xFF means all processors
pub processor: u8,
/// Flags
Expand All @@ -291,7 +291,7 @@ pub struct MadtNonMaskableInterrupt {
#[derive(Copy, Clone, Debug, FromBytes)]
#[repr(packed)]
pub struct MadtLocalApicAddressOverride {
header: EntryRecord,
_header: EntryRecord,
_reserved: u16,
/// Local APIC physical address
pub phys_addr: u64,
Expand Down
1 change: 1 addition & 0 deletions kernel/acpi/rsdp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const RSDP_SIGNATURE_ALIGNMENT: usize = 16;
/// among other items.
#[derive(Copy, Clone, Debug, FromBytes)]
#[repr(packed)]
#[allow(dead_code)]
pub struct Rsdp {
signature: [u8; 8],
checksum: u8,
Expand Down
8 changes: 4 additions & 4 deletions kernel/ata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ struct AtaBus {
error: PortReadOnly<u8>,
/// The features port, shared with the `error` port.
/// Located at `BAR0 + 1`.
features: PortWriteOnly<u8>,
_features: PortWriteOnly<u8>,
/// The number of sectors to read or write.
/// Located at `BAR0 + 2`.
sector_count: Port<u8>,
Expand Down Expand Up @@ -232,7 +232,7 @@ struct AtaBus {
control: PortWriteOnly<u8>,
/// `DEVADDRESS`, located at `BAR1 + 3`.
/// Not sure what this is used for.
drive_address: Port<u8>,
_drive_address: Port<u8>,
}

impl AtaBus {
Expand All @@ -243,7 +243,7 @@ impl AtaBus {
AtaBus {
data: Port::new(data_bar + 0),
error: PortReadOnly::new(data_bar + 1),
features: PortWriteOnly::new(data_bar + 1),
_features: PortWriteOnly::new(data_bar + 1),
sector_count: Port::new(data_bar + 2),
lba_low: Port::new(data_bar + 3),
lba_mid: Port::new(data_bar + 4),
Expand All @@ -254,7 +254,7 @@ impl AtaBus {

alternate_status: PortReadOnly::new(control_bar + 2),
control: PortWriteOnly::new(control_bar + 2),
drive_address: Port::new(control_bar + 3),
_drive_address: Port::new(control_bar + 3),
}
}

Expand Down
Loading

0 comments on commit be9e9ed

Please sign in to comment.