Skip to content

Commit cf33ef8

Browse files
authored
Merge pull request #20 from rust-osdev/version-0.2.0
Version 0.2.0
2 parents faa33be + 4bb45a4 commit cf33ef8

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cargo-features = ["publish-lockfile"]
22

33
[package]
44
name = "bootloader"
5-
version = "0.2.0-alpha-005"
5+
version = "0.2.0-beta"
66
authors = ["Philipp Oppermann <[email protected]>"]
77
license = "MIT/Apache-2.0"
88
description = "An experimental pure-Rust x86 bootloader."

src/lib.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#![no_std]
2+
3+
extern crate os_bootinfo;
4+
5+
pub mod bootinfo {
6+
pub use os_bootinfo::*;
7+
}
8+
9+
/// Defines the entry point function.
10+
///
11+
/// The function must have the signature `fn(&'static BootInfo) -> !`.
12+
///
13+
/// This macro just creates a function named `_start`, which the linker will use as the entry
14+
/// point. The advantage of using this macro instead of providing an own `_start` function is
15+
/// that the macro ensures that the function and argument types are correct.
16+
#[macro_export]
17+
macro_rules! entry_point {
18+
($path:path) => {
19+
#[export_name = "_start"]
20+
pub extern "C" fn __impl_start(boot_info: &'static $crate::bootinfo::BootInfo) -> ! {
21+
// validate the signature of the program entry point
22+
let f: fn(&'static $crate::bootinfo::BootInfo) -> ! = $path;
23+
24+
f(boot_info)
25+
}
26+
};
27+
}

src/second_stage.s

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,7 @@ check_cpu:
8181
call check_cpuid
8282
call check_long_mode
8383

84-
disable_irqs:
85-
mov al, 0xFF # Out 0xFF to 0xA1 and 0x21 to disable all IRQs.
86-
out 0xA1, al
87-
out 0x21, al
88-
89-
nop
90-
nop
84+
cli # disable interrupts
9185

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

0 commit comments

Comments
 (0)