Page 1 of 1

C++ inconsistency

Posted: Tue Dec 30, 2008 9:50 am
by xDDunce
i couldn't help noticing my code getting messier and messier so i decided to convert it into C++ because, well, i prefer it and it is has alot of useful features.


so i went on and converted a few functions into C++ and tested it and it seemed fine, so i carried on. now i have reached the GDT and have noticed that it doesnt always have the desired result. im not sure if this is just me doing some little thing wrong that i cant see, or if it is the switches i compile it with, but it seems that roughly 1in 7 times i run it in bochs, it runs fine, the other 6 come up with a general protection fault. whereas if i run it in M$ Virtual PC then it runs fine roughly 1 in 3.

i compile every file with this (obviously changing the filename):

Code: Select all

gxx -o kernel.o -c C:/CPPOSDEV/source/kernel.cpp -ffreestanding -nostdlib -fno-builtin -fno-rtti -fno-exceptions
is there anything missing?

also this is my GDT code:

GDT.h

Code: Select all

#ifndef __GDT_H_
#define __GDT_H_
#include "common.h"

extern "C"{
       typedef struct GDT_p{
               Word limit;
               dWord base;
       } __attribute__((packed)) GDT_ptr;
        
       typedef struct GDT_entry{
               Word limit_low;
               Word base_low;
               Byte base_middle;
               Byte access;
               Byte granularity;
               Byte base_high;
       } __attribute__((packed)) GDT_t;
       
       extern void GDT_Flush();
}

class GDT{
      public:
             GDT();
             ~GDT();
             
             void gdtInit();
             void addGdtEntry(int num, unsigned long base, unsigned long limit, Byte access, Byte granularity);
             
      private:
              GDT_t   gdt[3];
              GDT_ptr gdt_ptr;
      
      };

#endif
GDT.cpp

Code: Select all

#include "includes/GDT.h"
#include "includes/common.h"
extern "C" {GDT_ptr gp;}

GDT::GDT(){}

GDT::~GDT(){}

void GDT::gdtInit(){
     gdt_ptr.limit = (Word)(sizeof(GDT_t) *3)-1;
     gdt_ptr.base = (dWord) &gdt;
                   
     addGdtEntry(0, 0, 0, 0, 0);
                   
     addGdtEntry(1, 0, 0xFFFFFFFF, 0x9A, 0xCF);
     addGdtEntry(2, 0, 0xFFFFFFFF, 0x92, 0xCF);
     
     gp = gdt_ptr;
     GDT_Flush();
     }

void GDT::addGdtEntry(int             num,
                      unsigned long   base,
                      unsigned long   limit, 
                      Byte            access, 
                      Byte            granularity)
     {
     gdt[num].base_low = (base & 0xFFFF);
     gdt[num].base_middle = (base >> 16) & 0xFF;
     gdt[num].base_high = (base >> 24) & 0xFF;

     gdt[num].limit_low = (limit & 0xFFFF);
     gdt[num].granularity = ((limit >> 16) & 0x0F);

     gdt[num].granularity |= (granularity & 0xF0);
     gdt[num].access = access;
     }

GDT.asm

Code: Select all

[bits 32]

[global _GDT_Flush]

[extern _gp]

_GDT_Flush:
	lgdt [_gp]
	mov ax, 0x10
	mov ds, ax
	mov es, ax
	mov fs, ax
	mov gs, ax
	mov ss, ax
	jmp 0x08:flush

flush:
	ret
is there anything wrong with what i have done? i don't see anything wrong, and because it runs fine every so often, i am completely lost.

thanks in advance.

James.

Re: C++ inconsistency

Posted: Tue Dec 30, 2008 11:18 am
by neon
A couple of things:

1) Why not take out gdtinit() and put it in the ctor?
2) Your GDT::AddEntry has a fatal flaw: If entry 1 or 2 is written to incorrectly, GDT_Flush()
may fail with a #GPF do to it requiring entry 2 to be the code selector. Also, if num is > 3 bad things will happen.

There are more OOP design issues with the code that I see. In relation to your original question, have your software fail in Bochs and post a log for us to look at.

Re: C++ inconsistency

Posted: Tue Dec 30, 2008 11:45 am
by xDDunce
ok, thanks for the clarification but...

