I am (finally) implementing the ability to load sectors in my OS. Since my os is only 512 bytes, I have decided to save space and instead of having the user type what sector they want loaded, they press keys F1-F3 to load sectors 1-3 respectively (I am adding F4-F12 later...).
The problem is that when loading a sector, the OS crashes in bochs with the message "00068675875p[CPU0 ] >>PANIC<< prefetch: RIP > CS.limit"
Sectors are loaded to 0x2000:0x0000
Here is the F* key handiling and sector loading code:
Code: Select all
<snip>
;this is called after main command prompt detects extended keystroke
sectcomp: ;sector loading f1-f3 key compare routine
cmp ah, 0x3B ;3B=code for F1, which is the sector that the OS is on.
je reload
cmp ah, 0x3C ;3C=code for F2
je loadsect2
cmp ah, 0x3D ;3D=code for F3
je loadsect3
jmp CmdPrompt ;invalid keystroke, go back to cmd prompt
<snip>
;actual loading/jumping code
;the code for the "loadsect3" label is identical except it loads sector 3
loadsect2:
mov bx, 0x2000
mov es, bx
mov bx, 0x0000
mov ah, 02
mov al, 01
mov ch, 01
mov cl, 02
mov dh, 01
mov dl, 00
int 0x13
jmp far 0x2000:0x0000
Code: Select all
00000000000i[ ] Bochs x86 Emulator 2.2.pre3
00000000000i[ ] Build from CVS snapshot on April 16, 2005
00000000000i[ ] System configuration
00000000000i[ ] processors: 1
00000000000i[ ] A20 line support: yes
00000000000i[ ] APIC support: yes
00000000000i[ ] CPU configuration
00000000000i[ ] level: 6
00000000000i[ ] fpu support: yes
00000000000i[ ] paging support: yes, tlb enabled: yes
00000000000i[ ] mmx support: yes
00000000000i[ ] sse support: 1
00000000000i[ ] v8086 mode support: yes
00000000000i[ ] 3dnow! support: no
00000000000i[ ] PAE support: yes
00000000000i[ ] PGE support: yes
00000000000i[ ] PSE support: yes
00000000000i[ ] x86-64 support: no
00000000000i[ ] SEP support: no
00000000000i[ ] Optimization configuration
00000000000i[ ] Guest2HostTLB support: yes
00000000000i[ ] RepeatSpeedups support: yes
00000000000i[ ] Icache support: yes
00000000000i[ ] Host Asm support: yes
00000000000i[ ] Fast function calls: yes
00000000000i[MEM0 ] allocated memory at 013E0020. after alignment, vector=013E1000
00000000000i[MEM0 ] 32.00MB
00000000000i[MEM0 ] rom at 0xf0000/65536 ('../BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/32768 ('../VGABIOS-lgpl-latest')
00000000000i[APIC?] local apic in initializing
00000000000i[APIC0] 80686
00000000000i[APIC0] local apic in CPU apicid=00 initializing
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Sat May 14 11:54:04 2005 (time0=1116086044)
00000000000i[DMA ] channel 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive
00000000000i[FDD ] fd0: 'px.img' ro=0, h=2,t=80,spt=18
00000000000i[FDD ] tried to open 'floppyb.img' read/write: No such file or directory
00000000000i[FDD ] tried to open 'floppyb.img' read only: No such file or directory
00000000000i[FDD ] fd1: 'floppyb.img' ro=1, h=0,t=0,spt=0
00000000000i[WGUI ] Number of Mouse Buttons = 3
00000000000i[WGUI ] IME disabled
00000000000i[CLVGA] VBE Bochs Display Extension Enabled
00000000000i[CLVGA] interval=30000
00000000000i[CLVGA] CL-GD5430 ISA initialized
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_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 '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[ ] 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
00000004163i[BIOS ] rombios.c,v 1.131 2005/04/06 18:01:14 vruppert Exp $
00000330070i[KBD ] reset-disable command received
00000451783i[VBIOS] VGABios $Id: vgabios.c,v 1.59 2004/07/18 20:22:43 vruppert Exp $
00000451853i[CLVGA] VBE known Display Interface b0c0
00000451885i[CLVGA] VBE known Display Interface b0c3
00000454810i[VBIOS] VBE Bios $Id: vbe.c,v 1.45 2004/07/22 18:37:29 vruppert Exp $
00000480000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
00068642156i[FDD ] read() on floppy image returns 0
00068675875p[CPU0 ] >>PANIC<< prefetch: RIP > CS.limit
00068675875i[SYS ] Last time is 1116086181
00068675875i[CPU0 ] real mode
00068675875i[CPU0 ] CS.d_b = 16 bit
00068675875i[CPU0 ] SS.d_b = 16 bit
00068675875i[CPU0 ] | EAX=0fff0001 EBX=00000000 ECX=000b0102 EDX=00000100
00068675875i[CPU0 ] | ESP=00008000 EBP=00000000 ESI=00007d1c EDI=0000ffde
00068675875i[CPU0 ] | IOPL=0 NV UP DI PL NZ NA PO NC
00068675875i[CPU0 ] | SEG selector base limit G D
00068675875i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00068675875i[CPU0 ] | CS:2000( 0000| 0| 0) 00020000 0000ffff 0 0
00068675875i[CPU0 ] | DS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00068675875i[CPU0 ] | SS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00068675875i[CPU0 ] | ES:2000( 0000| 0| 0) 00020000 0000ffff 0 0
00068675875i[CPU0 ] | FS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00068675875i[CPU0 ] | GS:0000( 0000| 0| 0) 00000000 0000ffff 0 0
00068675875i[CPU0 ] | EIP=00010000 (00010000)
00068675875i[CPU0 ] | CR0=0x00000010 CR1=0 CR2=0x00000000
00068675875i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00068675875i[ ] restoring default signal behavior
00068675875i[CTRL ] quit_sim called with exit code 1
What is causing this PANIC?
-Anthony