SimpleOS

LXR

Navigation



Site hébergé par : enix

The LXR Cross Referencer for SOS

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Article:1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 6.5 ] [ 7 ] [ 7.5 ] [ 8 ] [ 9 ] [ 9.5 ]

001 /* Copyright (C) 1999  Free Software Foundation, Inc.
002 
003    This program is free software; you can redistribute it and/or
004    modify it under the terms of the GNU General Public License
005    as published by the Free Software Foundation; either version 2
006    of the License, or (at your option) any later version.
007    
008    This program is distributed in the hope that it will be useful,
009    but WITHOUT ANY WARRANTY; without even the implied warranty of
010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
011    GNU General Public License for more details.
012    
013    You should have received a copy of the GNU General Public License
014    along with this program; if not, write to the Free Software
015    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
016    USA. 
017 */
018 
019         
020 /* The operating system is booted by Grub, so we almost have nothing
021    to do to boot it. We only have to conform to the Multiboot
022    standard, as defined by the Grub documentation */
023         
024 #define ASM 1
025 /* The multiboot.h header contains a lot of multiboot standard
026    definitions */
027 #include "multiboot.h"
028 
029         /* The multiboot header itself. It must come first. */
030 .section ".multiboot"
031         /* Multiboot header must be aligned on a 4-byte boundary */
032         .align 4
033 multiboot_header:
034   /* magic=        */ .long MULTIBOOT_HEADER_MAGIC
035   /* flags=        */ .long MULTIBOOT_HEADER_FLAGS
036   /* checksum=     */ .long -(MULTIBOOT_HEADER_MAGIC \
037                               +MULTIBOOT_HEADER_FLAGS)
038   /* header_addr=  */ .long multiboot_header
039   /* load_addr=    */ .long __b_kernel
040   /* load_end_addr=*/ .long __e_load
041   /* bss_end_addr= */ .long __e_kernel
042   /* entry_addr=   */ .long multiboot_entry
043         
044 /* Here is the beginning of the code of our operating system */
045 .text
046 
047 .globl start, _start
048 start:
049 _start:
050 multiboot_entry:
051         /* Set up a stack */
052         movl $(stack + MULTIBOOT_STACK_SIZE), %ebp
053         movl %ebp, %esp
054 
055         /* Set EFLAGS to 0 */
056         pushl $0
057         /* pop stack into the EFLAGS register */
058         popf
059 
060         /* Push the magic and the address on the stack, so that they
061         will be the parameters of the cmain function */
062         pushl %ebx
063         pushl %eax
064 
065         /* Call the cmain function (os.c) */
066         call EXT_C(sos_main)
067 
068         /* Should never get there */
069 loop:
070         hlt
071         jmp loop
072 
073         /* Here is the stack */
074 .comm   stack, MULTIBOOT_STACK_SIZE

source navigation ] diff markup ] identifier search ] general search ]