mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
@@ -13,7 +13,7 @@
|
|||||||
; limitations under the License.
|
; limitations under the License.
|
||||||
|
|
||||||
global long_mode_start
|
global long_mode_start
|
||||||
extern main
|
extern rust_main
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
bits 64
|
bits 64
|
||||||
@@ -21,7 +21,7 @@ long_mode_start:
|
|||||||
call setup_SSE
|
call setup_SSE
|
||||||
|
|
||||||
; call rust main
|
; call rust main
|
||||||
call main
|
call rust_main
|
||||||
.os_returned:
|
.os_returned:
|
||||||
; rust main returned, print `OS returned!`
|
; rust main returned, print `OS returned!`
|
||||||
mov rax, 0x4f724f204f534f4f
|
mov rax, 0x4f724f204f534f4f
|
||||||
|
|||||||
11
src/lib.rs
11
src/lib.rs
@@ -21,7 +21,7 @@ extern crate rlibc;
|
|||||||
use core::intrinsics::offset;
|
use core::intrinsics::offset;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn main() {
|
pub extern fn rust_main() {
|
||||||
// ATTENTION: we have a very small stack and no guard page
|
// ATTENTION: we have a very small stack and no guard page
|
||||||
let x = ["Hello", " ", "World", "!"];
|
let x = ["Hello", " ", "World", "!"];
|
||||||
let screen_pointer = 0xb8000 as *const u16;
|
let screen_pointer = 0xb8000 as *const u16;
|
||||||
@@ -37,5 +37,10 @@ pub extern fn main() {
|
|||||||
loop{}
|
loop{}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[lang = "eh_personality"] extern fn eh_personality() {}
|
#[cfg(not(test))]
|
||||||
#[lang = "panic_fmt"] extern fn panic_fmt() -> ! {loop{}}
|
#[lang = "eh_personality"]
|
||||||
|
extern fn eh_personality() {}
|
||||||
|
|
||||||
|
#[cfg(not(test))]
|
||||||
|
#[lang = "panic_fmt"]
|
||||||
|
extern fn panic_fmt() -> ! {loop{}}
|
||||||
|
|||||||
Reference in New Issue
Block a user