Stack problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
T.S.

Stack problem

Post by T.S. »

T.S.

RE:Stack problem

Post by T.S. »

what must i change that i can call functions:
T.S.

RE:Stack problem

Post by T.S. »

what must i change that i can call functions:


[BITS 16]
[org 0x0]

jmp start
nop
;******************************RESET UND

LOAD**************************
reset:
push ds
mov ax, 0
mov dl, [bootdrv]
int 13h
pop ds
jc reset

load:
mov ax, 0x1000
mov es, ax
mov bx, 0
mov ah, 2
mov al, 20 ;sektoren
mov cx, 2
mov dx, 0
int 13h
jc load
retn
;*********************************MESSAGE********************

**********
message:
lodsb
or al,al
jz done
mov ah,0eh
mov bx,0007
int 0x10
jmp message
done:
ret

;*********************************DATEN***********************

***********
bootdrv db 0

loadmsg db 'Loading kernel',13,10,0
jumpmsg db 'Jumping to kernel',13,10,0
pmodemsg db 'Entering PMode',13,10,0

gdt:
length dw gdtlength
base dd gdt_table + 0x7C00
;***************************************************************

************
start:
mov ax, 0x7c0
mov ds, ax
cli
mov ax, 0x9000
mov ss, ax
mov sp, 0xffff
sti

mov [bootdrv], dl
.386
mov si, loadmsg
call message
call load

lgdt [ds:gdt]
mov si, pmodemsg
call message
mov si, jumpmsg
call message
cli
mov eax, cr0
or eax, 1
mov cr0, eax
mov eax, 98000h
mov esp, eax


jmp DWORD 0x10:0x10000


;***************************************************************

*******;
gdt_table:

null_desc:
dw 0
dw 0
db 0
db 00000000b
db 00000000b
db 0

huge_desc_data:
dw 0xFFFF
dw 0000h
db 00h
db 10010010b
db 11001111b
db 00h

huge_desc_code:
dw 0xFFFF
dw 0000h
db 00h
db 10011010b
db 11000000b
db 00h

stack_desc:
dw 0xFFFF
dw 0x0000
db 10h
db 10010110b
db 11000000b
db 00h

;***************************************************************

*****;

gdtlength equ $ -gdt_table -1

times 512-($-$$)-2 db 0
dw 0AA55h
Kernel Master

RE:Stack problem

Post by Kernel Master »

Ok first off you really can't stack the packages
you need to do them one at a time. Tony was having a
similar problem if you will read down 2 messages ago
if you want good popping ratio the trick is, lay the kernels
flat and even. this should fix your problem
Guest

RE:Stack problem

Post by Guest »

>On 2001-08-21 15:57:55, Kernel Master wrote:
>Ok first off you really can't stack the packages
>you need to do them one at a time. Tony was having a
>similar problem if you will read down 2 messages ago
>if you want good popping ratio the trick is, lay the kernels
>flat and even. this should fix your problem
hmmmmm
I had compiled my kernel with gcc and linked it with
ld
gcc -ffreestanding -c -o kernel.o kernel.c
ld -Ttext 0x10000 --oformat binary -o kernel.bin kernel.o
where can i switch the memory model to flat memory
Post Reply