-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
53: Updates for new build system r=phil-opp a=phil-opp Update the documentation for the new build system and add an `example-kernel` that provides an easy way to try the `bootloader`. Builds upon #51. Co-authored-by: Philipp Oppermann <dev@phil-opp.com>
- Loading branch information
Showing
12 changed files
with
201 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
target = "x86_64-example-kernel.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nightly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
target = "x86_64-test-kernel.json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target/ | ||
**/*.rs.bk |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "test-kernel" | ||
version = "0.1.0" | ||
authors = ["Philipp Oppermann <dev@phil-opp.com>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
x86_64 = "0.3.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#![no_std] // don't link the Rust standard library | ||
#![no_main] // disable all Rust-level entry points | ||
|
||
use core::panic::PanicInfo; | ||
|
||
/// This function is called on panic. | ||
#[panic_handler] | ||
fn panic(_info: &PanicInfo) -> ! { | ||
loop {} | ||
} | ||
|
||
#[no_mangle] // don't mangle the name of this function | ||
pub extern "C" fn _start() -> ! { | ||
// this function is the entry point, since the linker looks for a function | ||
// named `_start` by default | ||
|
||
// exit QEMU (see https://os.phil-opp.com/integration-tests/#shutting-down-qemu) | ||
unsafe { exit_qemu(); } | ||
|
||
loop {} | ||
} | ||
|
||
pub unsafe fn exit_qemu() { | ||
use x86_64::instructions::port::Port; | ||
|
||
let mut port = Port::<u32>::new(0xf4); | ||
port.write(61); // exit code is (61 << 1) | 1 = 123 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"llvm-target": "x86_64-unknown-none", | ||
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", | ||
"arch": "x86_64", | ||
"target-endian": "little", | ||
"target-pointer-width": "64", | ||
"target-c-int-width": "32", | ||
"os": "none", | ||
"executables": true, | ||
"linker-flavor": "ld.lld", | ||
"linker": "rust-lld", | ||
"panic-strategy": "abort", | ||
"disable-redzone": true, | ||
"features": "-mmx,-sse,+soft-float" | ||
} |