mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
35 lines
929 B
NASM
35 lines
929 B
NASM
; Copyright 2016 Philipp Oppermann. See the README.md
|
|
; file at the top-level directory of this distribution.
|
|
;
|
|
; Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
; http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
; <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
; option. This file may not be copied, modified, or distributed
|
|
; except according to those terms.
|
|
|
|
global long_mode_start
|
|
extern rust_main
|
|
|
|
section .text
|
|
bits 64
|
|
long_mode_start:
|
|
; load 0 into all data segment registers
|
|
mov ax, 0
|
|
mov ss, ax
|
|
mov ds, ax
|
|
mov es, ax
|
|
mov fs, ax
|
|
mov gs, ax
|
|
|
|
; call rust main (with multiboot pointer in rdi)
|
|
call rust_main
|
|
.os_returned:
|
|
; rust main returned, print `OS returned!`
|
|
mov rax, 0x4f724f204f534f4f
|
|
mov [0xb8000], rax
|
|
mov rax, 0x4f724f754f744f65
|
|
mov [0xb8008], rax
|
|
mov rax, 0x4f214f644f654f6e
|
|
mov [0xb8010], rax
|
|
hlt
|