GDT troubles ...again

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.
mmiikkee12
Member
Member
Posts: 38
Joined: Sat Jun 03, 2006 11:00 pm

Post by mmiikkee12 »

Candy wrote:
mmiikkee12 wrote:I was planning on waiting until I have all my current code working before importing it into a SVN repo. Should I do that now so you can see my code?
It's advisable to check into a svn / cvs / something repo ASAP after you get one more feature working. You wouldn't be the first to have the just-not-working product remove half its source.
'

My current code == GDT+IDT :-)
mmiikkee12
Member
Member
Posts: 38
Joined: Sat Jun 03, 2006 11:00 pm

Post by mmiikkee12 »

OK, I got past the GDT problems. Now QEMU is telling me this:
qemu: fatal: Trying to execute code outside RAM or ROM at 0x000b8f00

EAX=000b8f00 EBX=00103000 ECX=0000011b EDX=00000000
ESI=000250b0 EDI=00030f48 EBP=001020fc ESP=00102094
EIP=000b8f00 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0010 00000000 ffffffff 00cf9300
CS =0008 00000000 ffffffff 00cf9a00
SS =0010 00000000 ffffffff 00cf9300
DS =0010 00000000 ffffffff 00cf9300
FS =0010 00000000 ffffffff 00cf9300
GS =0010 00000000 ffffffff 00cf9300
LDT=0000 00000000 0000ffff 00008000
TR =0000 00000000 0000ffff 00008000
GDT= 0010b020 00000017
IDT= 0010b040 000007ff
CR0=60000011 CR2=00000000 CR3=00000000 CR4=00000000
CCS=00000004 CCD=fffffffc CCO=SUBL
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
[FPR0-7 and XMM0-7 are all 0.]
And Bochs tells me this:
00016806479i[CPU0 ] LOCK prefix unallowed (op1=0x87, attr=0x300, mod=0xc0, nnn=5)
00016859235i[CPU0 ] LOCK prefix unallowed (op1=0x53, attr=0x0, mod=0x0, nnn=0)
The second line repeats until I kill Bochs, and prints isr_handler each time it happens.

I finally got around to putting my code in SVN, the kernel code is here: http://dinounix.ath.cx/delta/?module=sv ... /&rev=HEAD
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

your asm stubs are incorrect: you push two values (or one if the error code is already there), but you neglegt to pop them once the interrupt routine returns

Code: Select all

push 0
 |
 | push %1
 |  |
 |  | jmp isr_common_stub
 |  | pusha
 |  |  | call isr_handler
 |  | popa
 |  |
 |  ? 
 ?
ret 
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
mmiikkee12
Member
Member
Posts: 38
Joined: Sat Jun 03, 2006 11:00 pm

Post by mmiikkee12 »

Thank you! add esp, 8 did it. (How did I forget that?)

Oh well, everyone makes mistakes. I just happen to make many more mistakes than most other people.
speal
Member
Member
Posts: 43
Joined: Wed Mar 07, 2007 10:09 am
Location: Minneapolis, Minnesota
Contact:

Post by speal »

you'd be surprised
Fetrovsky
Posts: 3
Joined: Thu Oct 21, 2004 11:00 pm

Post by Fetrovsky »

mmiikkee12 wrote:Still the gate type 7 message.

I'm going to take a short (couple of hours) break from OSDev for a few hours to do some web coding (for my OS's website of course :-), but please feel free to try to tell me wtf is going on :-)
Gate Type? Are you sure you're not making your code segment a "System" segment?
Post Reply