[SOLVED] Bootloader - Problem entering protected mode

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.
Post Reply
tobbebia
Posts: 17
Joined: Fri Feb 19, 2010 1:49 pm
Location: Sweden

[SOLVED] Bootloader - Problem entering protected mode

Post by tobbebia »

Hello!

I am trying to create a bootloader and later on a kernel in c.

The project consists of four files:
bootloader.s
kernel_start.s
link.ld
Makefile

bootloader.s obviously contains the bootloader code.
kernel_start.s is the code that bootloader will jump to.
link.ld is the linker script.

Before i tell you the "problem" let me post two of the files above:

bootloader.s
(swedish comments removed)

Code: Select all

[BITS 16]
%define SECTORS_TO_LOAD 1

jmp 7C0h:bootloader_entry

bootloader_entry:
	mov ax, 7C0h
	mov ds, ax
	mov es, ax
	mov ss, ax

	mov sp, stack
	
	call load_kernel
	call enter_protected_mode
	
	jmp hang
	
load_kernel:
	mov ax, 7C0h
	mov es, ax
	mov bx, 200h

	mov al, SECTORS_TO_LOAD
	mov ch, 00h
	mov cl, 02h
	mov dh, 00h
	mov dl, 00h
	
	mov ah, 02h
	int 13h
	
	jc error_loading_kernel
	cmp ah, 00h
	jne error_loading_kernel
	cmp al, SECTORS_TO_LOAD
	jne error_loading_kernel
	
	cmp word [200h], "TK"
	jne error_loading_kernel
	
	mov si, msg_kernel_loaded
	call puts
	
	ret
	
	error_loading_kernel:
		mov si, msg_error_loading_kernel
		call puts
		
		jmp hang

enter_protected_mode:
	cli
	
	lgdt [temp_gdt_desc]
	
	mov eax, cr0
	or eax, 1
	mov cr0, eax
	
	jmp 08h:pmode
	
	pmode:
		mov ax, 10h
		mov ds, ax
		mov es, ax
		mov ss, ax
		
		mov si, msg_protected_mode
		call puts
		
		ret

puts:
	lodsb
	cmp al, 00h
	je return
	mov ah, 0Eh
	int 10h
	jmp puts

wait_for_any_key:
	mov ah, 00h
	int 16h
	
return:
	ret
	
hang:
	jmp hang

msg_kernel_loaded db "Successfully loaded kernel from floppy disk.", 00h
msg_error_loading_kernel db "Couldn't load kernel from floppy disk.", 00h
msg_protected_mode db "Entered protected mode."
msg_press_any_key db "Press any key to jump to the kernel...", 00h

temp_gdt_desc:
	dw end_temp_gdt - temp_gdt - 1
	dd temp_gdt

temp_gdt:
	; Null descriptor
	dd 0
	dd 0
	
	; Code segment
	dw 0FFFFh
	dw 7C00h
	db 0
	db 10011010b
	db 11001111b
	db 0
	
	; Data segment
	dw 0FFFFh
	dw 7C00h
	db 0
	db 10010010b
	db 11001111b
	db 0
	
end_temp_gdt:

times 510-($-$$) db 0
dw 0AA55h

SECTION .bss
	resb 8192
	stack:
