Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cargo-features = ["publish-lockfile"]

[package]
name = "bootloader"
version = "0.2.0-alpha-005"
version = "0.2.0-beta"
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
license = "MIT/Apache-2.0"
description = "An experimental pure-Rust x86 bootloader."
Expand Down
27 changes: 27 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#![no_std]

extern crate os_bootinfo;

pub mod bootinfo {
pub use os_bootinfo::*;
}

/// Defines the entry point function.
///
/// The function must have the signature `fn(&'static BootInfo) -> !`.
///
/// This macro just creates a function named `_start`, which the linker will use as the entry
/// point. The advantage of using this macro instead of providing an own `_start` function is
/// that the macro ensures that the function and argument types are correct.
#[macro_export]
macro_rules! entry_point {
($path:path) => {
#[export_name = "_start"]
pub extern "C" fn __impl_start(boot_info: &'static $crate::bootinfo::BootInfo) -> ! {
// validate the signature of the program entry point
let f: fn(&'static $crate::bootinfo::BootInfo) -> ! = $path;

f(boot_info)
}
};
}
8 changes: 1 addition & 7 deletions src/second_stage.s
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,7 @@ check_cpu:
call check_cpuid
call check_long_mode

disable_irqs:
mov al, 0xFF # Out 0xFF to 0xA1 and 0x21 to disable all IRQs.
out 0xA1, al
out 0x21, al

nop
nop
cli # disable interrupts

lidt zero_idt # Load a zero length IDT so that any NMI causes a triple fault.

Expand Down