Skip to content

Commit

Permalink
Work around rust-lang/rust#101071
Browse files Browse the repository at this point in the history
  • Loading branch information
kennystrawnmusic committed Aug 27, 2022
1 parent bd84f2a commit cfb6f61
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[alias]
bin = "build --target x86_64-unknown-uefi -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem --release"
kcheck = "check --target x86_64-unknown-uefi -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem --release --message-format=json"
kernel-asm = "rustc --target x86_64-unknown-uefi -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem --release -- --emit=asm -o target/x86_64-unknown-uefi/release/cryptos.S"
bin = "build --target x86_64-unknown-uefi-101071-workaround.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem --release"
kcheck = "check --target x86_64-unknown-uefi-101071-workaround.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem --release --message-format=json"
kernel-asm = "rustc --target x86_64-unknown-uefi-101071-workaround.json -Zbuild-std=core,alloc -Zbuild-std-features=compiler-builtins-mem --release -- --emit=asm -o target/x86_64-unknown-uefi/release/cryptos.S"
boot = "run --package imager --"
run-efi = "boot --uefi"
debug-efi = "boot --uefi-debug"
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"rust-analyzer.cargo.target": "x86_64-unknown-uefi",
"rust-analyzer.cargo.target": "x86_64-unknown-uefi-101071-workaround.json",
"rust-analyzer.server.extraEnv": {
"CARGO": "/opt/rust/bin/cargo",
"RUSTC": "/opt/rust/bin/rustc"
Expand Down
2 changes: 1 addition & 1 deletion src/cralloc/frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl Falloc {

pub fn usable(&self) -> impl Iterator<Item = PhysFrame> + '_ {
let all = self.map.iter();
let usable = all.filter(|r| r.kind == MemoryRegionKind::Usable || MemoryRegionKind::Kernel);
let usable = all.filter(|r| r.kind == MemoryRegionKind::Usable || r.kind == MemoryRegionKind::Kernel);

let ranges = usable.map(|r| r.begin..r.end);
let faddrs = ranges.flat_map(|r| r.step_by(4096));
Expand Down
2 changes: 1 addition & 1 deletion src/cralloc/uefi_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ where
}

while let Some(d) = self.map.next() {
if d.kind() != MemoryRegionKind::Usable || MemoryRegionKind::Kernel {
if d.kind() != MemoryRegionKind::Usable || d.kind() != MemoryRegionKind::Kernel {
continue;
}
if let Some(f) = self.alloc_from_region(d) {
Expand Down
2 changes: 1 addition & 1 deletion src/hmfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub fn time_t_from_uefi(table: &SystemTable<Runtime>) -> time_t {
};

let offset_time = Time::new(offset_params).unwrap();
let current_time = table.runtime_services().get_time().unwrap();
let current_time = unsafe { table.runtime_services() }.get_time().unwrap();

let mut converted: time_t = 0;

Expand Down
43 changes: 43 additions & 0 deletions x86_64-unknown-uefi-101071-workaround.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"abi-return-struct-as-int": true,
"allows-weak-linkage": false,
"arch": "x86_64",
"cpu": "x86-64",
"data-layout": "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"debuginfo-kind": "pdb",
"disable-redzone": true,
"emit-debug-gdb-scripts": false,
"exe-suffix": ".efi",
"features": "-mmx,-sse,+soft-float",
"is-like-msvc": true,
"is-like-windows": true,
"linker": "rust-lld",
"linker-flavor": "lld-link",
"linker-is-gnu": false,
"lld-flavor": "link",
"llvm-target": "x86_64-unknown-windows",
"max-atomic-width": 64,
"os": "uefi",
"panic-strategy": "abort",
"pre-link-args": {
"lld-link": [
"/NOLOGO",
"/entry:efi_main",
"/subsystem:efi_application"
],
"msvc": [
"/NOLOGO",
"/entry:efi_main",
"/subsystem:efi_application"
]
},
"singlethread": true,
"split-debuginfo": "packed",
"stack-probes": {
"kind": "call"
},
"supported-split-debuginfo": [
"packed"
],
"target-pointer-width": "64"
}

0 comments on commit cfb6f61

Please sign in to comment.