-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
113 additions
and
210 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
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
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,14 @@ | ||
{ | ||
"llvm-target": "i686-unknown-none", | ||
"target-endian": "little", | ||
"target-pointer-width": "32", | ||
"target-c-int-width": "32", | ||
"os": "none", | ||
"arch": "x86", | ||
"data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", | ||
"features": "-mmx,-sse,+soft-float", | ||
"executables": true, | ||
"linker-flavor": "ld.lld", | ||
"linker": "rust-lld", | ||
"panic-strategy": "abort" | ||
} |
This file was deleted.
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 |
---|---|---|
@@ -1,15 +1,7 @@ | ||
// Export our platform-specific modules. | ||
#[cfg(target_arch = "x86_64")] | ||
pub use self::x86_64::{processor, serial}; | ||
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] | ||
pub use self::x86::{processor, serial}; | ||
|
||
// Implementations for x86_64. | ||
#[cfg(target_arch = "x86_64")] | ||
pub mod x86_64; | ||
|
||
// Export our platform-specific modules. | ||
#[cfg(target_arch = "x86")] | ||
pub use self::x86_64::{processor, serial}; | ||
|
||
// Implementations for x86_64. | ||
#[cfg(target_arch = "x86")] | ||
pub mod x86_64; | ||
// Implementations for x86. | ||
#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] | ||
pub mod x86; |
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,53 @@ | ||
# This is the kernel's entry point. We could either call main here, | ||
# or we can use this to setup the stack or other nice stuff, like | ||
# perhaps setting up the GDT and segments. Please note that interrupts | ||
# are disabled at this point: More on interrupts later! | ||
|
||
.code32 | ||
|
||
.set BOOT_STACK_SIZE, 4096 | ||
|
||
# We use a special name to map this section at the begin of our kernel | ||
# => Multiboot expects its magic number at the beginning of the kernel. | ||
.section .mboot, "a" | ||
|
||
# This part MUST be 4 byte aligned, so we solve that issue using '.align 4'. | ||
.align 4 | ||
.global mboot | ||
mboot: | ||
# Multiboot macros to make a few lines more readable later | ||
.set MULTIBOOT_PAGE_ALIGN, (1 << 0) | ||
.set MULTIBOOT_MEMORY_INFO, (1 << 1) | ||
.set MULTIBOOT_HEADER_MAGIC, 0x1BADB002 | ||
.set MULTIBOOT_HEADER_FLAGS, MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | ||
.set MULTIBOOT_CHECKSUM, -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) | ||
|
||
# This is the GRUB Multiboot header. A boot signature | ||
.4byte MULTIBOOT_HEADER_MAGIC | ||
.4byte MULTIBOOT_HEADER_FLAGS | ||
.4byte MULTIBOOT_CHECKSUM | ||
.4byte 0, 0, 0, 0, 0 # address fields | ||
|
||
.section .text | ||
.align 4 | ||
.extern main | ||
.global _start | ||
_start: | ||
cli # avoid any interrupt | ||
|
||
# Initialize stack pointer | ||
mov esp, OFFSET boot_stack | ||
add esp, BOOT_STACK_SIZE - 16 | ||
|
||
call main | ||
# eax has the return value of main | ||
mov dx, 0xf4 # port to shutdown pc | ||
out dx, eax | ||
L0: | ||
jmp L0 | ||
|
||
.section .data | ||
.align 4096 | ||
.global boot_stack | ||
boot_stack: | ||
.fill BOOT_STACK_SIZE, 1, 0xcd |
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,26 @@ | ||
ENTRY(_start) | ||
phys = 0x000000100000; | ||
|
||
SECTIONS | ||
{ | ||
kernel_start = phys; | ||
.mboot phys : AT(ADDR(.mboot)) { | ||
*(.mboot) | ||
} | ||
.text ALIGN(4096) : AT(ADDR(.text)) { | ||
*(.text) | ||
*(.text.*) | ||
} | ||
.rodata ALIGN(4096) : AT(ADDR(.rodata)) { | ||
*(.rodata) | ||
*(.rodata.*) | ||
} | ||
.data ALIGN(4096) : AT(ADDR(.data)) { | ||
*(.data) | ||
*(.data.*) | ||
} | ||
.bss ALIGN(4096) : AT(ADDR(.bss)) { | ||
*(.bss) | ||
*(.bss.*) | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,7 @@ | ||
pub mod processor; | ||
pub mod serial; | ||
#[cfg(target_arch = "x86_64")] | ||
pub mod start; | ||
|
||
#[cfg(target_arch = "x86")] | ||
core::arch::global_asm!(include_str!("entry.s")); |
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
Oops, something went wrong.