the reason i dont use the ctor to do all my gdtInit() stuff is because you cannot call functions from within the class from the constructor itself, so i cannot use the ctor to initialise the gdt entries. also i limit the number of gdt entries to 3 because i dont need any more. the code and data descriptors plus the null descriptor is all i need right? so why use more?

thanks for the help though.

Re: C++ inconsistency

Posted: Tue Dec 30, 2008 11:54 am
by neon
Its fine to limit the number of gdt entries to 3 however your AddEntry routine allows more then that. You should always add test cases to insure what you expect is true. The number of entries to use in the GDT depends on your design. Alot of systems, for example, do use more then 3 for protection between kernel land and user space code and data or for other purposes.

Also, you can call member functions from within ctors fine (Click here for more info)

If you can post your bochs log when the software fails that may help us track down where the problem may be at ;)

Re: C++ inconsistency

Posted: Tue Dec 30, 2008 12:21 pm
by xDDunce
bochslog:

Code: Select all

00000000000i[     ] Bochs x86 Emulator 2.3.7
00000000000i[     ]   Build from CVS snapshot, on June 3, 2008
00000000000i[     ] System configuration
00000000000i[     ]   processors: 1 (cores=1, HT threads=1)
00000000000i[     ]   A20 line support: yes
00000000000i[     ]   APIC support: yes
00000000000i[     ] CPU configuration
00000000000i[     ]   level: 6
00000000000i[     ]   SMP support: no
00000000000i[     ]   FPU support: yes
00000000000i[     ]   MMX support: yes
00000000000i[     ]   SSE support: 2
00000000000i[     ]   CLFLUSH support: yes
00000000000i[     ]   VME support: yes
00000000000i[     ]   3dnow! support: no
00000000000i[     ]   PAE support: yes
00000000000i[     ]   PGE support: yes
00000000000i[     ]   PSE support: yes
00000000000i[     ]   x86-64 support: yes
00000000000i[     ]   SEP support: yes
00000000000i[     ]   MWAIT support: no
00000000000i[     ]   XSAVE support: no
00000000000i[     ]   AES support: no
00000000000i[     ] Optimization configuration
00000000000i[     ]   Guest2HostTLB support: yes
00000000000i[     ]   RepeatSpeedups support: yes
00000000000i[     ]   Icache support: yes
00000000000i[     ]   Trace cache support: yes
00000000000i[     ]   Fast function calls: yes
00000000000i[     ] Devices configuration
00000000000i[     ]   ACPI support: yes
00000000000i[     ]   NE2000 support: yes
00000000000i[     ]   PCI support: yes
00000000000i[     ]   SB16 support: yes
00000000000i[     ]   USB support: yes
00000000000i[     ]   VGA extension support: vbe cirrus
00000000000i[MEM0 ] allocated memory at 01D60020. after alignment, vector=01D61000
00000000000i[MEM0 ] 32.00MB
00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('C:\Program Files\Bochs-2.3.7/BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/38400 ('C:\Program Files\Bochs-2.3.7/VGABIOS-lgpl-latest')
00000000000i[APIC?] set APIC ID to 0
00000000000i[APIC0] 80686
00000000000i[APIC0] local apic in CPU apicid=00 initializing
00000000000i[VTIME] using 'realtime pit' synchronization method
00000000000i[IOAP ] initializing I/O APIC
00000000000i[IOAP ] set APIC ID to 1
00000000000i[MEM0 ] Register memory access handlers: 0xfec00000 - 0xfec00fff
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Tue Dec 30 18:19:25 2008 (time0=1230661165)
00000000000i[DMA  ] channel 4 used by cascade
00000000000i[DMA  ] channel 2 used by Floppy Drive
00000000000e[FDD  ] Cannot open floppy drive
00000000000i[PCI  ] 440FX Host bridge present at device 0, function 0
00000000000i[PCI  ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
00000000000i[MEM0 ] Register memory access handlers: 0x000a0000 - 0x000bffff
00000000000i[WGUI ] Desktop Window dimensions: 1280 x 800
00000000000i[WGUI ] Number of Mouse Buttons = 2
00000000000i[WGUI ] IME disabled
00000000000i[MEM0 ] Register memory access handlers: 0xe0000000 - 0xe07fffff
00000000000i[CLVGA] VBE Bochs Display Extension Enabled
00000000000i[CLVGA] interval=40000
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_mem of 'extfpuirq' plugin device by virtual method
00000000000i[     ] init_mem of 'gameport' plugin device by virtual method
00000000000i[     ] init_mem of 'speaker' plugin device by virtual method
00000000000i[     ] init_mem of 'pci_ide' plugin device by virtual method
00000000000i[     ] init_mem of 'acpi' plugin device by virtual method
00000000000i[     ] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD   ] CD on ata1-0: 'Y:'
00000000000i[CD   ] load cdrom with path=Y:
00000000000i[CD   ] Using direct access for cdrom.
00000000000i[HD   ] Media present in CD-ROM drive
00000000000i[HD   ] Capacity is 2111714 sectors (4124.44 MB)
00000000000i[HD   ] Using boot sequence cdrom, floppy, none
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 0x03f8 irq 4
00000000000i[     ] init_dev of 'parallel' plugin device by virtual method
00000000000i[PAR  ] parallel port 1 at 0x0378 irq 7
00000000000i[     ] init_dev of 'extfpuirq' plugin device by virtual method
00000000000i[     ] init_dev of 'gameport' plugin device by virtual method
00000000000i[     ] init_dev of 'speaker' plugin device by virtual method
00000000000i[     ] init_dev of 'pci_ide' plugin device by virtual method
00000000000i[PCI  ] PIIX3 PCI IDE controller present at device 1, function 1
00000000000i[     ] init_dev of 'acpi' plugin device by virtual method
00000000000i[PCI  ] ACPI Controller present at device 1, function 3
00000000000i[     ] register state of 'harddrv' plugin device by virtual method
00000000000i[     ] register state of 'keyboard' plugin device by virtual method
00000000000i[     ] register state of 'serial' plugin device by virtual method
00000000000i[     ] register state of 'parallel' plugin device by virtual method
00000000000i[     ] register state of 'extfpuirq' plugin device by virtual method
00000000000i[     ] register state of 'gameport' plugin device by virtual method
00000000000i[     ] register state of 'speaker' plugin device by virtual method
00000000000i[     ] register state of 'pci_ide' plugin device by virtual method
00000000000i[     ] register state of 'acpi' plugin device by virtual method
00000000000i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] local apic in CPU 0 initializing
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
00000000000i[     ] reset of 'extfpuirq' plugin device by virtual method
00000000000i[     ] reset of 'gameport' plugin device by virtual method
00000000000i[     ] reset of 'speaker' plugin device by virtual method
00000000000i[     ] reset of 'pci_ide' plugin device by virtual method
00000000000i[     ] reset of 'acpi' plugin device by virtual method
00000003302i[BIOS ] $Revision: 1.209 $ $Date: 2008/06/02 20:08:10 $
00000080000e[CLVGA] character height = 1, skipping text update
00000317069i[KBD  ] reset-disable command received
00000436653i[VBIOS] VGABios $Id: vgabios.c,v 1.67 2008/01/27 09:44:12 vruppert Exp $

