Skip to content

bug(just): Just recipes don't gate x86_64 correctly on aarch64 hosts #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamesmunns opened this issue Aug 10, 2023 · 2 comments · Fixed by #226
Closed

bug(just): Just recipes don't gate x86_64 correctly on aarch64 hosts #225

jamesmunns opened this issue Aug 10, 2023 · 2 comments · Fixed by #226
Labels
area: tools & build Related to host developer tools, including tracing, Crowtty and build processes

Comments

@jamesmunns
Copy link
Contributor

Running just check or just clippy fail on x86_64 due to missing imports and inline asm:

cargo clippy --lib --bins --examples --tests --benches --all-features -- -Dwarnings
    Checking sermux-proto v0.1.0 (/Users/james/personal/mnemos/source/sermux-proto)
   Compiling mnemos v0.1.0 (/Users/james/personal/mnemos/source/kernel)
    Checking hal-x86_64 v0.1.0 (https://github.com/hawkw/mycelium#1f125194)
    Checking crowtty v0.1.0 (/Users/james/personal/mnemos/tools/crowtty)
error[E0432]: unresolved import `core::arch::x86_64`
 --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/intrinsics.rs:3:21
  |
3 | pub use core::arch::x86_64::{
  |                     ^^^^^^ could not find `x86_64` in `arch`

error: invalid register `ecx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/msr.rs:278:17
    |
278 |                 in("ecx") self.num,
    |                 ^^^^^^^^^^^^^^^^^^

error: invalid register `eax`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/msr.rs:279:17
    |
279 |                 out("eax") lo,
    |                 ^^^^^^^^^^^^^

error: invalid register `edx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/msr.rs:280:17
    |
280 |                 out("edx") hi,
    |                 ^^^^^^^^^^^^^

error: invalid register `ecx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/msr.rs:301:13
    |
301 |             in("ecx") self.num,
    |             ^^^^^^^^^^^^^^^^^^

error: invalid register `eax`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/msr.rs:302:13
    |
302 |             in("eax") lo,
    |             ^^^^^^^^^^^^

error: invalid register `edx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/msr.rs:303:13
    |
303 |             in("edx") hi,
    |             ^^^^^^^^^^^^

error: invalid register `dx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:119:27
    |
119 |         asm!("in al, dx", in("dx") self.num, out("al") result);
    |                           ^^^^^^^^^^^^^^^^^

error: invalid register `al`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:119:46
    |
119 |         asm!("in al, dx", in("dx") self.num, out("al") result);
    |                                              ^^^^^^^^^^^^^^^^

error: invalid register `dx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:127:28
    |
127 |         asm!("out dx, al", in("dx") self.num, in("al") value)
    |                            ^^^^^^^^^^^^^^^^^

error: invalid register `al`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:127:47
    |
127 |         asm!("out dx, al", in("dx") self.num, in("al") value)
    |                                               ^^^^^^^^^^^^^^

error: invalid register `dx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:135:28
    |
135 |         asm!("in eax, dx", in("dx") self.num, out("eax") result);
    |                            ^^^^^^^^^^^^^^^^^

error: invalid register `eax`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:135:47
    |
135 |         asm!("in eax, dx", in("dx") self.num, out("eax") result);
    |                                               ^^^^^^^^^^^^^^^^^

error: invalid register `dx`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:143:29
    |
143 |         asm!("out dx, eax", in("dx") self.num, in("eax") value)
    |                             ^^^^^^^^^^^^^^^^^

error: invalid register `eax`: unknown register
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu.rs:143:48
    |
143 |         asm!("out dx, eax", in("dx") self.num, in("eax") value)
    |                                                ^^^^^^^^^^^^^^^

error[E0599]: no function or associated item named `new` found for struct `CpuId` in the current scope
  --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/entropy.rs:84:16
   |
84 |         CpuId::new()
   |                ^^^ function or associated item not found in `CpuId`

error[E0599]: no function or associated item named `new` found for struct `CpuId` in the current scope
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/cpu/msr.rs:121:16
    |
121 |         CpuId::new()
    |                ^^^ function or associated item not found in `CpuId`

error[E0599]: no function or associated item named `new` found for struct `CpuId` in the current scope
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt/apic/local.rs:120:28
    |
120 |         let cpuid = CpuId::new();
    |                            ^^^ function or associated item not found in `CpuId`

error[E0599]: no function or associated item named `new` found for struct `CpuId` in the current scope
  --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt/apic.rs:11:12
   |
11 |     CpuId::new()
   |            ^^^ function or associated item not found in `CpuId`

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:370:9
    |
370 | /         extern "x86-interrupt" fn page_fault_isr<H: Handlers<Registers>>(
371 | |             mut registers: Registers,
372 | |             code: PageFaultCode,
373 | |         ) {
    | |_________^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:380:9
    |
380 | /         extern "x86-interrupt" fn double_fault_isr<H: Handlers<Registers>>(
381 | |             mut registers: Registers,
382 | |             code: u64,
383 | |         ) {
    | |_________^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:390:9
    |
390 |         extern "x86-interrupt" fn pit_timer_isr<H: Handlers<Registers>>(_regs: Registers) {
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:412:9
    |
412 |         extern "x86-interrupt" fn apic_timer_isr<H: Handlers<Registers>>(_regs: Registers) {
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:422:9
    |
422 |         extern "x86-interrupt" fn keyboard_isr<H: Handlers<Registers>>(_regs: Registers) {
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:439:9
    |
439 |         extern "x86-interrupt" fn test_isr<H: Handlers<Registers>>(mut registers: Registers) {
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:446:9
    |
446 | /         extern "x86-interrupt" fn invalid_tss_isr<H: Handlers<Registers>>(
447 | |             mut registers: Registers,
448 | |             code: u64,
449 | |         ) {
    | |_________^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:471:9
    |
471 | /         extern "x86-interrupt" fn segment_not_present_isr<H: Handlers<Registers>>(
472 | |             mut registers: Registers,
473 | |             code: u64,
474 | |         ) {
    | |_________^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:496:9
    |
496 | /         extern "x86-interrupt" fn stack_segment_isr<H: Handlers<Registers>>(
497 | |             mut registers: Registers,
498 | |             code: u64,
499 | |         ) {
    | |_________^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:521:9
    |
521 | /         extern "x86-interrupt" fn gpf_isr<H: Handlers<Registers>>(
522 | |             mut registers: Registers,
523 | |             code: u64,
524 | |         ) {
    | |_________^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:552:9
    |
552 |         extern "x86-interrupt" fn spurious_isr() {
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:345:17
    |
345 |                   extern "x86-interrupt" fn $name<H: Handlers<Registers>>(mut registers: Registers) {
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
560 | /         gen_code_faults! {
561 | |             self, H,
562 | |             Self::DIVIDE_BY_ZERO => fn div_0_isr("Divide-By-Zero (0x0)"),
563 | |             Self::OVERFLOW => fn overflow_isr("Overflow (0x4)"),
...   |
569 | |             Self::X87_FPU_EXCEPTION => fn x87_exn_isr("x87 Floating-Point Exception (0x10)"),
570 | |         }
    | |_________- in this macro invocation
    |
    = note: this error originates in the macro `gen_code_faults` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target
   --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/interrupt.rs:354:17
    |
354 | /                 extern "x86-interrupt" fn $name<H: Handlers<Registers>>(
355 | |                     mut registers: Registers,
356 | |                     code: u64,
357 | |                 ) {
    | |_________________^
...
560 | /         gen_code_faults! {
561 | |             self, H,
562 | |             Self::DIVIDE_BY_ZERO => fn div_0_isr("Divide-By-Zero (0x0)"),
563 | |             Self::OVERFLOW => fn overflow_isr("Overflow (0x4)"),
...   |
569 | |             Self::X87_FPU_EXCEPTION => fn x87_exn_isr("x87 Floating-Point Exception (0x10)"),
570 | |         }
    | |_________- in this macro invocation
    |
    = note: this error originates in the macro `gen_code_faults` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no function or associated item named `new` found for struct `CpuId` in the current scope
 --> /Users/james/.cargo/git/checkouts/mycelium-fb863cdaca369b67/1f12519/hal-x86_64/src/time/tsc.rs:9:16
  |
9 |         CpuId::new()
  |                ^^^ function or associated item not found in `CpuId`

Some errors have detailed explanations: E0432, E0570, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `hal-x86_64` (lib) due to 39 previous errors
warning: build failed, waiting for other jobs to finish...
error: Recipe `clippy` failed on line 64 with exit code 101
@jamesmunns jamesmunns added the area: tools & build Related to host developer tools, including tracing, Crowtty and build processes label Aug 10, 2023
@hawkw
Copy link
Contributor

hawkw commented Aug 10, 2023

we probably need forced-target = "x86_64-unknown-none" in the mnemos-x86_64-core crate's Cargo.toml, if it isn't already.

@hawkw
Copy link
Contributor

hawkw commented Aug 11, 2023

Ugh, unfortunately, it seems like any crate that has a forced-target cannot currently be in the workspace's default-members (which are checked/built with a bare cargo check without a -p), since they result in core/alloc not being present when checking the whole workspace. Because we can't solve this using build-std (see rust-lang/cargo#9451 and rust-lang/cargo#8733), it seems like we probably need to remove the x86_64 target from default-members for now...

hawkw added a commit that referenced this issue Aug 11, 2023
This should result in it no longer breaking the build on non-x86_64
build host platforms. Unfortunately, it also means we need to remove the
 `mnemos-x86_64-core` crate from the workspace's `default-members`. See:
 #225 (comment)

Fixes #225 (I hope; @jamesmunns, can you check this on your M1 mac?)
jamesmunns added a commit that referenced this issue Aug 12, 2023
This should result in it no longer breaking the build on non-x86_64
build host platforms. Unfortunately, it also means we need to remove the
 `mnemos-x86_64-core` crate from the workspace's `default-members`. See:
 #225 (comment)

Fixes #225

---------

Co-authored-by: James Munns <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: tools & build Related to host developer tools, including tracing, Crowtty and build processes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants