From 09b2569c83112dd121b50c7b45a30f338eb39f22 Mon Sep 17 00:00:00 2001 From: Tim Satke <48135919+tsatke@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:47:00 +0100 Subject: [PATCH 1/6] Update i686-stage-3.json adapt data-layout to match LLVM's --- i686-stage-3.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i686-stage-3.json b/i686-stage-3.json index 10e6d4b5..c89fac10 100644 --- a/i686-stage-3.json +++ b/i686-stage-3.json @@ -1,7 +1,7 @@ { "arch": "x86", "cpu": "i386", - "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", "dynamic-linking": false, "executables": true, "linker-flavor": "ld.lld", From d7d3ef1caec84f18be98f9fe60d3ab5c0fbb29be Mon Sep 17 00:00:00 2001 From: Tim Satke <48135919+tsatke@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:48:46 +0100 Subject: [PATCH 2/6] Update i386-code16-boot-sector.json --- i386-code16-boot-sector.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i386-code16-boot-sector.json b/i386-code16-boot-sector.json index f5ed774e..3a51b364 100644 --- a/i386-code16-boot-sector.json +++ b/i386-code16-boot-sector.json @@ -1,7 +1,7 @@ { "arch": "x86", "cpu": "i386", - "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", "dynamic-linking": false, "executables": true, "linker-flavor": "ld.lld", From a2427a5252d536d487f54e27b72f6ee79b1e1455 Mon Sep 17 00:00:00 2001 From: Tim Satke <48135919+tsatke@users.noreply.github.com> Date: Wed, 14 Feb 2024 08:49:23 +0100 Subject: [PATCH 3/6] Update i386-code16-stage-2.json --- i386-code16-stage-2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i386-code16-stage-2.json b/i386-code16-stage-2.json index f5ed774e..3a51b364 100644 --- a/i386-code16-stage-2.json +++ b/i386-code16-stage-2.json @@ -1,7 +1,7 @@ { "arch": "x86", "cpu": "i386", - "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128", + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", "dynamic-linking": false, "executables": true, "linker-flavor": "ld.lld", From 090f0309fb41c2ff19b1a79b5567cecc3ca084df Mon Sep 17 00:00:00 2001 From: tsatke Date: Wed, 14 Feb 2024 08:55:51 +0100 Subject: [PATCH 4/6] update data-layout for stage 4 --- x86_64-stage-4.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86_64-stage-4.json b/x86_64-stage-4.json index 976fd56d..026d23f9 100644 --- a/x86_64-stage-4.json +++ b/x86_64-stage-4.json @@ -2,7 +2,7 @@ "arch": "x86_64", "code-model": "kernel", "cpu": "x86-64", - "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-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "disable-redzone": true, "features": "-mmx,-sse,-sse2,-sse3,-ssse3,-sse4.1,-sse4.2,-3dnow,-3dnowa,-avx,-avx2,+soft-float", "linker": "rust-lld", From 8f5bd4e91ad54f6ebc2c55219eaeeb56f57b9e71 Mon Sep 17 00:00:00 2001 From: tsatke Date: Thu, 15 Feb 2024 16:28:33 +0100 Subject: [PATCH 5/6] attempt workaround by Freax13 --- bios/stage-4/src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/bios/stage-4/src/main.rs b/bios/stage-4/src/main.rs index 9ade45f8..439b1fec 100644 --- a/bios/stage-4/src/main.rs +++ b/bios/stage-4/src/main.rs @@ -262,6 +262,7 @@ fn detect_rsdp() -> Option { #[derive(Clone)] struct IdentityMapped; impl AcpiHandler for IdentityMapped { + #[inline(never)] unsafe fn map_physical_region( &self, physical_address: usize, From 2ebe7899eb0e6e565c49840d8d2c5e66a7cfacee Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 16 Feb 2024 16:22:03 +0100 Subject: [PATCH 6/6] Add a FIXME comment to the `inline(never)` and link to the GitHub issue --- bios/stage-4/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bios/stage-4/src/main.rs b/bios/stage-4/src/main.rs index 439b1fec..cf159a61 100644 --- a/bios/stage-4/src/main.rs +++ b/bios/stage-4/src/main.rs @@ -262,6 +262,9 @@ fn detect_rsdp() -> Option { #[derive(Clone)] struct IdentityMapped; impl AcpiHandler for IdentityMapped { + // TODO FIXME: This inline(never) annotation is required. Without it, + // LLVM replaces the `search_for_on_bios` call below with a `ud2` + // instruction. See https://github.com/rust-osdev/bootloader/issues/425 #[inline(never)] unsafe fn map_physical_region( &self,