1
0
aedrix-kernel/arch/i386/start.S

57 lines
2.1 KiB
ArmAsm

/*
Copyright (C) 2012, Aaron Lindsay <aaron@aclindsay.com>
This file is part of Aedrix.
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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
.global start /* making entry point visible to linker */
/* setting up the Multiboot header - see GRUB docs for details */
.set ALIGN, 1<<0 /* align loaded modules on page boundaries */
.set MEMINFO, 1<<1 /* provide memory map */
.set FLAGS, ALIGN | MEMINFO /* this is the Multiboot 'flag' field */
.set MAGIC, 0x1BADB002 /* 'magic number' lets bootloader find the header */
.set CHECKSUM, -(MAGIC + FLAGS) /* checksum required */
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
/* reserve initial kernel stack space */
.set STACKSIZE, 0x4000 /* that is, 16k. */
.align 32
.lcomm stack, STACKSIZE /* reserve 16k stack on a doubleword boundary */
.comm mbd, 4 /* we will use this in i386_main */
.comm magic, 4 /* we will use this in i386_main */
start:
movl $(stack + STACKSIZE), %esp /* set up the stack */
movl %eax, magic /* Multiboot magic number */
movl %ebx, mbd /* Multiboot data structure */
call i386_main /* call kernel proper */
cli
hang:
hlt /* halt machine should kernel return */
jmp hang
.globl atags_ptr
atags_ptr:
.word 0