Skip to content

Commit 2d38e66

Browse files
committed
f
1 parent f3d6337 commit 2d38e66

File tree

5 files changed

+27
-30
lines changed

5 files changed

+27
-30
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

@@ -45,7 +47,7 @@ built = { version = "0.8", features = ["git2", "chrono"] }
4547
# FIXME: When target-specific features exist, remove the workaround features.
4648
# https://github.com/rust-lang/cargo/issues/1197
4749
[features]
48-
default = []
50+
default = ["multiboot"]
4951
elf = []
5052
linux = []
5153
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 & 5 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,11 +45,12 @@ 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) -> ! {
42-
MB_INFO.store(mb_info, Ordering::Relaxed);
43-
unsafe {
44-
crate::os::loader_main();
45-
}
48+
unsafe extern "C" fn rust_start(start_info: &'static StartInfo) -> ! {
49+
paging::map::<Size4KiB>(0x2000, 0x2000, 1, PageTableFlags::empty());
50+
dbg!(start_info);
51+
crate::log::init();
52+
crate::log_built_info();
53+
loop {}
4654
}
4755

4856
struct Mem;

xtask/src/build.rs

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

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

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

0 commit comments

Comments
 (0)