Skip to content
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

Error with x86_64 #1363

Open
killerbossoriginal opened this issue Nov 24, 2024 · 4 comments
Open

Error with x86_64 #1363

killerbossoriginal opened this issue Nov 24, 2024 · 4 comments

Comments

@killerbossoriginal
Copy link

I'm stuck at "testing" with this error
image

❯ cargo build
    Updating crates.io index
     Locking 5 packages to latest compatible versions
      Adding bit_field v0.10.2
      Adding bitflags v2.6.0
      Adding rustversion v1.0.18
      Adding volatile v0.4.6
      Adding x86_64 v0.14.12 (available: v0.15.1)
   Compiling x86_64 v0.14.12
error[E0053]: method `steps_between` has an incompatible type for trait
   --> /home/killerboss/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x86_64-0.14.12/src/addr.rs:382:51
    |
382 |     fn steps_between(start: &Self, end: &Self) -> Option<usize> {
    |                                                   ^^^^^^^^^^^^^ expected `(usize, Option<usize>)`, found `Option<usize>`
    |
    = note: expected signature `fn(&addr::VirtAddr, &addr::VirtAddr) -> (usize, Option<usize>)`
               found signature `fn(&addr::VirtAddr, &addr::VirtAddr) -> Option<usize>`
help: change the output type to match the trait
    |
382 |     fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
    |                                                   ~~~~~~~~~~~~~~~~~~~~~~

error[E0053]: method `steps_between` has an incompatible type for trait
   --> /home/killerboss/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x86_64-0.14.12/src/structures/paging/page.rs:282:51
    |
282 |     fn steps_between(start: &Self, end: &Self) -> Option<usize> {
    |                                                   ^^^^^^^^^^^^^ expected `(usize, Option<usize>)`, found `Option<usize>`
    |
    = note: expected signature `fn(&Page<_>, &Page<_>) -> (usize, Option<usize>)`
               found signature `fn(&Page<_>, &Page<_>) -> Option<usize>`
help: change the output type to match the trait
    |
282 |     fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
    |                                                   ~~~~~~~~~~~~~~~~~~~~~~

For more information about this error, try `rustc --explain E0053`.
error: could not compile `x86_64` (lib) due to 2 previous errors
@bjorn3
Copy link
Contributor

bjorn3 commented Nov 24, 2024

Duplicate of rust-osdev/bootloader#477

This is caused by rust-osdev/x86_64#512, which will be fixed by rust-osdev/x86_64#513.

@Kartonowy
Copy link

Anyone with this issue following the blog, can replace exit qemu function temporarily with:

use core::arch::asm;

pub fn exit_qemu(exit_code: QemuExitCode) {
    unsafe {
        asm!("out dx, eax", in("dx") 0xf4, in("eax") exit_code as u32, options(nomem, nostack, preserves_flags));
    }
}

and remove the x86_64 from dependencies. Code is pulled directly from x86_64 crate source code and seems to be working fine for me.

This solution is only temporary and should probably be replaced sooner or lates. Should suffice at least until the end of testing chapter.

@Kartonowy
Copy link

it works now, just use 0.15.2

@woile
Copy link

woile commented Dec 14, 2024

I'm still getting an error after updating to 0.15:

error[E0308]: mismatched types
   --> /Users/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x86_64-0.15.2/src/structures/paging/page_table.rs:357:9
    |
356 |     fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
    |                                                   ---------------------- expected `(usize, Option<usize>)` because of return type
357 |         Step::steps_between(&start.0, &end.0)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `(usize, Option<usize>)`, found `Option<usize>`
    |
    = note: expected tuple `(usize, Option<usize>)`
                found enum `Option<usize>`

Version 0.14 throws the following error (which in theory, the fix was backported):

error[E0053]: method `steps_between` has an incompatible type for trait
   --> /Users/x/.cargo/registry/src/index.crates.io-6f17d22bba15001f/x86_64-0.14.13/src/structures/paging/page.rs:284:51
    |
284 |     fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
    |                                                   ^^^^^^^^^^^^^^^^^^^^^^ expected `Option<usize>`, found `(usize, Option<usize>)`
    |
    = note: expected signature `fn(&Page<_>, &Page<_>) -> Option<usize>`
               found signature `fn(&Page<_>, &Page<_>) -> (usize, Option<usize>)`
help: change the output type to match the trait
    |
284 |     fn steps_between(start: &Self, end: &Self) -> Option<usize> {

My other dependencies:

bootloader = "0.9"
volatile = "0.2.6"
spin = "0.5.2"
rustc --version
rustc 1.83.0-nightly (04a318787 2024-09-15)

EDIT

Fixed ✅ running:

rustup update
rustc --version
rustc 1.85.0-nightly (327c7ee43 2024-12-13)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants