Page 3 of 5
Re:about the kernel
Posted: Tue Oct 29, 2002 6:29 pm
by Tom
ok... try putting a jmp $ just after the PMode think like this:
....
[bits 32]pmode:
jmp $ ; does this reboot?
... - other code
Re:about the kernel
Posted: Tue Oct 29, 2002 7:34 pm
by adeelmahmood1
yup i have put the GDT and also i have done that jmp to codeselector:pmode and it still reboots and now i have checked it with
jmp $ after setting pmode
[bits 32]
setUpPmode:
jmp $
but it still reboots ..
but i didnt got ur point . even if it doesnt reboots at this point . how am i gonna use the code after this if i m gonn halt it at this point ...
???
Re:about the kernel
Posted: Tue Oct 29, 2002 8:00 pm
by Schol-R-LEA
The idea, I think, was to isolate where the code is failing - its an old coder's trick, a kind of poor-man's breakpoint. Because it reboots, rather than going into an infinite loop, you know that the problem lies before the [tt]JMP $[/tt] instruction.
What you now want to do is step the inserted jump back, one instruction at a time, until you get to where it hangs rather than rebooting. Then you'll know that it's the following instruction that is the cause of the problem.
At least, that is how I read Tom's suggestion. I may be wrong. C&CW.
Re:about the kernel
Posted: Tue Oct 29, 2002 8:50 pm
by adeelmahmood1
well guys i m really frustrated at this time .. i have checked it going back and its letting me do nothing about the pmode ... Tom have u changed ur GDT coz their might be some problem in it .. if u have plz show me wats that ..
well lets see wat u guys suggest :
and there is one more thing i need to ask u .. can i jump to another assembly bin file from my boot loader without setting the Pmode .. i just wanna check it .. now if i can .. then i have some confusions about it :
if i have this boot loader which just boots up and then i want it to jump to another file which just displays some messages..
now the thing is that where should i put my 2nd loader...
should i just copy it to the floppy and do i have to write it to the floppy sector ????
if i have to copy it to sector 2 coz i will read the 2nd sector of floppy from my first loader and load it at es:bx,
then while using partcopy which one is right?
or
2f coz loader2 is i think 47 bytes.
and then how am i gonna know that how many secotors i have to read ???
and plz tell me what does jmp dword means .. how does it differs from normal jmp???
well u might find all this confusing coz thats right .. i m really confused right now .. and i am not even able to summarize all the q's i have in my mind .. well for now if u could answer these ..
thanx alot for ur help
Re:about the kernel
Posted: Wed Oct 30, 2002 8:09 am
by Curufir
Neither, read your partcopy documentation before you break something.
It's source, offset in source, length, destination, offset in destination. All values are in hex.
So most likely you would use.
This will dump it in sector 1, immediately following your 512byte bootsector.
Curufir
Re:about the kernel
Posted: Wed Oct 30, 2002 11:01 am
by Tom
I can't help you with partcopy....no wonder why FritzOS doesn't work! You need to do special things with parcopy...
Re:about the kernel
Posted: Wed Oct 30, 2002 11:38 am
by adeelmahmood1
alright i will try that partcopy thing .. thanx for ur help.. and tom i just need to ask u that did u changed anything in ur GDT coz there might be some problem in it thats why it just keeps rebooting .. here is what i have of urs:
Code: Select all
gdtr dw gdt_end-1
dd gdt
gdt
nullselector equ $-gdt
gdt0
dd 0
dd 0
codeselector equ $-gdt
dw 0ffffh
dw 0
db 0
db 09ah
db 0cfh
db 0h
dataselector equ $-gdt
dw 0ffffh
dw 0h
db 0h
db 092h
db 0cfh
db 0
gdt_end
Re:about the kernel
Posted: Wed Oct 30, 2002 12:03 pm
by Tom
that GDT is fine for how my pk0.6 code works
Download FritzOS pk0.6 at
fritzos.sourceforge.net IF that codes' not the new one ( 0.6 ).
It'll reboot and reboot no matter what because, partcopy needs special NASM code that I don't know, try asking how to put the bin's on floppys using debug, I forgot how.
Re:about the kernel
Posted: Wed Oct 30, 2002 5:10 pm
by PlayOS
OK, first of all I can never understand why people make their GDTs like this, you may only be testing or experimenting or whatever, but why write something you know you will have to cahnge eventually?
I will guarentee that any half decently OS is going to need more than a ring 0 code and data selector. Besides this they are too confusing to understand, I have seen so many problems with GDTs like this, I cant understand why everyone does it.
Anyway, I aint no guru, this is just my opinion, I have a complete example boot/kernel you can download and work with, it isnt very well commented at the moment, but it works.
Download it here
http://home.kooee.com.au/tim_danielle/o ... kernel.zip
Good Luck.
Re:about the kernel
Posted: Wed Oct 30, 2002 8:21 pm
by adeelmahmood1
well u know what
i have read ur code and sorry to say its really confusing for me .. actually i m not that good in this stuff right now thats why i didnt understood it well .. i can understand the rest of the stuff but the GDT u have made is really confusing for me .. could u explain to me wat u really want me to understand from ur code .. :-[
and also tell me how does jmp dword differs from jmp .. and one more thing about the A20 gate .. that when it is required to enable it .. ?? before switching to pmode or after that or anywhere ??? ...
well thanx for ur help guys
Re:about the kernel
Posted: Wed Oct 30, 2002 8:21 pm
by grey wolf
everyone does it because it's so simple and easy to implement and understand.
at some point, i intend to add more segments to my GDT, but what is there is adequate for now.
Re:about the kernel
Posted: Wed Oct 30, 2002 9:03 pm
by adeelmahmood1
[attachment deleted by admin]
Re:about the kernel
Posted: Wed Oct 30, 2002 9:03 pm
by adeelmahmood1
[attachment deleted by admin]
Re:about the kernel
Posted: Thu Oct 31, 2002 10:32 am
by adeelmahmood1
or even if some one else could also help me ..
thanx for ur help
Re:about the kernel
Posted: Thu Oct 31, 2002 11:34 am
by Tom
[attachment deleted by admin]