Compile successfully on i686 as well.

This commit is contained in:
4lDO2
2023-09-16 10:48:25 +02:00
parent 0b9c5bbf49
commit 5eace9997a
3 changed files with 14 additions and 6 deletions
+8 -5
View File
@@ -4,7 +4,7 @@ use std::env;
use std::path::Path;
use std::process::Command;
fn parse_kconfig(arch: &str) {
fn parse_kconfig(arch: &str) -> Option<()> {
println!("cargo:rerun-if-changed=config.toml");
assert!(Path::new("config.toml.example").try_exists().unwrap());
@@ -13,9 +13,10 @@ fn parse_kconfig(arch: &str) {
}
let config_str = std::fs::read_to_string("config.toml").unwrap();
let root: Table = toml::from_str(&config_str).unwrap();
let altfeatures = root.get("arch").unwrap().as_table().unwrap()
.get(arch).unwrap().as_table().unwrap()
.get("features").unwrap().as_table().unwrap();
let altfeatures = root.get("arch")?.as_table().unwrap()
.get(arch)?.as_table().unwrap()
.get("features")?.as_table().unwrap();
for (name, value) in altfeatures {
let choice = value.as_str().unwrap();
@@ -23,6 +24,8 @@ fn parse_kconfig(arch: &str) {
println!("cargo:rustc-cfg=cpu_feature_{choice}=\"{name}\"");
}
Some(())
}
fn main() {
@@ -72,5 +75,5 @@ fn main() {
_ => (),
}
parse_kconfig(arch_str);
let _ = parse_kconfig(arch_str);
}
+6
View File
@@ -86,3 +86,9 @@ pub unsafe extern "fastcall" fn arch_copy_to_user_inner(len: usize, dst: usize,
pub unsafe fn bootstrap_mem(bootstrap: &Bootstrap) -> &'static [u8] {
core::slice::from_raw_parts(CurrentRmmArch::phys_to_virt(bootstrap.base.start_address()).data() as *const u8, bootstrap.page_count * PAGE_SIZE)
}
pub const KFX_SIZE: usize = 512;
// This function exists as the KFX size is dynamic on x86_64.
pub fn kfx_size() -> usize {
KFX_SIZE
}
-1
View File
@@ -20,7 +20,6 @@ pub static CONTEXT_SWITCH_LOCK: AtomicBool = AtomicBool::new(false);
const ST_RESERVED: u128 = 0xFFFF_FFFF_FFFF_0000_0000_0000_0000_0000;
pub const KFX_SIZE: usize = 512;
pub const KFX_ALIGN: usize = 16;
#[derive(Clone, Debug)]