]>
Commit | Line | Data |
---|---|---|
0731742a XL |
1 | // This defines the amd64 target for UEFI systems as described in the UEFI specification. See the |
2 | // uefi-base module for generic UEFI options. On x86_64 systems (mostly called "x64" in the spec) | |
3 | // UEFI systems always run in long-mode, have the interrupt-controller pre-configured and force a | |
4 | // single-CPU execution. | |
5 | // The win64 ABI is used. It differs from the sysv64 ABI, so we must use a windows target with | |
6 | // LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features. | |
7 | ||
781aab86 | 8 | use crate::{abi::call::Conv, spec::Target}; |
0731742a | 9 | |
29967ef6 | 10 | pub fn target() -> Target { |
ba9703b0 | 11 | let mut base = super::uefi_msvc_base::opts(); |
5e7ed085 | 12 | base.cpu = "x86-64".into(); |
fe692bf9 | 13 | base.plt_by_default = false; |
0731742a | 14 | base.max_atomic_width = Some(64); |
781aab86 | 15 | base.entry_abi = Conv::X86_64Win64; |
0731742a | 16 | |
9fa01778 XL |
17 | // We disable MMX and SSE for now, even though UEFI allows using them. Problem is, you have to |
18 | // enable these CPU features explicitly before their first use, otherwise their instructions | |
19 | // will trigger an exception. Rust does not inject any code that enables AVX/MMX/SSE | |
20 | // instruction sets, so this must be done by the firmware. However, existing firmware is known | |
21 | // to leave these uninitialized, thus triggering exceptions if we make use of them. Which is | |
22 | // why we avoid them and instead use soft-floats. This is also what GRUB and friends did so | |
23 | // far. | |
136023e0 | 24 | // |
9fa01778 XL |
25 | // If you initialize FP units yourself, you can override these flags with custom linker |
26 | // arguments, thus giving you access to full MMX/SSE acceleration. | |
5e7ed085 | 27 | base.features = "-mmx,-sse,+soft-float".into(); |
0731742a | 28 | |
29967ef6 | 29 | Target { |
5e7ed085 | 30 | llvm_target: "x86_64-unknown-windows".into(), |
29967ef6 | 31 | pointer_width: 64, |
dfeec247 | 32 | data_layout: "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
5e7ed085 FG |
33 | .into(), |
34 | arch: "x86_64".into(), | |
0731742a XL |
35 | |
36 | options: base, | |
29967ef6 | 37 | } |
0731742a | 38 | } |