Over 1 Meg OS Loading

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.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Over 1 Meg OS Loading

Post by df »

you have obviously got some code set low (you can see it in the elf dump). if you zip all your source+makefile, etc. I cant properly track it down without seeing everything.
-- Stu --
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

I gave you all my source...and I don't use a make file...I use the linker script and this:
# Simple way to compile

nasm -f bin ../source/boot/boot.asm -o ../bins/boot.bin
nasm -f elf ../source/kernel/kernelasm.asm -o ../source/object/kernelasm.o
gcc -c ../source/kernel/kernel32.cpp -o ../source/object/kernel32.o
gcc -c ../source/kernel/idt.cpp -o ../source/object/idt.o
gcc -c ../source/kernel/error.cpp -o ../source/object/error.o
gcc -c ../source/kernel/fstdio.cpp -o ../source/object/fstdio.o
gcc -c ../source/kernel/x86.cpp -o ../source/object/x86.o
gcc -c ../source/kernel/string.cpp -o ../source/object/string.o
gcc -c ../source/kernel/keys.cpp -o ../source/object/keys.o
gcc -c ../source/kernel/irq.cpp -o ../source/object/irq.o

# Put kernelasm.o first so it IS loaded first!
# CHANGE temp/kernel32.sys!
ld -Tlink.ld -o ../bins/kernel32.sys ../source/object/kernelasm.o ../source/object/kernel32.o ../source/object/idt.o ../source/object/error.o ../source/object/fstdio.o ../source/object/x86.o ../source/object/string.o ../source/object/keys.o ../source/object/irq.o
#objcopy -R .note -R .comment -S -O binary ../source/temp/kernel32 ../bins/kernel32.sys

cat ../bins/boot.bin ../bins/kernel32.sys > ../bins/fritzos.img

# delete the temp files
sh deltemp.sh
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Over 1 Meg OS Loading

Post by df »

i dont have any of your source... so... shrugs..
-- Stu --
Xeon

Re:Over 1 Meg OS Loading

Post by Xeon »

pskyboy: Where can I find a copy of Phoenix OS? I'd like to take a look at it. Thanks,
Xeon
hanoi

Re:Over 1 Meg OS Loading

Post by hanoi »

ok i try to help now...
i give you my GDT and my kernel loader and my copy:
copy: ;this MUST be executed whilst in pmode with a 4GB Data Global Descriptor(see my GDT)
mov ax, Data
mov ds, ax
mov es, ax
mov esi,0x10000 ;I loaded my kernel to 0x10000 linear
mov edi, 0x100000; i want it to execute at 0x100000(!)
mov ecx, kernel_size
rep movsb;movsb copies one byte from ds:esi to es:edi while increasing esi and edi aoutamatically
ret

load_kernel:
reset: ; Reset the floppy drive
mov ax, 0 ;
mov dl, 0 ; Drive=0 (=A)
int 13h ;
jc reset ; ERROR => reset again


read:
mov ax, 1000h ; ES:BX = 1000:0000 = linear 0x10000
mov es, ax ;
mov bx, 0 ;

mov ah, 2 ; Load disk data to ES:BX
mov al, 5 ; Load 5 sectors
mov ch, 0 ; Cylinder=0
mov cl, 2 ; Sector=2
mov dh, 0 ; Head=0
mov dl, 0 ; Drive=0
int 13h ; Read!

jc read ; ERROR => Try again

GDT

NULL equ $-GDT
dd 0
dd 0

CODE equ $-GDT
dw 0xFFFF
dw 0x0000
db 0x00
db 0x98 ;Type
db 0xCF
db 0x0

DATA equ $-GDT
dw 0xFFFF
dw 0x0000
db 0x00
db 0x92 ;Type
db 0xCF
db 0x0


GDTR
dw $-GDT
dd GDT

load gdt with:
lgdt [GDTR]
ok?
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

hanoi the code gives me a bogus mem error...and I like GRUB now....


here is my code that has probs with GRUB: http://www.mega-tokyo.com/forum/attachments/uploaded_files/kstartprob.asm
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Over 1 Meg OS Loading

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:14 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Over 1 Meg OS Loading

Post by Pype.Clicker »

i'm afraid you're not going to have what you wish ...
(Exception_addr_0 >> 16) will be a numerical value that represent the highest bits of the place where you store the address of the exception. Not the exception itself. That's why so much people have an empty IDT at startup and fills it with setup_interrupt(nr, fct) ...

What you could do is

Code: Select all

int_table dd dividezeroISR, debugISR, nmiISR, breakpointISR, ...

mov esi, IDT
mov edi, int_table
mov ecx, NUMBER_OF_INTERRUPTS_TO_SET_UP
.loop:
   mov eax, [esi+ecx*4]
   mov [edi+ecx*8+ia32gate.base_lo],ax
   shr ax,16
   mov [edi+ecx*8+ia32gate.base_hi],ax
   dec ecx
   jnecxz .loop
.done
hanoi

Re:Over 1 Meg OS Loading

Post by hanoi »

Solar Ray
source isn't complete of course.....
i just showed the essential parts ::)
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

Ok....i'll have to zip it....it'll be here later....(this is Tom)
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

Finally...here it is:



[attachment deleted by admin]
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Over 1 Meg OS Loading

Post by df »

this is my fixed version. there are bugs, so it wont boot, but should be grubbable now.

lots of problems were because you are using cpp compiler and .cpp extension instead of using c. you have no provisions for doing RTTI etc and other stuff in your kernel.

go into the source/kernel directory and type make to build it.



[attachment deleted by admin]
-- Stu --
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Over 1 Meg OS Loading

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:14 pm, edited 1 time in total.
DarylD

Re:Over 1 Meg OS Loading

Post by DarylD »

Course it will. It is called High Memory and was an old dos trick to get a little extra memory on 286's and above.

If A20 is enabled then this will work.

Daryl.
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

DF, I think you forgot i'm in linux...so I don't have ld-all....

Could you fix the make file to go without ld-all?
Post Reply