2018-03-14 15:08:02 +01:00
|
|
|
; Copyright (C) 2018 Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
|
|
|
; Author: Ortega Froysa, Nicolás <nortega@themusicinnoise.net>
|
|
|
|
;
|
|
|
|
; This program is free software: you can redistribute it and/or modify
|
|
|
|
; it under the terms of the GNU General Public License as published by
|
|
|
|
; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
; (at your option) any later version.
|
|
|
|
;
|
|
|
|
; This program is distributed in the hope that it will be useful,
|
|
|
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
; GNU General Public License for more details.
|
|
|
|
;
|
|
|
|
; You should have received a copy of the GNU General Public License
|
|
|
|
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
MBALIGN equ 1<<0 ; align loaded modules on page boundaries
|
|
|
|
MEMINFO equ 1<<1 ; provide memory map
|
|
|
|
FLAGS equ MBALIGN | MEMINFO ; multiboot flag field
|
|
|
|
MAGIC equ 0x1BADB002 ; magic number to help bootloader find the header
|
|
|
|
CHECKSUM equ -(MAGIC + FLAGS) ; checksum of the above data
|
|
|
|
|
|
|
|
section .multiboot
|
|
|
|
align 4
|
|
|
|
dd MAGIC
|
|
|
|
dd FLAGS
|
|
|
|
dd CHECKSUM
|
|
|
|
|
|
|
|
section .bss
|
|
|
|
align 16
|
2018-03-08 16:53:29 +01:00
|
|
|
stack_bottom:
|
2018-03-14 15:08:02 +01:00
|
|
|
resb 16384 ; 16KiB
|
2018-03-08 16:53:29 +01:00
|
|
|
stack_top:
|
|
|
|
|
2018-03-14 15:08:02 +01:00
|
|
|
section .text
|
|
|
|
global _start:function (_start.end - _start)
|
2018-03-08 16:53:29 +01:00
|
|
|
_start:
|
2018-03-14 15:08:02 +01:00
|
|
|
; setup the stack
|
|
|
|
mov esp, stack_top
|
2018-03-08 16:53:29 +01:00
|
|
|
|
2018-03-14 15:08:02 +01:00
|
|
|
; call the kernel
|
|
|
|
extern kernel_main
|
2018-03-08 16:53:29 +01:00
|
|
|
call kernel_main
|
|
|
|
|
2018-03-14 15:08:02 +01:00
|
|
|
; hang
|
|
|
|
cli
|
|
|
|
.hang:
|
|
|
|
hlt
|
|
|
|
jmp .hang
|
|
|
|
.end:
|