00000436724i[CLVGA] VBE known Display Interface b0c0
00000436756i[CLVGA] VBE known Display Interface b0c4
00000439681i[VBIOS] VBE Bios $Id: vbe.c,v 1.60 2008/03/02 07:47:21 vruppert Exp $
00000480000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
00000762682i[BIOS ] Starting rombios32
00000763509i[BIOS ] ram_size=0x02000000
00000771724i[BIOS ] Found 1 cpu(s)
00000788025i[BIOS ] bios_table_addr: 0x000fb778 end=0x000fcc00
00000788092i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001246899i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001706386i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00001706433i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00001706480i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00001706527i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00001706543i[P2I  ] write: ELCR2 = 0x0a
00001707480i[BIOS ] PIIX3 init: elcr=00 0a
00001727735i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237
00001730972i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000
00001733705i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010
00001734166i[PIDE ] new BM-DMA address: 0xc000
00001735049i[BIOS ] region 4: 0x0000c000
00001737625i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113
00001738125i[ACPI ] new irq line = 11
00001738162i[ACPI ] new PM base address: 0xb000
00001738224i[ACPI ] new SM base address: 0xb100
00001738692i[CPU0 ] Enter to System Management Mode
00001738702i[CPU0 ] RSM: Resuming from System Management Mode
00001738736i[PCI  ] setting SMRAM control register to 0x4a
00001739018i[PCI  ] setting SMRAM control register to 0x0a
00001762299i[BIOS ] MP table addr=0x000fb850 MPC table addr=0x000fb780 size=0xd0
00001764502i[BIOS ] SMBIOS table addr=0x000fb860
00001767546i[BIOS ] ACPI tables: RSDP addr=0x000fb970 ACPI DATA addr=0x01ff0000 size=0x9d8
00001787079i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001788091i[BIOS ] bios_table_cur_addr: 0x000fb994
00005735625i[BIOS ] IDE time out
00074272648i[BIOS ] Booting from 0000:7c00
00074376605i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80
00074381380i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80
00074386039i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported!
00091120500i[CPU0 ] CPU is in protected mode (active)
00091120500i[CPU0 ] CS.d_b = 32 bit
00091120500i[CPU0 ] SS.d_b = 32 bit
00091120500i[CPU0 ] EFER   = 0x00000000
00091120500i[CPU0 ] | RAX=00000000000b870f  RBX=000000000002d2a0
00091120500i[CPU0 ] | RCX=0000000000000000  RDX=00000000000b872d
00091120500i[CPU0 ] | RSP=0000000000067d74  RBP=0000000000067d84
00091120500i[CPU0 ] | RSI=000000000002d727  RDI=000000000002d728
00091120500i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00091120500i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00091120500i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00091120500i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00091120500i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df IF tf sf zf af pf cf
00091120500i[CPU0 ] | SEG selector     base    limit G D
00091120500i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00091120500i[CPU0 ] |  CS:0008( 0001| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  DS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  SS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  ES:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  FS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  GS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00091120500i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00091120500i[CPU0 ] | RIP=0000000000100ae7 (0000000000100ae7)
00091120500i[CPU0 ] | CR0=0x60000011 CR1=0x0 CR2=0x0000000000000000
00091120500i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00091120500i[CPU0 ] >> mov byte ptr ds:[edx], al : 8802
00091120500p[CPU0 ] >>PANIC<< exception(): 3rd (13) exception with no resolution
and as for the link you posted, would i be right in saying that the ctor can only call virtual functions from within its class? i distinctly remember a while ago trying to call a non virtual function from a ctor and gxx would not allow it.


thanks for the help though.

Re: C++ inconsistency

Posted: Tue Dec 30, 2008 5:01 pm
by JamesM
johnsy2008 wrote:bochslog:

Code: Select all

00000000000i[     ] Bochs x86 Emulator 2.3.7
00000000000i[     ]   Build from CVS snapshot, on June 3, 2008
00000000000i[     ] System configuration
00000000000i[     ]   processors: 1 (cores=1, HT threads=1)
00000000000i[     ]   A20 line support: yes
00000000000i[     ]   APIC support: yes
00000000000i[     ] CPU configuration
00000000000i[     ]   level: 6
00000000000i[     ]   SMP support: no
00000000000i[     ]   FPU support: yes
00000000000i[     ]   MMX support: yes
00000000000i[     ]   SSE support: 2
00000000000i[     ]   CLFLUSH support: yes
00000000000i[     ]   VME support: yes
00000000000i[     ]   3dnow! support: no
00000000000i[     ]   PAE support: yes
00000000000i[     ]   PGE support: yes
00000000000i[     ]   PSE support: yes
00000000000i[     ]   x86-64 support: yes
00000000000i[     ]   SEP support: yes
00000000000i[     ]   MWAIT support: no
00000000000i[     ]   XSAVE support: no
00000000000i[     ]   AES support: no
00000000000i[     ] Optimization configuration
00000000000i[     ]   Guest2HostTLB support: yes
00000000000i[     ]   RepeatSpeedups support: yes
00000000000i[     ]   Icache support: yes
00000000000i[     ]   Trace cache support: yes
00000000000i[     ]   Fast function calls: yes
00000000000i[     ] Devices configuration
00000000000i[     ]   ACPI support: yes
00000000000i[     ]   NE2000 support: yes
00000000000i[     ]   PCI support: yes
00000000000i[     ]   SB16 support: yes
00000000000i[     ]   USB support: yes
00000000000i[     ]   VGA extension support: vbe cirrus
00000000000i[MEM0 ] allocated memory at 01D60020. after alignment, vector=01D61000
00000000000i[MEM0 ] 32.00MB
00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('C:\Program Files\Bochs-2.3.7/BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/38400 ('C:\Program Files\Bochs-2.3.7/VGABIOS-lgpl-latest')
00000000000i[APIC?] set APIC ID to 0
00000000000i[APIC0] 80686
00000000000i[APIC0] local apic in CPU apicid=00 initializing
00000000000i[VTIME] using 'realtime pit' synchronization method
00000000000i[IOAP ] initializing I/O APIC
00000000000i[IOAP ] set APIC ID to 1
00000000000i[MEM0 ] Register memory access handlers: 0xfec00000 - 0xfec00fff
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Tue Dec 30 18:19:25 2008 (time0=1230661165)
00000000000i[DMA  ] channel 4 used by cascade
00000000000i[DMA  ] channel 2 used by Floppy Drive
00000000000e[FDD  ] Cannot open floppy drive
00000000000i[PCI  ] 440FX Host bridge present at device 0, function 0
00000000000i[PCI  ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
00000000000i[MEM0 ] Register memory access handlers: 0x000a0000 - 0x000bffff
00000000000i[WGUI ] Desktop Window dimensions: 1280 x 800
00000000000i[WGUI ] Number of Mouse Buttons = 2
00000000000i[WGUI ] IME disabled
00000000000i[MEM0 ] Register memory access handlers: 0xe0000000 - 0xe07fffff
00000000000i[CLVGA] VBE Bochs Display Extension Enabled
00000000000i[CLVGA] interval=40000
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_mem of 'extfpuirq' plugin device by virtual method
00000000000i[     ] init_mem of 'gameport' plugin device by virtual method
00000000000i[     ] init_mem of 'speaker' plugin device by virtual method
00000000000i[     ] init_mem of 'pci_ide' plugin device by virtual method
00000000000i[     ] init_mem of 'acpi' plugin device by virtual method
00000000000i[     ] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD   ] CD on ata1-0: 'Y:'
00000000000i[CD   ] load cdrom with path=Y:
00000000000i[CD   ] Using direct access for cdrom.
00000000000i[HD   ] Media present in CD-ROM drive
00000000000i[HD   ] Capacity is 2111714 sectors (4124.44 MB)
00000000000i[HD   ] Using boot sequence cdrom, floppy, none
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 0x03f8 irq 4
00000000000i[     ] init_dev of 'parallel' plugin device by virtual method
00000000000i[PAR  ] parallel port 1 at 0x0378 irq 7
00000000000i[     ] init_dev of 'extfpuirq' plugin device by virtual method
00000000000i[     ] init_dev of 'gameport' plugin device by virtual method
00000000000i[     ] init_dev of 'speaker' plugin device by virtual method
00000000000i[     ] init_dev of 'pci_ide' plugin device by virtual method
00000000000i[PCI  ] PIIX3 PCI IDE controller present at device 1, function 1
00000000000i[     ] init_dev of 'acpi' plugin device by virtual method
00000000000i[PCI  ] ACPI Controller present at device 1, function 3
00000000000i[     ] register state of 'harddrv' plugin device by virtual method
00000000000i[     ] register state of 'keyboard' plugin device by virtual method
00000000000i[     ] register state of 'serial' plugin device by virtual method
00000000000i[     ] register state of 'parallel' plugin device by virtual method
00000000000i[     ] register state of 'extfpuirq' plugin device by virtual method
00000000000i[     ] register state of 'gameport' plugin device by virtual method
00000000000i[     ] register state of 'speaker' plugin device by virtual method
00000000000i[     ] register state of 'pci_ide' plugin device by virtual method
00000000000i[     ] register state of 'acpi' plugin device by virtual method
00000000000i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] local apic in CPU 0 initializing
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
00000000000i[     ] reset of 'extfpuirq' plugin device by virtual method
00000000000i[     ] reset of 'gameport' plugin device by virtual method
00000000000i[     ] reset of 'speaker' plugin device by virtual method
00000000000i[     ] reset of 'pci_ide' plugin device by virtual method
00000000000i[     ] reset of 'acpi' plugin device by virtual method
00000003302i[BIOS ] $Revision: 1.209 $ $Date: 2008/06/02 20:08:10 $
00000080000e[CLVGA] character height = 1, skipping text update
00000317069i[KBD  ] reset-disable command received
00000436653i[VBIOS] VGABios $Id: vgabios.c,v 1.67 2008/01/27 09:44:12 vruppert Exp $

00000436724i[CLVGA] VBE known Display Interface b0c0
00000436756i[CLVGA] VBE known Display Interface b0c4
00000439681i[VBIOS] VBE Bios $Id: vbe.c,v 1.60 2008/03/02 07:47:21 vruppert Exp $
00000480000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
00000762682i[BIOS ] Starting rombios32
00000763509i[BIOS ] ram_size=0x02000000
00000771724i[BIOS ] Found 1 cpu(s)
00000788025i[BIOS ] bios_table_addr: 0x000fb778 end=0x000fcc00
00000788092i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001246899i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001706386i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00001706433i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00001706480i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00001706527i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00001706543i[P2I  ] write: ELCR2 = 0x0a
00001707480i[BIOS ] PIIX3 init: elcr=00 0a
00001727735i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237
00001730972i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000
00001733705i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010
00001734166i[PIDE ] new BM-DMA address: 0xc000
00001735049i[BIOS ] region 4: 0x0000c000
00001737625i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113
00001738125i[ACPI ] new irq line = 11
00001738162i[ACPI ] new PM base address: 0xb000
00001738224i[ACPI ] new SM base address: 0xb100
00001738692i[CPU0 ] Enter to System Management Mode
00001738702i[CPU0 ] RSM: Resuming from System Management Mode
00001738736i[PCI  ] setting SMRAM control register to 0x4a
00001739018i[PCI  ] setting SMRAM control register to 0x0a
00001762299i[BIOS ] MP table addr=0x000fb850 MPC table addr=0x000fb780 size=0xd0
00001764502i[BIOS ] SMBIOS table addr=0x000fb860
00001767546i[BIOS ] ACPI tables: RSDP addr=0x000fb970 ACPI DATA addr=0x01ff0000 size=0x9d8
00001787079i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001788091i[BIOS ] bios_table_cur_addr: 0x000fb994
00005735625i[BIOS ] IDE time out
00074272648i[BIOS ] Booting from 0000:7c00
00074376605i[BIOS ] int13_harddisk: function 41, unmapped device for ELDL=80
00074381380i[BIOS ] int13_harddisk: function 08, unmapped device for ELDL=80
00074386039i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported!
00091120500i[CPU0 ] CPU is in protected mode (active)
00091120500i[CPU0 ] CS.d_b = 32 bit
00091120500i[CPU0 ] SS.d_b = 32 bit
00091120500i[CPU0 ] EFER   = 0x00000000
00091120500i[CPU0 ] | RAX=00000000000b870f  RBX=000000000002d2a0
00091120500i[CPU0 ] | RCX=0000000000000000  RDX=00000000000b872d
00091120500i[CPU0 ] | RSP=0000000000067d74  RBP=0000000000067d84
00091120500i[CPU0 ] | RSI=000000000002d727  RDI=000000000002d728
00091120500i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00091120500i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00091120500i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00091120500i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00091120500i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df IF tf sf zf af pf cf
00091120500i[CPU0 ] | SEG selector     base    limit G D
00091120500i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00091120500i[CPU0 ] |  CS:0008( 0001| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  DS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  SS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  ES:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  FS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  GS:0010( 0002| 0|  0) 00000000 000fffff 1 1
00091120500i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00091120500i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00091120500i[CPU0 ] | RIP=0000000000100ae7 (0000000000100ae7)
00091120500i[CPU0 ] | CR0=0x60000011 CR1=0x0 CR2=0x0000000000000000
00091120500i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00091120500i[CPU0 ] >> mov byte ptr ds:[edx], al : 8802
00091120500p[CPU0 ] >>PANIC<< exception(): 3rd (13) exception with no resolution
and as for the link you posted, would i be right in saying that the ctor can only call virtual functions from within its class? i distinctly remember a while ago trying to call a non virtual function from a ctor and gxx would not allow it.


thanks for the help though.

Hi,

Purely r.e. the constructor issue, you can call any member function both virtual and nonvirtual, static and nonstatic from a class constructor. In the constructor you have a "this" instance, so there is no restriction on what can be done, from the language point of view.

The error you encountered was likely caused by something else.

Cheers,

James

Re: C++ inconsistency

Posted: Fri Jan 02, 2009 10:52 am
by xDDunce
ok, i solved the mystery... it was just a badly named variable. :oops:

i declared the GDT class in common.h as:

Code: Select all

extern class GDT gdt;
which then interfered with my gdt code:

Code: Select all

gdt_ptr.base = &gdt; 
resulting in it being loaded with the address of the class itself rather than the loaction of the table.

i've sorted it now and it is fine. thanks for all the help though guys!