- Main Page
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# start.S

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: start_8S-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 .globl _start
    00031 .text
    00032 .code32
    00033 _start:
    00034   movw  $0x1234,0x472
    00035   pushl %ebp
    00036   movl  %esp,%ebp
    00037   pushl $0x00000002
    00038   popfl
    00039   /* Clear the BSS */
    00040   movl  $(_end),%ecx
    00041   movl  $(__bss_start),%edi
    00042   subl  %edi,%ecx
    00043   xorl  %eax,%eax
    00044   cld
    00045   rep
    00046   stosb
    00047
    00048   /* Load GDT */
    00049   lgdtl (loadGDT)
    00050   mov   $0x10,%eax
    00051   mov   %eax,%ds
    00052   mov   %eax,%es
    00053   mov   %eax,%fs
    00054   mov   %eax,%gs
    00055   mov   %eax,%ss
    00056   mov   $kStack,%eax
    00057   addl  $0x2000,%eax
    00058   mov   %esp,%edx
    00059   mov   %eax,%esp
    00060   mov   %eax,%ebp
    00061   mov   $0x18,%ax
    00062   lldt  %ax
    00063   mov   $0x20,%ax
    00064   ltr   %ax
    00065   ljmp  $0x08,$start_next
    00066 start_next:
    00067   push 8(%edx)
    00068   call kmain
    00069
    00070 .data
    00071 .comm kStack,0x2000
    00072
    00073 /***
    00074  END
    00075  ***/