Skip to content

PageAlreadyMapped: Failed to load code #1400

Open
@abrassel

Description

@abrassel

I have the following program:

#![no_std]
#![no_main]

use core::panic::PanicInfo;

static HELLO: &[u8] = b"Hello World!";

#[panic_handler]
fn panic(_: &PanicInfo) -> ! {
    loop {}
}

#[no_mangle]
pub extern "C" fn _start() -> ! {
    let vga_buffer = 0xb8000 as *mut u8;
    for (i, &byte) in HELLO.iter().enumerate() {
        unsafe {
            *vga_buffer.offset(i as isize * 2) = byte;
            *vga_buffer.offset(i as isize * 2 + 1) = 0xb;
        }
    }

    loop {}
}

I run it with

qemu-system-x86_64 -drive format=raw,file=target
/x86_64-blog-os/debug/bootimage-phil-os.bi

and get the following error:

Image

Failed to map page... PageAlreadyMapped

From looking around, it seems like this error is related to having two "main" functions. But I don't think that that is the case for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions