C++ kernel, increasing KSIZE in the bootloader crash the os
Posted: Tue May 27, 2008 10:03 am
Hello, we are two student who make a C++ kernel.
We have already make Threads, New / Delete, STL integration ...
When we want to add more code, we need to increase the KSIZE variable in our bootsect.asm.
This is the code
our kernel size is 22658 Ko
any idea ? :/
We have already make Threads, New / Delete, STL integration ...
When we want to add more code, we need to increase the KSIZE variable in our bootsect.asm.
This is the code
Code: Select all
%define CS_ACCES 10011011b
%define DS_ACCES 10010011b
%define BASE 0x100
%define KSIZE 44
[BITS 16]
[ORG 0x0]
jmp start
%include "GDT.INC"
start:
mov [bootdrv],dl ; recuparation de l'unite de boot
; initialisation des segments en 0x07C0
mov ax,0x07C0
mov ds,ax
mov es,ax
mov ax,0x8000 ; stack en 0xFFFF
mov ss,ax
mov sp, 0xf000
; charger le noyau
xor ax,ax
int 0x13
push es
mov ax,BASE
mov es,ax
mov bx,0
mov ah,2
mov al,KSIZE
mov ch,0
mov cl,2
mov dh,0
mov dl,[bootdrv]
int 0x13
pop es
; initialisation de la GDT
; descInit base(32),limite(20/32),acces(8),flags(4/8),adresse(16)
descInit 0,0xFFFFF,CS_ACCES,1101b,gdt_cs
descInit 0,0xFFFFF,DS_ACCES,1101b,gdt_ds
; initialisation du pointeur sur la GDT
mov ax,gdtend ; calcule la limite de GDT
mov bx,gdt
sub ax,bx
mov word [gdtptr],ax
xor eax,eax ; calcule l'adresse lineaire de GDT
mov ax,ds
mov bx,gdt
call calcadr
mov dword [gdtptr+2],ecx
; passage en modep
cli
lgdt [gdtptr] ; charge la gdt
mov eax,cr0
or ax,1
mov cr0,eax ; PE mis a 1 (CR0)
jmp next
next:
mov ax,0x10 ; segment de donne
mov ds,ax
mov fs,ax
mov gs,ax
mov es,ax
mov ss,ax
mov esp,0x9F000
jmp dword 0x8:0x1000
end:
jmp end
gdt:
gdt_null:
dw 0,0,0,0
gdt_cs:
dw 0,0,0,0
gdt_ds:
dw 0,0,0,0
gdtend:
gdtptr:
dw 0x0000 ; limite
dd 0 ; base
bootdrv: db 0
;--------------------------------------------------------------------
;; NOP jusqu'a 510
times 510-($-$$) db 144
dw 0xAA55
our kernel size is 22658 Ko
any idea ? :/