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 ]

Diff markup

Differences between /bootstrap/multiboot.S (Article 7) and /bootstrap/multiboot.S (Article 9.5)


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

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