pitticks is defined as:
Code: Select all
unsigned int pitticks = 0;
Code: Select all
void __declspec(naked) _cdecl pit_irq()
{
_asm cli
pitticks++;
_asm sti
_asm iretd
}
Any ideas on how to solve this?
Code: Select all
unsigned int pitticks = 0;
Code: Select all
void __declspec(naked) _cdecl pit_irq()
{
_asm cli
pitticks++;
_asm sti
_asm iretd
}
souradipm wrote:Try declaring it as volatile. Also, are you sure it is not something else causing the GPF?
Code: Select all
00000000000i[MEM0 ] allocated memory at 011E0020. after alignment, vector=011E1000
00000000000i[MEM0 ] 4.00MB
00000000000i[MEM0 ] rom at 0xf0000/65536 ('BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/27392 ('VGABIOS-lgpl-latest')
00000000000i[CMOS ] Setting initial clock to: Fri Aug 15 19:14:21 2008 (time0=1218845661)
00000000000i[DMA ] channel 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive
00000000000i[FDD ] fd0: 'a:' ro=0, h=2,t=80,spt=18
00000000000i[VGA ] interval=30000
00000000000i[VGA ] VBE Bochs Display Extension Enabled
00000000000i[ ] init_mem of 'harddrv' plugin device by virtual method
00000000000i[ ] init_mem of 'keyboard' plugin device by virtual method
00000000000i[ ] init_mem of 'serial' plugin device by virtual method
00000000000i[ ] init_mem of 'parallel' plugin device by virtual method
00000000000i[ ] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD ] Boot device will be 'a'
00000000000i[HD ] Floppy boot signature check is enabled
00000000000i[ ] init_dev of 'keyboard' plugin device by virtual method
00000000000i[KBD ] will paste characters every 1000 keyboard ticks
00000000000i[ ] init_dev of 'serial' plugin device by virtual method
00000000000i[SER ] com1 at 0x3f8/8 irq 4
00000000000i[ ] init_dev of 'parallel' plugin device by virtual method
00000000000i[PAR ] parallel port 1 at 0x378
00000000000i[ ] reset of 'harddrv' plugin device by virtual method
00000000000i[ ] reset of 'keyboard' plugin device by virtual method
00000000000i[ ] reset of 'serial' plugin device by virtual method
00000000000i[ ] reset of 'parallel' plugin device by virtual method
00000003980i[BIOS ] rombios.c,v 1.85 2002/12/13 16:26:17 cbothamy Exp $
00000330071i[KBD ] reset-disable command received
00000353362i[VBIOS] VGABios $Id: vgabios.c,v 1.20 2002/10/20 15:12:33 vruppert Exp $
00000353593i[VGA ] VBE known Display Interface b0c1
00000353678i[VGA ] VBE known Display Interface b0c0
00000356623i[VBIOS] VBE Bios $Id: vbe.c,v 1.22 2002/09/19 17:03:21 cbothamy Exp $
00000356738i[VGA ] VBE known Display Interface b0c1
00000356822i[VGA ] VBE disabling
00000693499i[VGA ] VBE known Display Interface b0c1
00000781141e[HD ] device set to 0 which does not exist
00000781434e[HD ] device set to 1 which does not exist
00001007287e[CPU ] load_seg_reg: LDT invalid
00001007287p[CPU ] >>PANIC<< exception(): 3rd (13) exception with no resolution
00001007287i[SYS ] Last time is 1218845663
00001007287i[CPU ] protected mode
00001007287i[CPU ] CS.d_b = 32 bit
00001007287i[CPU ] SS.d_b = 32 bit
00001007287i[CPU ] | EAX=600001fe EBX=001000e4 ECX=00130004 EDX=00000ffe
00001007287i[CPU ] | ESP=0008fff8 EBP=00000010 ESI=000006ff EDI=00000200
00001007287i[CPU ] | IOPL=0 NV UP DI NG NZ AC PO CY
00001007287i[CPU ] | SEG selector base limit G D
00001007287i[CPU ] | SEG sltr(index|ti|rpl) base limit G D
00001007287i[CPU ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00001007287i[CPU ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00001007287i[CPU ] | FS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00001007287i[CPU ] | GS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00001007287i[CPU ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00001007287i[CPU ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00001007287i[CPU ] | EIP=001001e8 (001001e8)
00001007287i[CPU ] | CR0=0x60000011 CR1=0x00000000 CR2=0x00000000
00001007287i[CPU ] | CR3=0x00000000 CR4=0x00000000
00001007287i[ ] restoring default signal behavior
00001007287i[CTRL ] quit_sim called with exit code 1
Code: Select all
_asm {
mov eax, [pitticks]
}
I didn't add it as a class member (it was(like my PIT IRQ) part of _pit, but I later removed it from the class to solve another error that came up). "pitticks" is not defined in a class, function, or struct. It is not referenced in a header file. It is not volatile or static. The only thing unusual about it is that it is completely usual.Telgin wrote:Ok, so what's different about this variable compared to any other you are using? Anything? I didn't see where you specified if it was a class member or anything special. Finding out what makes it different is going to be one step in the right direction to solve it.
I commented out the code that initializes the GDT in kmain, lemme see if it works when I uncomment it.Telgin wrote:Can you step through the assembly and see which instruction is throwing the exception? If even accessing it is causing the exception, then it sounds to me like something isn't configured right in the environment. Segment registers / selectors might be doing something funky that you don't realize, or there might be some stack corruption or something throwing the variable's address off and causing accesses and the like to modify incorrect memory addresses, which might be outside of the segment selector range or something.
Code: Select all
void __declspec(naked) _cdecl pit_irq()
{
_asm pushad
pitticks++;
interruptdone(0); // just sends EOI to the PIC
_asm popad
_asm iretd
}
Code: Select all
static volatile unsigned int pitticks = 0;
//////////////////////////////////////////////
// pit_irq() - //
// irq for the PIT //
//////////////////////////////////////////////
void __declspec(naked) _cdecl pit_irq()
{
_asm pushad
pitticks++;
outportb (0x20, 0x20);
_asm popad
_asm iretd
}