source: libcaca/trunk/kernel/multiboot.S @ 568

Last change on this file since 568 was 568, checked in by Sam Hocevar, 14 years ago
  • Added glue code to compile libcaca without a libc and build applications as multiboot kernels.
File size: 1.7 KB
Line 
1/* boot.S - bootstrap the kernel */
2/* Copyright (C) 1999  Free Software Foundation, Inc.
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8 
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
17
18#define ASM     1
19#include <multiboot.h>
20       
21        .text
22
23        .code32
24        .globl  start, _start
25
26        /* This entry is not used actually.  */
27start:
28_start:
29        jmp     multiboot_entry
30
31        /* Align 32 bits boundary.  */
32        .align  4
33       
34        /* Multiboot header.  */
35multiboot_header:
36        /* magic */
37        .long   MULTIBOOT_HEADER_MAGIC
38        /* flags */
39        .long   MULTIBOOT_HEADER_FLAGS
40        /* checksum */
41        .long   -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
42        /* header_addr */
43        .long   multiboot_header
44        /* load_addr */
45        .long   _start
46        /* load_end_addr */
47        .long   _edata
48        /* bss_end_addr */
49        .long   _end
50        /* entry_addr */
51        .long   multiboot_entry
52
53multiboot_entry:
54        /* Initialize the stack pointer.  */
55        movl    $(stack + STACK_SIZE), %esp
56
57        /* Reset EFLAGS.  */
58        pushl   $0
59        popf
60
61        /* Push the pointer to the Multiboot information structure.  */
62        pushl   %ebx
63        /* Push the magic value.  */
64        pushl   %eax
65
66        /* Now enter the C main function...  */
67        call    EXT_C(cmain)
68
69loop:   hlt
70        jmp     loop
71
72        /* Our stack area.  */
73        .comm   stack, STACK_SIZE
Note: See TracBrowser for help on using the repository browser.