link.ld
(I'm not sure if the SECTIONS part is correct. Should I specify there that the bootloader is loaded to 0x7C00?)

Code: Select all

OUTPUT_FORMAT("binary")

SECTIONS
{
	.text :
	{
		*(.text)
		. = ALIGN(4096);
	}

	.data :
	{
		*(.data)
		*.(rodata)
		. = ALIGN(4096);
	}

	.bss :
	{
		*(.bss)
		. = ALIGN(4096);
	}
}
The problem is that Bochs (which I use to test the bootloader/kernel in) crashes when the "jmp 08h:pmode" instruction under the label "enter_protected_mode" is executed (atleast I think so).

I am not sure about this part. How can this code use the eax register when the computer is in Real Mode? Please explain :D

Code: Select all

	mov eax, cr0
	or eax, 1
	mov cr0, eax
I am also not sure if the base address that I specified in the GDT is correct (0x7C00).

Please help me to enter Protected Mode!

tobbebia
Last edited by tobbebia on Mon Jul 19, 2010 7:59 am, edited 1 time in total.
My GitHub account: http://github.com/tobbebia
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Bootloader - Problem entering protected mode

Post by xenos »

It would be very helpful if you could post Bochs' log file as it contains a lot of useful information, such as the exact location where the code crashes, the reason for that and some register contents. Have a look at the Bochs docs for more information about the log file:

http://bochs.sourceforge.net/doc/docboo ... CHSOPT-LOG

Another thing you might want to try is using Bochs' internal debugger:

http://bochs.sourceforge.net/doc/docboo ... ugger.html
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
tobbebia
Posts: 17
Joined: Fri Feb 19, 2010 1:49 pm
Location: Sweden

Re: Bootloader - Problem entering protected mode

Post by tobbebia »

Thanks for the quick reply!

Here is the log from running the bootloader for a couple of seconds.

Code: Select all

00000000000i[     ] Bochs x86 Emulator 2.4.5
00000000000i[     ]   Build from CVS snapshot, on April 25, 2010
00000000000i[     ] System configuration
00000000000i[     ]   processors: 1 (cores=1, HT threads=1)
00000000000i[     ]   A20 line support: yes
00000000000i[     ] CPU configuration
00000000000i[     ]   level: 6
00000000000i[     ]   SMP support: no
00000000000i[     ]   APIC support: yes
00000000000i[     ]   FPU support: yes
00000000000i[     ]   MMX support: yes
00000000000i[     ]   3dnow! support: no
00000000000i[     ]   SEP support: yes
00000000000i[     ]   SSE support: sse2
00000000000i[     ]   XSAVE support: no
00000000000i[     ]   AES support: no
00000000000i[     ]   MOVBE support: no
00000000000i[     ]   x86-64 support: yes
00000000000i[     ]   1G paging support: no
00000000000i[     ]   MWAIT support: no
00000000000i[     ]   VMX support: no
00000000000i[     ] Optimization configuration
00000000000i[     ]   RepeatSpeedups 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, enabled=yes
00000000000i[     ]   SB16 support: yes
00000000000i[     ]   USB support: yes
00000000000i[     ]   VGA extension support: vbe cirrus
00000000000i[MEM0 ] allocated memory at 041A0020. after alignment, vector=041A1000
00000000000i[MEM0 ] 32,00MB
00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32
00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('E:\Program\Bochs-2.4.5/BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/40448 ('E:\Program\Bochs-2.4.5/VGABIOS-lgpl-latest')
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Sun Jul 18 19:16:55 2010 (time0=1279473415)
00000000000i[DMA  ] channel 4 used by cascade
00000000000i[DMA  ] channel 2 used by Floppy Drive
00000000000i[FDD  ] fd0: 'E:\Programmering\Cygwin\home\Tobbe\tobbes kernel\build\kernel.bin' ro=0, h=2,t=80,spt=18
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: 1680 x 1050
00000000000i[WGUI ] Number of Mouse Buttons = 5
00000000000i[WGUI ] IME disabled
00000000000i[MEM0 ] Register memory access handlers: 0xe0000000 - 0xe0ffffff
00000000000i[CLVGA] VBE Bochs Display Extension Enabled
00000000000i[CLVGA] interval=50000
00000000000i[     ] init_dev of 'unmapped' plugin device by virtual method
00000000000i[     ] init_dev of 'biosdev' plugin device by virtual method
00000000000i[     ] init_dev of 'speaker' plugin device by virtual method
00000000000i[     ] init_dev of 'extfpuirq' plugin device by virtual method
00000000000i[     ] init_dev of 'gameport' 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[     ] init_dev of 'ioapic' plugin device by virtual method
00000000000i[IOAP ] initializing I/O APIC
00000000000i[MEM0 ] Register memory access handlers: 0xfec00000 - 0xfec00fff
00000000000i[     ] init_dev of 'keyboard' plugin device by virtual method
00000000000i[KBD  ] will paste characters every 1000 keyboard ticks
00000000000i[     ] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD   ] Using boot sequence floppy, none, none
00000000000i[HD   ] Floppy boot signature check is enabled
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[     ] register state of 'unmapped' plugin device by virtual method
00000000000i[     ] register state of 'biosdev' plugin device by virtual method
00000000000i[     ] register state of 'speaker' 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 'pci_ide' plugin device by virtual method
00000000000i[     ] register state of 'acpi' plugin device by virtual method
00000000000i[     ] register state of 'ioapic' plugin device by virtual method
00000000000i[     ] register state of 'keyboard' plugin device by virtual method
00000000000i[     ] register state of 'harddrv' 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[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00000000000i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00000000000i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00000000000i[     ] reset of 'unmapped' plugin device by virtual method
00000000000i[     ] reset of 'biosdev' plugin device by virtual method
00000000000i[     ] reset of 'speaker' 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 'pci_ide' plugin device by virtual method
00000000000i[     ] reset of 'acpi' plugin device by virtual method
00000000000i[     ] reset of 'ioapic' plugin device by virtual method
00000000000i[     ] reset of 'keyboard' plugin device by virtual method
00000000000i[     ] reset of 'harddrv' plugin device by virtual method
00000000000i[     ] reset of 'serial' plugin device by virtual method
00000000000i[     ] reset of 'parallel' plugin device by virtual method
00000003305i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00000200000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
00000318057i[KBD  ] reset-disable command received
00000444815i[VBIOS] VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00000444886i[CLVGA] VBE known Display Interface b0c0
00000444918i[CLVGA] VBE known Display Interface b0c5
00000447843i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00000760532i[BIOS ] Starting rombios32
00000761029i[BIOS ] Shutdown flag 0
00000761710i[BIOS ] ram_size=0x02000000
00000762188i[BIOS ] ram_end=32MB
00000802748i[BIOS ] Found 1 cpu(s)
00000822017i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00000822120i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001149817i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001477745i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00001477766i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00001477787i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00001477808i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00001477818i[P2I  ] write: ELCR2 = 0x0a
00001478703i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00001486661i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00001489223i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00001491624i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00001491854i[PIDE ] new BM-DMA address: 0xc000
00001492558i[BIOS ] region 4: 0x0000c000
00001494868i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00001495106i[ACPI ] new irq line = 11
00001495120i[ACPI ] new irq line = 9
00001495150i[ACPI ] new PM base address: 0xb000
00001495164i[ACPI ] new SM base address: 0xb100
00001495192i[PCI  ] setting SMRAM control register to 0x4a
00001659286i[CPU0 ] Enter to System Management Mode
00001659296i[CPU0 ] RSM: Resuming from System Management Mode
00001823316i[PCI  ] setting SMRAM control register to 0x0a
00001832487i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00001834546i[BIOS ] SMBIOS table addr=0x000fbd00
00001836934i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00001840172i[BIOS ] Firmware waking vector 0x1ff00cc
00001851285i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00001852129i[BIOS ] bios_table_cur_addr: 0x000fbe44
00014041546i[BIOS ] Booting from 0000:7c00
00014118696e[CPU0 ] check_cs(0x0008): not a valid code segment !
00014118696e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00014118696e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00014118696i[CPU0 ] CPU is in protected mode (active)
00014118696i[CPU0 ] CS.d_b = 16 bit
00014118696i[CPU0 ] SS.d_b = 16 bit
00014118696i[CPU0 ] EFER   = 0x00000000
00014118696i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00014118696i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00014118696i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00014118696i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00014118696i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00014118696i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00014118696i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00014118696i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00014118696i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00014118696i[CPU0 ] | SEG selector     base    limit G D
00014118696i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00014118696i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00014118696i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00014118696i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00014118696i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00014118696i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00014118696i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00014118696i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00014118696i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00014118696i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00014118696i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00014118696i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00014118696i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00014118696e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00014118696i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00014118696i[CPU0 ] cpu hardware reset
00014118696i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00014118696i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00014118696i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00014118696i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00014118696i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00014118696i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00014118696i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00014118696i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00014118696i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00014118696i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00014118696i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00014118696i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00014118696i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00014118696i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00014118696i[     ] reset of 'unmapped' plugin device by virtual method
00014118696i[     ] reset of 'biosdev' plugin device by virtual method
00014118696i[     ] reset of 'speaker' plugin device by virtual method
00014118696i[     ] reset of 'extfpuirq' plugin device by virtual method
00014118696i[     ] reset of 'gameport' plugin device by virtual method
00014118696i[     ] reset of 'pci_ide' plugin device by virtual method
00014118696i[     ] reset of 'acpi' plugin device by virtual method
00014118696i[     ] reset of 'ioapic' plugin device by virtual method
00014118696i[     ] reset of 'keyboard' plugin device by virtual method
00014118696i[     ] reset of 'harddrv' plugin device by virtual method
00014118696i[     ] reset of 'serial' plugin device by virtual method
00014118696i[     ] reset of 'parallel' plugin device by virtual method
00014122002i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00014436055i[KBD  ] reset-disable command received
00014562813i[VBIOS] 
VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00014562884i[CLVGA] VBE known Display Interface b0c0
00014562916i[CLVGA] VBE known Display Interface b0c5
00014565841i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00014878530i[BIOS ] Starting rombios32
00014879027i[BIOS ] Shutdown flag 0
00014879708i[BIOS ] ram_size=0x02000000
00014880186i[BIOS ] ram_end=32MB
00014920746i[BIOS ] Found 1 cpu(s)
00014940015i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00014940118i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00015267815i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00015595743i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00015595764i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00015595785i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00015595806i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00015595816i[P2I  ] write: ELCR2 = 0x0a
00015596701i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00015604659i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00015607221i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00015609622i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00015610556i[BIOS ] region 4: 0x0000c000
00015612866i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00015613104i[ACPI ] new irq line = 11
00015613118i[ACPI ] new irq line = 9
00015613190i[PCI  ] setting SMRAM control register to 0x4a
00015777284i[CPU0 ] Enter to System Management Mode
00015777294i[CPU0 ] RSM: Resuming from System Management Mode
00015941314i[PCI  ] setting SMRAM control register to 0x0a
00015950485i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00015952544i[BIOS ] SMBIOS table addr=0x000fbd00
00015954932i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00015958170i[BIOS ] Firmware waking vector 0x1ff00cc
00015969283i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00015970127i[BIOS ] bios_table_cur_addr: 0x000fbe44
00028160244i[BIOS ] Booting from 0000:7c00
00028237394e[CPU0 ] check_cs(0x0008): not a valid code segment !
00028237394e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00028237394e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00028237394i[CPU0 ] CPU is in protected mode (active)
00028237394i[CPU0 ] CS.d_b = 16 bit
00028237394i[CPU0 ] SS.d_b = 16 bit
00028237394i[CPU0 ] EFER   = 0x00000000
00028237394i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00028237394i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00028237394i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00028237394i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00028237394i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00028237394i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00028237394i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00028237394i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00028237394i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00028237394i[CPU0 ] | SEG selector     base    limit G D
00028237394i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00028237394i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00028237394i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00028237394i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00028237394i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00028237394i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00028237394i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00028237394i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00028237394i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00028237394i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00028237394i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00028237394i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00028237394i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00028237394e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00028237394i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00028237394i[CPU0 ] cpu hardware reset
00028237394i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00028237394i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00028237394i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00028237394i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00028237394i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00028237394i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00028237394i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00028237394i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00028237394i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00028237394i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00028237394i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00028237394i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00028237394i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00028237394i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00028237394i[     ] reset of 'unmapped' plugin device by virtual method
00028237394i[     ] reset of 'biosdev' plugin device by virtual method
00028237394i[     ] reset of 'speaker' plugin device by virtual method
00028237394i[     ] reset of 'extfpuirq' plugin device by virtual method
00028237394i[     ] reset of 'gameport' plugin device by virtual method
00028237394i[     ] reset of 'pci_ide' plugin device by virtual method
00028237394i[     ] reset of 'acpi' plugin device by virtual method
00028237394i[     ] reset of 'ioapic' plugin device by virtual method
00028237394i[     ] reset of 'keyboard' plugin device by virtual method
00028237394i[     ] reset of 'harddrv' plugin device by virtual method
00028237394i[     ] reset of 'serial' plugin device by virtual method
00028237394i[     ] reset of 'parallel' plugin device by virtual method
00028240700i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00028555057i[KBD  ] reset-disable command received
00028681815i[VBIOS] 
VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00028681886i[CLVGA] VBE known Display Interface b0c0
00028681918i[CLVGA] VBE known Display Interface b0c5
00028684843i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00028997532i[BIOS ] Starting rombios32
00028998029i[BIOS ] Shutdown flag 0
00028998710i[BIOS ] ram_size=0x02000000
00028999188i[BIOS ] ram_end=32MB
00029039772i[BIOS ] Found 1 cpu(s)
00029059041i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00029059144i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00029386841i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00029714769i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00029714790i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00029714811i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00029714832i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00029714842i[P2I  ] write: ELCR2 = 0x0a
00029715727i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00029723685i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00029726247i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00029728648i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00029729582i[BIOS ] region 4: 0x0000c000
00029731892i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00029732130i[ACPI ] new irq line = 11
00029732144i[ACPI ] new irq line = 9
00029732216i[PCI  ] setting SMRAM control register to 0x4a
00029896310i[CPU0 ] Enter to System Management Mode
00029896320i[CPU0 ] RSM: Resuming from System Management Mode
00030060340i[PCI  ] setting SMRAM control register to 0x0a
00030069511i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00030071570i[BIOS ] SMBIOS table addr=0x000fbd00
00030073958i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00030077196i[BIOS ] Firmware waking vector 0x1ff00cc
00030088309i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00030089153i[BIOS ] bios_table_cur_addr: 0x000fbe44
00042278942i[BIOS ] Booting from 0000:7c00
00042356092e[CPU0 ] check_cs(0x0008): not a valid code segment !
00042356092e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00042356092e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00042356092i[CPU0 ] CPU is in protected mode (active)
00042356092i[CPU0 ] CS.d_b = 16 bit
00042356092i[CPU0 ] SS.d_b = 16 bit
00042356092i[CPU0 ] EFER   = 0x00000000
00042356092i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00042356092i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00042356092i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00042356092i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00042356092i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00042356092i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00042356092i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00042356092i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00042356092i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00042356092i[CPU0 ] | SEG selector     base    limit G D
00042356092i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00042356092i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00042356092i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00042356092i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00042356092i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00042356092i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00042356092i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00042356092i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00042356092i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00042356092i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00042356092i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00042356092i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00042356092i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00042356092e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00042356092i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00042356092i[CPU0 ] cpu hardware reset
00042356092i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00042356092i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00042356092i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00042356092i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00042356092i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00042356092i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00042356092i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00042356092i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00042356092i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00042356092i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00042356092i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00042356092i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00042356092i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00042356092i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00042356092i[     ] reset of 'unmapped' plugin device by virtual method
00042356092i[     ] reset of 'biosdev' plugin device by virtual method
00042356092i[     ] reset of 'speaker' plugin device by virtual method
00042356092i[     ] reset of 'extfpuirq' plugin device by virtual method
00042356092i[     ] reset of 'gameport' plugin device by virtual method
00042356092i[     ] reset of 'pci_ide' plugin device by virtual method
00042356092i[     ] reset of 'acpi' plugin device by virtual method
00042356092i[     ] reset of 'ioapic' plugin device by virtual method
00042356092i[     ] reset of 'keyboard' plugin device by virtual method
00042356092i[     ] reset of 'harddrv' plugin device by virtual method
00042356092i[     ] reset of 'serial' plugin device by virtual method
00042356092i[     ] reset of 'parallel' plugin device by virtual method
00042359398i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00042674059i[KBD  ] reset-disable command received
00042800817i[VBIOS] 
VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00042800888i[CLVGA] VBE known Display Interface b0c0
00042800920i[CLVGA] VBE known Display Interface b0c5
00042803845i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00043116534i[BIOS ] Starting rombios32
00043117031i[BIOS ] Shutdown flag 0
00043117712i[BIOS ] ram_size=0x02000000
00043118190i[BIOS ] ram_end=32MB
00043158786i[BIOS ] Found 1 cpu(s)
00043178055i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00043178158i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00043505855i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00043833783i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00043833804i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00043833825i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00043833846i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00043833856i[P2I  ] write: ELCR2 = 0x0a
00043834741i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00043842699i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00043845261i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00043847662i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00043848596i[BIOS ] region 4: 0x0000c000
00043850906i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00043851144i[ACPI ] new irq line = 11
00043851158i[ACPI ] new irq line = 9
00043851230i[PCI  ] setting SMRAM control register to 0x4a
00044015324i[CPU0 ] Enter to System Management Mode
00044015334i[CPU0 ] RSM: Resuming from System Management Mode
00044179354i[PCI  ] setting SMRAM control register to 0x0a
00044188525i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00044190584i[BIOS ] SMBIOS table addr=0x000fbd00
00044192972i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00044196210i[BIOS ] Firmware waking vector 0x1ff00cc
00044207323i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00044208167i[BIOS ] bios_table_cur_addr: 0x000fbe44
00056397640i[BIOS ] Booting from 0000:7c00
00056474790e[CPU0 ] check_cs(0x0008): not a valid code segment !
00056474790e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00056474790e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00056474790i[CPU0 ] CPU is in protected mode (active)
00056474790i[CPU0 ] CS.d_b = 16 bit
00056474790i[CPU0 ] SS.d_b = 16 bit
00056474790i[CPU0 ] EFER   = 0x00000000
00056474790i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00056474790i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00056474790i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00056474790i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00056474790i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00056474790i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00056474790i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00056474790i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00056474790i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00056474790i[CPU0 ] | SEG selector     base    limit G D
00056474790i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00056474790i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00056474790i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00056474790i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00056474790i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00056474790i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00056474790i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00056474790i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00056474790i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00056474790i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00056474790i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00056474790i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00056474790i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00056474790e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00056474790i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00056474790i[CPU0 ] cpu hardware reset
00056474790i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00056474790i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00056474790i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00056474790i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00056474790i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00056474790i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00056474790i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00056474790i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00056474790i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00056474790i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00056474790i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00056474790i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00056474790i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00056474790i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00056474790i[     ] reset of 'unmapped' plugin device by virtual method
00056474790i[     ] reset of 'biosdev' plugin device by virtual method
00056474790i[     ] reset of 'speaker' plugin device by virtual method
00056474790i[     ] reset of 'extfpuirq' plugin device by virtual method
00056474790i[     ] reset of 'gameport' plugin device by virtual method
00056474790i[     ] reset of 'pci_ide' plugin device by virtual method
00056474790i[     ] reset of 'acpi' plugin device by virtual method
00056474790i[     ] reset of 'ioapic' plugin device by virtual method
00056474790i[     ] reset of 'keyboard' plugin device by virtual method
00056474790i[     ] reset of 'harddrv' plugin device by virtual method
00056474790i[     ] reset of 'serial' plugin device by virtual method
00056474790i[     ] reset of 'parallel' plugin device by virtual method
00056478096i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00056793061i[KBD  ] reset-disable command received
00056919781i[VBIOS] 
VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00056919852i[CLVGA] VBE known Display Interface b0c0
00056919884i[CLVGA] VBE known Display Interface b0c5
00056922809i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00057235498i[BIOS ] Starting rombios32
00057235995i[BIOS ] Shutdown flag 0
00057236676i[BIOS ] ram_size=0x02000000
00057237154i[BIOS ] ram_end=32MB
00057277750i[BIOS ] Found 1 cpu(s)
00057297019i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00057297122i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00057624819i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00057952747i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00057952768i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00057952789i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00057952810i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00057952820i[P2I  ] write: ELCR2 = 0x0a
00057953705i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00057961663i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00057964225i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00057966626i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00057967560i[BIOS ] region 4: 0x0000c000
00057969870i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00057970108i[ACPI ] new irq line = 11
00057970122i[ACPI ] new irq line = 9
00057970194i[PCI  ] setting SMRAM control register to 0x4a
00058134288i[CPU0 ] Enter to System Management Mode
00058134298i[CPU0 ] RSM: Resuming from System Management Mode
00058298318i[PCI  ] setting SMRAM control register to 0x0a
00058307489i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00058309548i[BIOS ] SMBIOS table addr=0x000fbd00
00058311936i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00058315174i[BIOS ] Firmware waking vector 0x1ff00cc
00058326287i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00058327131i[BIOS ] bios_table_cur_addr: 0x000fbe44
00070516336i[BIOS ] Booting from 0000:7c00
00070593486e[CPU0 ] check_cs(0x0008): not a valid code segment !
00070593486e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00070593486e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00070593486i[CPU0 ] CPU is in protected mode (active)
00070593486i[CPU0 ] CS.d_b = 16 bit
00070593486i[CPU0 ] SS.d_b = 16 bit
00070593486i[CPU0 ] EFER   = 0x00000000
00070593486i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00070593486i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00070593486i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00070593486i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00070593486i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00070593486i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00070593486i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00070593486i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00070593486i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00070593486i[CPU0 ] | SEG selector     base    limit G D
00070593486i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00070593486i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00070593486i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00070593486i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00070593486i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00070593486i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00070593486i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00070593486i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00070593486i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00070593486i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00070593486i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00070593486i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00070593486i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00070593486e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00070593486i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00070593486i[CPU0 ] cpu hardware reset
00070593486i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00070593486i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00070593486i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00070593486i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00070593486i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00070593486i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00070593486i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00070593486i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00070593486i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00070593486i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00070593486i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00070593486i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00070593486i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00070593486i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00070593486i[     ] reset of 'unmapped' plugin device by virtual method
00070593486i[     ] reset of 'biosdev' plugin device by virtual method
00070593486i[     ] reset of 'speaker' plugin device by virtual method
00070593486i[     ] reset of 'extfpuirq' plugin device by virtual method
00070593486i[     ] reset of 'gameport' plugin device by virtual method
00070593486i[     ] reset of 'pci_ide' plugin device by virtual method
00070593486i[     ] reset of 'acpi' plugin device by virtual method
00070593486i[     ] reset of 'ioapic' plugin device by virtual method
00070593486i[     ] reset of 'keyboard' plugin device by virtual method
00070593486i[     ] reset of 'harddrv' plugin device by virtual method
00070593486i[     ] reset of 'serial' plugin device by virtual method
00070593486i[     ] reset of 'parallel' plugin device by virtual method
00070596792i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00070911073i[KBD  ] reset-disable command received
00071037793i[VBIOS] 
VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00071037864i[CLVGA] VBE known Display Interface b0c0
00071037896i[CLVGA] VBE known Display Interface b0c5
00071040821i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00071353510i[BIOS ] Starting rombios32
00071354007i[BIOS ] Shutdown flag 0
00071354688i[BIOS ] ram_size=0x02000000
00071355166i[BIOS ] ram_end=32MB
00071395750i[BIOS ] Found 1 cpu(s)
00071415019i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00071415122i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00071742819i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00072070747i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00072070768i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00072070789i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00072070810i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00072070820i[P2I  ] write: ELCR2 = 0x0a
00072071705i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00072079663i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00072082225i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00072084626i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00072085560i[BIOS ] region 4: 0x0000c000
00072087870i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00072088108i[ACPI ] new irq line = 11
00072088122i[ACPI ] new irq line = 9
00072088194i[PCI  ] setting SMRAM control register to 0x4a
00072252288i[CPU0 ] Enter to System Management Mode
00072252298i[CPU0 ] RSM: Resuming from System Management Mode
00072416318i[PCI  ] setting SMRAM control register to 0x0a
00072425489i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00072427548i[BIOS ] SMBIOS table addr=0x000fbd00
00072429936i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00072433174i[BIOS ] Firmware waking vector 0x1ff00cc
00072444287i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00072445131i[BIOS ] bios_table_cur_addr: 0x000fbe44
00084635032i[BIOS ] Booting from 0000:7c00
00084712182e[CPU0 ] check_cs(0x0008): not a valid code segment !
00084712182e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00084712182e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00084712182i[CPU0 ] CPU is in protected mode (active)
00084712182i[CPU0 ] CS.d_b = 16 bit
00084712182i[CPU0 ] SS.d_b = 16 bit
00084712182i[CPU0 ] EFER   = 0x00000000
00084712182i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00084712182i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00084712182i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00084712182i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00084712182i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00084712182i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00084712182i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00084712182i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00084712182i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00084712182i[CPU0 ] | SEG selector     base    limit G D
00084712182i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00084712182i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00084712182i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00084712182i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00084712182i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00084712182i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00084712182i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00084712182i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00084712182i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00084712182i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00084712182i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00084712182i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00084712182i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00084712182e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00084712182i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00084712182i[CPU0 ] cpu hardware reset
00084712182i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00084712182i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00084712182i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00084712182i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00084712182i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00084712182i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00084712182i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00084712182i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00084712182i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00084712182i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00084712182i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00084712182i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00084712182i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00084712182i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00084712182i[     ] reset of 'unmapped' plugin device by virtual method
00084712182i[     ] reset of 'biosdev' plugin device by virtual method
00084712182i[     ] reset of 'speaker' plugin device by virtual method
00084712182i[     ] reset of 'extfpuirq' plugin device by virtual method
00084712182i[     ] reset of 'gameport' plugin device by virtual method
00084712182i[     ] reset of 'pci_ide' plugin device by virtual method
00084712182i[     ] reset of 'acpi' plugin device by virtual method
00084712182i[     ] reset of 'ioapic' plugin device by virtual method
00084712182i[     ] reset of 'keyboard' plugin device by virtual method
00084712182i[     ] reset of 'harddrv' plugin device by virtual method
00084712182i[     ] reset of 'serial' plugin device by virtual method
00084712182i[     ] reset of 'parallel' plugin device by virtual method
00084715488i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00085030073i[KBD  ] reset-disable command received
00085156793i[VBIOS] 
VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00085156864i[CLVGA] VBE known Display Interface b0c0
00085156896i[CLVGA] VBE known Display Interface b0c5
00085159821i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00085472510i[BIOS ] Starting rombios32
00085473007i[BIOS ] Shutdown flag 0
00085473688i[BIOS ] ram_size=0x02000000
00085474166i[BIOS ] ram_end=32MB
00085514774i[BIOS ] Found 1 cpu(s)
00085534043i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00085534146i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00085861843i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00086189771i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00086189792i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00086189813i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00086189834i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00086189844i[P2I  ] write: ELCR2 = 0x0a
00086190729i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00086198687i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00086201249i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00086203650i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00086204584i[BIOS ] region 4: 0x0000c000
00086206894i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00086207132i[ACPI ] new irq line = 11
00086207146i[ACPI ] new irq line = 9
00086207218i[PCI  ] setting SMRAM control register to 0x4a
00086371312i[CPU0 ] Enter to System Management Mode
00086371322i[CPU0 ] RSM: Resuming from System Management Mode
00086535342i[PCI  ] setting SMRAM control register to 0x0a
00086544513i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00086546572i[BIOS ] SMBIOS table addr=0x000fbd00
00086548960i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00086552198i[BIOS ] Firmware waking vector 0x1ff00cc
00086563311i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00086564155i[BIOS ] bios_table_cur_addr: 0x000fbe44
00098753728i[BIOS ] Booting from 0000:7c00
00098830878e[CPU0 ] check_cs(0x0008): not a valid code segment !
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00098830878i[CPU0 ] CPU is in protected mode (active)
00098830878i[CPU0 ] CS.d_b = 16 bit
00098830878i[CPU0 ] SS.d_b = 16 bit
00098830878i[CPU0 ] EFER   = 0x00000000
00098830878i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00098830878i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00098830878i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00098830878i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00098830878i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00098830878i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00098830878i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00098830878i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00098830878i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00098830878i[CPU0 ] | SEG selector     base    limit G D
00098830878i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00098830878i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00098830878i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00098830878i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00098830878i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00098830878i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00098830878i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00098830878e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
00098830878i[SYS  ] bx_pc_system_c::Reset(HARDWARE) called
00098830878i[CPU0 ] cpu hardware reset
00098830878i[APIC0] allocate APIC id=0 (MMIO enabled) to 0xfee00000
00098830878i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
00098830878i[CPU0 ] CPUID[0x00000001]: 00000f20 00000800 00002000 078bfbff
00098830878i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
00098830878i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
00098830878i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
00098830878i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
00098830878i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100800
00098830878i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
00098830878i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
00098830878i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
00098830878i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
00098830878i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
00098830878i[CPU0 ] CPUID[0x80000008]: 00003020 00000000 00000000 00000000
00098830878i[     ] reset of 'unmapped' plugin device by virtual method
00098830878i[     ] reset of 'biosdev' plugin device by virtual method
00098830878i[     ] reset of 'speaker' plugin device by virtual method
00098830878i[     ] reset of 'extfpuirq' plugin device by virtual method
00098830878i[     ] reset of 'gameport' plugin device by virtual method
00098830878i[     ] reset of 'pci_ide' plugin device by virtual method
00098830878i[     ] reset of 'acpi' plugin device by virtual method
00098830878i[     ] reset of 'ioapic' plugin device by virtual method
00098830878i[     ] reset of 'keyboard' plugin device by virtual method
00098830878i[     ] reset of 'harddrv' plugin device by virtual method
00098830878i[     ] reset of 'serial' plugin device by virtual method
00098830878i[     ] reset of 'parallel' plugin device by virtual method
00098834184i[BIOS ] $Revision: 1.247 $ $Date: 2010/04/04 19:33:50 $
00099149073i[KBD  ] reset-disable command received
00099275793i[VBIOS] 
VGABios $Id: vgabios.c,v 1.69 2009/04/07 18:18:20 vruppert Exp $

00099275864i[CLVGA] VBE known Display Interface b0c0
00099275896i[CLVGA] VBE known Display Interface b0c5
00099278821i[VBIOS] VBE Bios $Id: vbe.c,v 1.62 2009/01/25 15:46:25 vruppert Exp $
00099591510i[BIOS ] Starting rombios32
00099592007i[BIOS ] Shutdown flag 0
00099592688i[BIOS ] ram_size=0x02000000
00099593166i[BIOS ] ram_end=32MB
00099633726i[BIOS ] Found 1 cpu(s)
00099652995i[BIOS ] bios_table_addr: 0x000fbc18 end=0x000fcc00
00099653098i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00099980795i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00100308723i[P2I  ] PCI IRQ routing: PIRQA# set to 0x0b
00100308744i[P2I  ] PCI IRQ routing: PIRQB# set to 0x09
00100308765i[P2I  ] PCI IRQ routing: PIRQC# set to 0x0b
00100308786i[P2I  ] PCI IRQ routing: PIRQD# set to 0x09
00100308796i[P2I  ] write: ELCR2 = 0x0a
00100309681i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
00100317639i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
00100320201i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
00100322602i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
00100323536i[BIOS ] region 4: 0x0000c000
00100325846i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
00100326084i[ACPI ] new irq line = 11
00100326098i[ACPI ] new irq line = 9
00100326170i[PCI  ] setting SMRAM control register to 0x4a
00100490264i[CPU0 ] Enter to System Management Mode
00100490274i[CPU0 ] RSM: Resuming from System Management Mode
00100654294i[PCI  ] setting SMRAM control register to 0x0a
00100663465i[BIOS ] MP table addr=0x000fbcf0 MPC table addr=0x000fbc20 size=0xd0
00100665524i[BIOS ] SMBIOS table addr=0x000fbd00
00100667912i[BIOS ] ACPI tables: RSDP addr=0x000fbe20 ACPI DATA addr=0x01ff0000 size=0x988
00100671150i[BIOS ] Firmware waking vector 0x1ff00cc
00100682263i[PCI  ] 440FX PMC write to PAM register 59 (TLB Flush)
00100683107i[BIOS ] bios_table_cur_addr: 0x000fbe44
00111300000p[WGUI ] >>PANIC<< POWER button turned off.
00111300000i[CPU0 ] CPU is in real mode (halted)
00111300000i[CPU0 ] CS.d_b = 16 bit
00111300000i[CPU0 ] SS.d_b = 16 bit
00111300000i[CPU0 ] EFER   = 0x00000000
00111300000i[CPU0 ] | RAX=0000000000000000  RBX=0000000000000000
00111300000i[CPU0 ] | RCX=000000000000e080  RDX=0000000000000013
00111300000i[CPU0 ] | RSP=000000000000ff9e  RBP=000000000000ffb0
00111300000i[CPU0 ] | RSI=00000000000e32f8  RDI=000000000000ffac
00111300000i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00111300000i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00111300000i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00111300000i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00111300000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df IF tf SF zf AF PF CF
00111300000i[CPU0 ] | SEG selector     base    limit G D
00111300000i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00111300000i[CPU0 ] |  CS:f000( 0004| 0|  0) 000f0000 0000ffff 0 0
00111300000i[CPU0 ] |  DS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00111300000i[CPU0 ] |  SS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00111300000i[CPU0 ] |  ES:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00111300000i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00111300000i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00111300000i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00111300000i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00111300000i[CPU0 ] | RIP=00000000000008d4 (00000000000008d4)
00111300000i[CPU0 ] | CR0=0x60000010 CR2=0x0000000000000000
00111300000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00111300000i[CPU0 ] 0x00000000000008d4>> mov ax, 0x046c : B86C04
00111300000i[CMOS ] Last time is 1279473439 (Sun Jul 18 19:17:19 2010)
00111300000i[     ] restoring default signal behavior
00111300000i[CTRL ] quit_sim called with exit code 1
I am going to read the page about Bochs internal debugger and see if I can use it.

Thanks again.
tobbebia
My GitHub account: http://github.com/tobbebia
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:

Re: Bootloader - Problem entering protected mode

Post by Combuster »

There's no need to post the log of 10 resets worth of crashes. The only thing that achieved is that it tells us that you didn't really look at it yourself.

Look at the first error in the log, it tells you exactly what's wrong. The dump that follows also tells you exactly where: at the jump far 0x8:label. That should be enough of a starting position to work from.

Code: Select all

00098830878e[CPU0 ] check_cs(0x0008): not a valid code segment !
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00098830878i[CPU0 ] CPU is in protected mode (active)
00098830878i[CPU0 ] CS.d_b = 16 bit
00098830878i[CPU0 ] SS.d_b = 16 bit
00098830878i[CPU0 ] EFER   = 0x00000000
00098830878i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00098830878i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00098830878i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00098830878i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00098830878i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00098830878i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00098830878i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00098830878i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00098830878i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00098830878i[CPU0 ] | SEG selector     base    limit G D
00098830878i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00098830878i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00098830878i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00098830878i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00098830878i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00098830878i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00098830878i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00098830878e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
EDIT: if you look at bochs manual, you can find a bochsrc option that stops bochs from restarting on a crash.
"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 ]
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Bootloader - Problem entering protected mode

Post by xenos »

OK, so here's the interesting part:

Code: Select all

00098830878e[CPU0 ] check_cs(0x0008): not a valid code segment !
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00098830878i[CPU0 ] CPU is in protected mode (active)
00098830878i[CPU0 ] CS.d_b = 16 bit
00098830878i[CPU0 ] SS.d_b = 16 bit
00098830878i[CPU0 ] EFER   = 0x00000000
00098830878i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00098830878i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00098830878i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00098830878i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00098830878i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00098830878i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00098830878i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00098830878i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00098830878i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00098830878i[CPU0 ] | SEG selector     base    limit G D
00098830878i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00098830878i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00098830878i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00098830878i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00098830878i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00098830878i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00098830878i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00098830878e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
Obviously the far jump into your protected mode code fails and bochs complains that 0x08 is not a valid code segment. The segment descriptor looks fine to me (although it is rather unusual to have a code segment starting at 0x7C00, since most people prefer a flat memory model, but that's a matter of taste), but I'm a bit suspicious about loading the GDT. There should be no "-1" in the GDT length field, and the GDT base field should contain a linear address, i.e. not relative to a segment. But since your link your code with a segment offset of 0x7c00, the linker puts a wrong value into the base field. You could fix this by changing your code like this:

Code: Select all

temp_gdt_desc:
   dw end_temp_gdt - temp_gdt
   dd temp_gdt + 0x7c00
There might be other issues which I don't see at the moment. I would recommend using a flat memory model as it is much simpler to use. Segmentation requires that you keep track of segment base addresses and maintain a proper conversion between segmented and linear addresses, which may become a mess.
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
StephanvanSchaik
Member
Member
Posts: 127
Joined: Sat Sep 29, 2007 5:43 pm
Location: Amsterdam, The Netherlands

Re: Bootloader - Problem entering protected mode

Post by StephanvanSchaik »

XenOS wrote:but I'm a bit suspicious about loading the GDT. There should be no "-1" in the GDT length field
The Intel manuals seems to disagree with you here.
"Because segment descriptors are always 8 bytes long, the GDT limit should always be one less than an integral multiple of eight (that is, 8N – 1)." - Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 3A: System Programming Guide.

For the rest the segments are fine, but OP, as you mentioned before, loads the GDTR from the incorrect location which is what causes Bochs, and real machines as well, to cough up errors.


Regards,
Stephan J.R. van Schaik.
User avatar
xenos
Member
Member
Posts: 1121
Joined: Thu Aug 11, 2005 11:00 pm
Libera.chat IRC: xenos1984
Location: Tartu, Estonia
Contact:

Re: Bootloader - Problem entering protected mode

Post by xenos »

StephanVanSchaik wrote:The Intel manuals seems to disagree with you here.
"Because segment descriptors are always 8 bytes long, the GDT limit should always be one less than an integral multiple of eight (that is, 8N – 1)." - Intel® 64 and IA-32 Architectures Software Developer's Manual Volume 3A: System Programming Guide.
You're right. To add a bit more context:
The limit value for the GDT is expressed in bytes. As with segments, the limit value is added to the base address to get the address of the last valid byte. A limit value of 0 results in exactly one valid byte. Because segment descriptors are always 8 bytes long, the GDT limit should always be one less than an integral multiple of eight (that is, 8N – 1).
I guess I was a bit confused because Vol. 2A, LGDT / LLDT / LIDT instruction, says that...
The source operand specifies a 6-byte memory location that contains the base address (a linear address) and the limit (size of table in bytes) of the global descriptor table (GDT) or the interrupt descriptor table (IDT).
So it should actually be (size of table in bytes - 1).
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS
StephanvanSchaik
Member
Member
Posts: 127
Joined: Sat Sep 29, 2007 5:43 pm
Location: Amsterdam, The Netherlands

Re: Bootloader - Problem entering protected mode

Post by StephanvanSchaik »

AMD's Volume 2 seems to say: "These bits define the 16-bit limit, or size, of the GDT in bytes." as well. It's kind of annoying when specifications are half-baked.


Regards,
Stephan J.R. van Schaik.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Bootloader - Problem entering protected mode

Post by egos »

GDT limit = GDT size - 1

Code: Select all

pmode:
  mov ax,10h
  mov ds,ax
  mov es,ax
  mov ss,ax
  mov si,msg_protected_mode
  call puts
  ret
Well :-D You define 32-bit segments, but use 16-bit code. This is incorrect. Reset flag in segment descriptors or use something like use32 with 32-bit code. And forget about BIOS service in PM.
If you have seen bad English in my words, tell me what's wrong, please.
tobbebia
Posts: 17
Joined: Fri Feb 19, 2010 1:49 pm
Location: Sweden

Re: Bootloader - Problem entering protected mode

Post by tobbebia »

egos wrote:GDT limit = GDT size - 1

Code: Select all

pmode:
  mov ax,10h
  mov ds,ax
  mov es,ax
  mov ss,ax
  mov si,msg_protected_mode
  call puts
  ret
Well :-D You define 32-bit segments, but use 16-bit code. This is incorrect. Reset flag in segment descriptors or use something like use32 with 32-bit code. And forget about BIOS service in PM.
What was I thinking :P I have removed this part now:

Code: Select all

  mov si,msg_protected_mode
  call puts
How can i change the code under the "pmode" label to 32-bit?

From NASM docs:
When NASM is in BITS 16 mode, instructions which use 32-bit data are prefixed with an 0x66 byte.
Does this prevent me from changing that part to 32-bit?


Thanks for your reply!
tobbebia
My GitHub account: http://github.com/tobbebia
tobbebia
Posts: 17
Joined: Fri Feb 19, 2010 1:49 pm
Location: Sweden

Re: Bootloader - Problem entering protected mode

Post by tobbebia »

XenOS wrote:OK, so here's the interesting part:

Code: Select all

00098830878e[CPU0 ] check_cs(0x0008): not a valid code segment !
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00098830878e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00098830878i[CPU0 ] CPU is in protected mode (active)
00098830878i[CPU0 ] CS.d_b = 16 bit
00098830878i[CPU0 ] SS.d_b = 16 bit
00098830878i[CPU0 ] EFER   = 0x00000000
00098830878i[CPU0 ] | RAX=0000000060000011  RBX=0000000000000200
00098830878i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00098830878i[CPU0 ] | RSP=0000000000002ffe  RBP=0000000000000000
00098830878i[CPU0 ] | RSI=00000000000e00bb  RDI=000000000000ffac
00098830878i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00098830878i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00098830878i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00098830878i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00098830878i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00098830878i[CPU0 ] | SEG selector     base    limit G D
00098830878i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00098830878i[CPU0 ] |  CS:07c0( 0004| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  DS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  SS:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  ES:07c0( 0005| 0|  0) 00007c00 0000ffff 0 0
00098830878i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00098830878i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00098830878i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00098830878i[CPU0 ] | RIP=0000000000000065 (0000000000000065)
00098830878i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00098830878i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00098830878i[CPU0 ] 0x0000000000000065>> jmp far 0008:006a : EA6A000800
00098830878e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
Obviously the far jump into your protected mode code fails and bochs complains that 0x08 is not a valid code segment. The segment descriptor looks fine to me (although it is rather unusual to have a code segment starting at 0x7C00, since most people prefer a flat memory model, but that's a matter of taste), but I'm a bit suspicious about loading the GDT. There should be no "-1" in the GDT length field, and the GDT base field should contain a linear address, i.e. not relative to a segment. But since your link your code with a segment offset of 0x7c00, the linker puts a wrong value into the base field. You could fix this by changing your code like this:

Code: Select all

temp_gdt_desc:
   dw end_temp_gdt - temp_gdt
   dd temp_gdt + 0x7c00
There might be other issues which I don't see at the moment. I would recommend using a flat memory model as it is much simpler to use. Segmentation requires that you keep track of segment base addresses and maintain a proper conversion between segmented and linear addresses, which may become a mess.
Thanks for your post!

I have changed my linker script to this:

Code: Select all

OUTPUT_FORMAT("binary")

SECTIONS
{
	.text 0x7C00:
	{
		*(.text)
		. = ALIGN(4096);
	}

	.data :
	{
		*(.data)
		*.(rodata)
		. = ALIGN(4096);
	}

	.bss :
	{
		*(.bss)
		. = ALIGN(4096);
	}
}

Code: Select all

.text 0x7C00:
Is this part equal to putting "[ORG 0x7C00]" at the top of an asm file?

If I jump to a label, the part above adds 0x7C00 to the label address within the file. Is that correct? Sorry, I'm very new to this!

I have now changed the code in the bootloader so that the segment registers don't get loaded with 0x7C0, but instead I put 0 in them. This is what you meant by a flat memory model right?

Now I dont have to change this:

Code: Select all

dd temp_gdt
Correct?

Tthe bootloader manages to return from the "enter_protected_mode" function now.
But when i try to jump to the kernel it crashes again, here is the error in the log:

Code: Select all

00014118699e[CPU0 ] write_virtual_checks(): write beyond limit, r/w
00014118699e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x0d)
00014118699e[CPU0 ] interrupt(): gate descriptor is not valid sys seg (vector=0x08)
00014118699i[CPU0 ] CPU is in protected mode (active)
00014118699i[CPU0 ] CS.d_b = 32 bit
00014118699i[CPU0 ] SS.d_b = 32 bit
00014118699i[CPU0 ] EFER   = 0x00000000
00014118699i[CPU0 ] | RAX=00000000d88e0010  RBX=0000000000007e00
00014118699i[CPU0 ] | RCX=0000000000000002  RDX=0000000000000000
00014118699i[CPU0 ] | RSP=000000000000a002  RBP=0000000000000000
00014118699i[CPU0 ] | RSI=00000000000e7cb2  RDI=000000000000ffac
00014118699i[CPU0 ] |  R8=0000000000000000   R9=0000000000000000
00014118699i[CPU0 ] | R10=0000000000000000  R11=0000000000000000
00014118699i[CPU0 ] | R12=0000000000000000  R13=0000000000000000
00014118699i[CPU0 ] | R14=0000000000000000  R15=0000000000000000
00014118699i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af PF cf
00014118699i[CPU0 ] | SEG selector     base    limit G D
00014118699i[CPU0 ] | SEG sltr(index|ti|rpl)     base    limit G D
00014118699i[CPU0 ] |  CS:0008( 0001| 0|  0) 00000000 ffffffff 1 1
00014118699i[CPU0 ] |  DS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00014118699i[CPU0 ] |  SS:0010( 0002| 0|  0) 00000000 ffffffff 1 1
00014118699i[CPU0 ] |  ES:0010( 0002| 0|  0) 00000000 ffffffff 1 1
00014118699i[CPU0 ] |  FS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00014118699i[CPU0 ] |  GS:0000( 0005| 0|  0) 00000000 0000ffff 0 0
00014118699i[CPU0 ] |  MSR_FS_BASE:0000000000000000
00014118699i[CPU0 ] |  MSR_GS_BASE:0000000000000000
00014118699i[CPU0 ] | RIP=0000000000b87e04 (0000000000b87e04)
00014118699i[CPU0 ] | CR0=0x60000011 CR2=0x0000000000000000
00014118699i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00014118699i[CPU0 ] 0x0000000000b87e04>> add byte ptr ds:[eax], al : 0000
00014118699e[CPU0 ] exception(): 3rd (13) exception with no resolution, shutdown status is 00h, resetting
And here is the new bootloader.s:

Code: Select all

[BITS 16]
%define SECTORS_TO_LOAD 1

jmp bootloader_entry

bootloader_entry:
	mov ax, cs
	mov ds, ax
	mov es, ax
	mov ss, ax

	mov sp, stack

	call load_kernel
	call enter_protected_mode

	jmp 7E02h
	
load_kernel:
	mov ax, 0000h
	mov es, ax
	mov bx, 7E00h

	mov al, SECTORS_TO_LOAD
	mov ch, 00h
	mov cl, 02h
	mov dh, 00h
	mov dl, 00h
	
	mov ah, 02h
	int 13h
	
	jc error_loading_kernel
	cmp ah, 00h
	jne error_loading_kernel
	cmp al, SECTORS_TO_LOAD
	jne error_loading_kernel
	
	cmp word [7E00h], "TK"
	jne error_loading_kernel
	
	mov si, msg_kernel_loaded
	call puts
	
	ret
	
	error_loading_kernel:
		mov si, msg_error_loading_kernel
		call puts
		
		jmp hang

enter_protected_mode:
	cli
	
	lgdt [temp_gdt_desc]
	
	mov eax, cr0
	or eax, 1
	mov cr0, eax
	
	jmp 08h:pmode
	
	pmode:
		mov ax, 10h
		mov ds, ax
		mov es, ax
		mov ss, ax
		
		ret
	
puts:
	lodsb
	cmp al, 00h
	je return
	mov ah, 0Eh
	int 10h
	jmp puts

wait_for_any_key:
	mov ah, 00h
	int 16h
	
return:
	ret
	
hang:
	jmp hang

msg_kernel_loaded db "Successfully loaded kernel from floppy disk.", 00h
msg_error_loading_kernel db "Couldn't load kernel from floppy disk.", 00h
msg_protected_mode db "Entered protected mode."
msg_press_any_key db "Press any key to jump to the kernel...", 00h

temp_gdt_desc:
	dw end_temp_gdt - temp_gdt - 1
	dd temp_gdt

temp_gdt:
	; Null descriptor
	dd 0
	dd 0
	
	; Code segment
	dw 0FFFFh
	dw 0000h
	db 0
	db 10011010b
	db 11001111b
	db 0
	
	; Data segment
	dw 0FFFFh
	dw 0000h
	db 0
	db 10010010b
	db 11001111b
	db 0
	
end_temp_gdt:

times 510-($-$$) db 0
dw 0AA55h

SECTION .bss
	resb 8192
	stack:
Any ideas?
tobbebia
My GitHub account: http://github.com/tobbebia
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Bootloader - Problem entering protected mode

Post by egos »

tobbebia wrote:How can i change the code under the "pmode" label to 32-bit?
Replace "puts" subroutine before "pmode" label and put "[BITS 32]" directive after it.
If you have seen bad English in my words, tell me what's wrong, please.
tobbebia
Posts: 17
Joined: Fri Feb 19, 2010 1:49 pm
Location: Sweden

Re: Bootloader - Problem entering protected mode

Post by tobbebia »

Problem solved.

I rebuilt the bootloader.s from scratch. This time a put four entries in the GDT. The first one is obviously the null descriptor. The second entry is for the bootloaders code segment (specified 16-bit). The third one is for the kernels code segment (specified 32-bit). The fourth one is for the kernels data segment.

After changing to protected mode by altering the CR0 register this code changes cs to 8 (the bootloaders code segment):

Code: Select all

jmp 8:pmode
pmode:
Then this code sets ds, es, ss to 0x18 (the kernels data segment):

Code: Select all

mov ax, 18h
mov ds, ax
mov es, ax
mov ss, ax
At last this code jumps to the kernel and sets cs to 0x10 (the kernels code segment):

Code: Select all

extern kernel
jmp 10h:kernel
The new bootloader.s looks like this (swedish comments removed):

Code: Select all

[BITS 16]

%define SECTORS_TO_LOAD 1
%define BOOTLOADER_START 7C00h
%define KERNEL_DESTINATION 7E00h
%define KERNEL_SIGNATURE "KE"


mov ax, cs
mov ds, ax
mov es, ax
mov ss, ax

mov al, 3
mov ah, 0
int 10h

mov bx, KERNEL_DESTINATION
mov al, SECTORS_TO_LOAD
mov ch, 0
mov cl, 2
mov dh, 0
mov dl, 0

mov ah, 2
int 13h

jc error_loading_kernel
cmp ah, 0
jne error_loading_kernel
cmp al, SECTORS_TO_LOAD
jne error_loading_kernel

cmp word [KERNEL_DESTINATION], KERNEL_SIGNATURE
jne error_loading_kernel

cli

lgdt [temp_gdtd]

mov eax, cr0
or eax, 1
mov cr0, eax

jmp 8:pmode

pmode:

mov ax, 18h
mov ds, ax
mov es, ax
mov ss, ax

extern kernel
jmp 10h:kernel

error_msg db "Error loading kernel.", 0

error_loading_kernel:
	mov si, error_msg
	
	next_char:
		lodsb
		cmp al, 0
		je hang
		mov ah, 0Eh
		int 10h
		jmp next_char
		
	hang:
		jmp hang

temp_gdtd:
	dw temp_gdt_end - temp_gdt - 1
	dd temp_gdt

temp_gdt:
	; Null descriptorn
	dd 0
	dd 0
	
	; Bootloaders code segment
	dw (KERNEL_DESTINATION - 1) & 0FFFFh
	dw 0
	db 0
	db 10011010b
	db (((KERNEL_DESTINATION - 1) >> 16) & 0Fh) | (0000b << 4)
	db 0
	
	; Kernels code segment
	dw 0FFFFh
	dw 0
	db 0
	db 10011010b
	db 0Fh | (1100b << 4)
	db 0
	
	; Kernels data segment
	dw 0FFFFh
	dw 0
	db 0
	db 10010010b
	db 0Fh | (1100b << 4)
	db 0
	
temp_gdt_end:

times 510-($-$$) db 0
dw 0AA55h
Thanks to everyone who helped me.
tobbebia
My GitHub account: http://github.com/tobbebia
Post Reply