Skip to content

Commit e3a5773

Browse files
committed
f
1 parent 362e352 commit e3a5773

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

Cargo.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ sbi-rt = "0.0.3"
3333
[target.'cfg(target_arch = "x86_64")'.dependencies]
3434
linux-boot-params = { version = "0.17", optional = true }
3535
multiboot = { version = "0.8", optional = true }
36+
# xen-hvm = { path = "../xen/xen-hvm" }
37+
xen-hvm = { git = "https://github.com/hermit-os/xen.git", branch = "xen-hvm" }
3638
uart_16550 = "0.4"
3739
x86_64 = { version = "0.15", default-features = false, features = ["instructions"] }
3840

@@ -46,7 +48,7 @@ built = { version = "0.8", features = ["git2", "chrono"] }
4648
# FIXME: When target-specific features exist, remove the workaround features.
4749
# https://github.com/rust-lang/cargo/issues/1197
4850
[features]
49-
default = []
51+
default = ["multiboot"]
5052
elf = []
5153
linux = []
5254
multiboot = []

src/arch/x86_64/platform/multiboot/entry.s

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,11 @@
88
.extern loader_start # defined in linker script
99
.extern loader_end
1010

11-
# We use a special name to map this section at the begin of our kernel
12-
# => Multiboot expects its magic number at the beginning of the kernel.
13-
.section .mboot, "a"
14-
15-
# This part MUST be 4 byte aligned, so we solve that issue using '.align 4'.
16-
.align 4
17-
mboot:
18-
# Multiboot macros to make a few lines more readable later
19-
.set MULTIBOOT_PAGE_ALIGN, (1 << 0)
20-
.set MULTIBOOT_MEMORY_INFO, (1 << 1)
21-
.set MULTIBOOT_HEADER_MAGIC, 0x1BADB002
22-
.set MULTIBOOT_HEADER_FLAGS, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
23-
.set MULTIBOOT_CHECKSUM, -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
24-
25-
# This is the GRUB Multiboot header. A boot signature
26-
.4byte MULTIBOOT_HEADER_MAGIC
27-
.4byte MULTIBOOT_HEADER_FLAGS
28-
.4byte MULTIBOOT_CHECKSUM
29-
.4byte 0, 0, 0, 0, 0 # address fields
30-
3111
.section .text
3212
.align 4
3313
.global _start
3414
_start:
15+
mov edi, ebx
3516
cli # avoid any interrupt
3617

3718
# Initialize stack pointer

src/arch/x86_64/platform/multiboot/mod.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use alloc::borrow::ToOwned;
22
use core::ptr::write_bytes;
33
use core::sync::atomic::{AtomicPtr, Ordering};
44
use core::{mem, ptr, slice};
5+
use xen_hvm::start_info::StartInfo;
56

67
use align_address::Align;
78
use hermit_entry::boot_info::{
@@ -18,6 +19,12 @@ use crate::arch::x86_64::physicalmem::PhysAlloc;
1819
use crate::arch::x86_64::{KERNEL_STACK_SIZE, SERIAL_IO_PORT, paging};
1920
use crate::fdt::Fdt;
2021

22+
unsafe extern "C" {
23+
fn _start(start_info: &'static StartInfo) -> !;
24+
}
25+
26+
xen_hvm::phys32_entry!(_start);
27+
2128
unsafe extern "C" {
2229
static mut loader_end: u8;
2330
}
@@ -38,9 +45,13 @@ mod entry {
3845

3946
static MB_INFO: AtomicPtr<MultibootInfo> = AtomicPtr::new(ptr::null_mut());
4047

41-
unsafe extern "C" fn rust_start(mb_info: *mut MultibootInfo) -> ! {
48+
unsafe extern "C" fn rust_start(start_info: &'static StartInfo) -> ! {
4249
crate::log::init();
43-
MB_INFO.store(mb_info, Ordering::Relaxed);
50+
51+
paging::map::<Size4KiB>(0x2000, 0x2000, 1, PageTableFlags::empty());
52+
dbg!(start_info);
53+
loop {}
54+
4455
unsafe {
4556
crate::os::loader_main();
4657
}

xtask/src/build.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ impl Build {
4040
sh.create_dir(dist_object.as_ref().parent().unwrap())?;
4141
sh.copy_file(&build_object, &dist_object)?;
4242

43-
if self.artifact.target == Target::X86_64Multiboot {
44-
eprintln!("Converting object to elf32-i386");
45-
dist_object.convert_to_elf32_i386()?;
46-
}
43+
// if self.artifact.target == Target::X86_64Multiboot {
44+
// eprintln!("Converting object to elf32-i386");
45+
// dist_object.convert_to_elf32_i386()?;
46+
// }
4747

4848
eprintln!("Loader available at {}", dist_object.as_ref().display());
4949
Ok(())

0 commit comments

Comments
 (0)