00001 /*********************************************************** 00002 *PANALIX 0.06, (c) Adrian Panasiuk 2002,3 * 00003 *adek336[at]o2.pl, panalix.prv.pl * 00004 *under GPLv3 license * 00005 * * 00006 *panalix - small osdev project * 00007 ************************************************************ 00008 * crt.s, version 1.2 * 00009 * * 00010 ************************************************************ 00011 * * 00012 *Responsible for initialising paging, and then calling * 00013 *main(). * 00014 * * 00015 * * 00016 *17'04'04- forked from panalix 0.05 branch wrapper.s(1.2) * 00017 * * 00018 ***********************************************************/ 00019 00020 /*----------------------------------------------------------*/ 00021 00022 /*a copy of these is in paging.s i core.lnk*/ 00023 .set virt_addr, 0xC0000000 /*Virtual adress for the kernel*/ /*3Gb*/ 00024 .set lma_addr, 0x100000 /*Physical address where the kernel was loaded*/ /*1Mb*/ 00025 .set CRT_STACK_SZ, 0x11000 /* 0x10000 (64kib) + 0x1000 (stackguard) for the kernel's stack. */ 00026 00027 .text 00028 .globl CRT_STACK 00029 .globl CRT_STACK_SIZE 00030 00031 /*starting routine*/ 00032 .globl start 00033 /*.extern __die*/ 00034 .globl mb_info 00035 .globl st1 00036 00037 start: 00038 movl $lma_addr, %edx 00039 subl $virt_addr, %edx 00040 addl $mb_info, %edx /*we must sub virt_addr and add lma_addr*/ 00041 mov %ebx, (%edx) /*save the value of the mboot structure*/ 00042 00043 push $after_paging /*push the return address to the routine*/ 00044 jmp __init_paging /*init paging so we can work at 0xC000_0000*/ 00045 after_paging: 00046 mov $CRT_STACK+CRT_STACK_SZ, %esp /*setup stack*/ 00047 00048 call __pre_init 00049 call __init_class 00050 call main 00051 call __done_class 00052 call __post_done 00053 00054 cli 00055 hlt 00056 00057 /*this is the pointer to multiboot_info structure*/ 00058 mb_info: 00059 .int 0 00060 /*----------------------------------------------------------*/ 00061 00062 MULTIBOOT_HEADER: 00063 .align 4 00064 #magic 00065 .int 0x1badb002 00066 #flags #when changing flags, change checksum 00067 .int 0x00000003 #request mem info + page align modules 00068 #chesksum 00069 .int 0xe4524ffb 00070 00071 SIGNATURE: 00072 .ident "\13\10 panalix 0.08, (c) Adrian Panasiuk 2002-5,8. ad.ek336[at]gmail.com, panalix.sourceforge.net. Under GPLv3 license \0" 00073 00074 00075 .data 00076 CRT_STACK_SIZE: .int CRT_STACK_SZ 00077 .bss 00078 .align 0x1000 00079 st1: 00080 .lcomm CRT_STACK, CRT_STACK_SZ 00081 /* setting to a big value and making a infinitive recursive call restarts the system*/ 00082 00083 00084 /*********************************************************** 00085 * * 00086 *panalix 0.06 (c) Adrian Panasiuk 2002,3 * 00087 *adek336[at]o2.pl, panalix.prv.pl * 00088 * * 00089 ***********************************************************/