Code Review for HardMetal
Code Review for HardMetal
Recently, I have started to write code to set up the gdt for HardMetal, using jamesm's tutorials and Bran's I adapted the code to my kernel. I get a triple fault everytime I install the gdt. I have tried changing a bunch of things, looking at examples and I don't see the problem. I figure this is something that has to be looked at with someone else's mind. Here you go: the files are gdt.c gdt.h and startk.s
- Attachments
-
- HardMetal.tar.bz2
- (3.8 KiB) Downloaded 67 times
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Well, at a first glance I don't see anything wrong, but you could chaqnge line 11 of gdt.c from:
to:
Code: Select all
gp.limit = (sizeof(struct gdt_ent) * 5) - 1;
Code: Select all
gp.limit = (sizeof(struct gdt_ent) * 3) - 1;
Still problems.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
As you know, I have trouble with my floppy. I get things like, inconsistent filesystem all the time. Bochs is also missing the Bios and I can't find a download for it anywhere.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
I got it working after changing the code a bit.
@Combuster: I did get bochs working, I DID find the bios and but it where it belonged. I do not know, (though I wish I did) what caused the problem.
@Combuster: I did get bochs working, I DID find the bios and but it where it belonged. I do not know, (though I wish I did) what caused the problem.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
I get a triple fault now that I added code to set up a tss. The bochs dump looks like this
Which leads me to believe that I have a problem with my tss setup. Do I have to set the values in all of the members of the tss to their current values? Do they have to be set to a non-zero value when loaded? I will post my new code, I have added a new file tss.h which contains the structure for the tss.
Code: Select all
charmap update. Font Height is 16
00058365617i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80
00058370381i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80
00058375023i[BIOS ] *** int 15h function AX=00C0, BX=0000 not yet supported!
00918043259e[CPU0 ] fetch_raw_descriptor: GDT: index (2f)5 > limit (27)
00918043259e[CPU0 ] interrupt(): gate descriptor is not valid sys seg
00918043259e[CPU0 ] interrupt(): gate descriptor is not valid sys seg
00918043259i[CPU0 ] protected mode
00918043259i[CPU0 ] CS.d_b = 32 bit
00918043259i[CPU0 ] SS.d_b = 32 bit
00918043259i[CPU0 ] EFER = 0x00000000
00918043259i[CPU0 ] | RAX=0000000000000028 RBX=000000000002e240
00918043259i[CPU0 ] | RCX=0000000000000000 RDX=0000000000000005
00918043259i[CPU0 ] | RSP=0000000000105fe8 RBP=0000000000106000
00918043259i[CPU0 ] | RSI=0000000000054ec0 RDI=0000000000054ec1
00918043259i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00918043259i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00918043259i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00918043259i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00918043259i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af pf cf
00918043259i[CPU0 ] | SEG selector base limit G D
00918043259i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00918043259i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00918043259i[CPU0 ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00918043259i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00918043259i[CPU0 ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00918043259i[CPU0 ] | FS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00918043259i[CPU0 ] | GS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00918043259i[CPU0 ] | MSR_FS_BASE:0000000000000000
00918043259i[CPU0 ] | MSR_GS_BASE:0000000000000000
00918043259i[CPU0 ] | RIP=0000000000100179 (0000000000100179)
00918043259i[CPU0 ] | CR0=0x00000011 CR1=0x0 CR2=0x0000000000000000
00918043259i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00918043259i[CPU0 ] >> ltr ax : 0F00D8
00918043259e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
- Attachments
-
- HardMetal.tar.bz2
- (4.08 KiB) Downloaded 64 times
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
HaHa, I forgot to increase the limit on my gdt to make room for my tss descriptor. I should put that in stupidest mistakes thread.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc