I have setup v8086 threads which appear to work just fine (following tim's tutorual i can see the 16-bit code running and filling the registers as i expect and priviledged instructions cause a GPF which is also expected)
So i am trying to setup the handler for priviledge instructions to put the final touches on it....but it isn't working very well
So right now here's my issue. The iret returning from the GPF seems to not be happy.
here's some bochs output of the offending iret
Code: Select all
00243848161i[CPU0 ] -----------------------------------
00243848161i[CPU0 ] selector->index*8 + 7 = 28679
00243848161i[CPU0 ] gdtr.limit = 2047
00243848161i[CPU0 ] fetch_raw_descriptor: GDT: index > limit
00243848161i[CPU0 ] | EAX=00000013 EBX=bbbbbbbb ECX=cccccccc EDX=dddddddd
00243848161i[CPU0 ] | ESP=e0011030 EBP=33333333 ESI=22222222 EDI=11111111
00243848161i[CPU0 ] | IOPL=0 NV UP EI NG NZ AC PE NC
00243848161i[CPU0 ] | SEG selector base limit G D
00243848161i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00243848161i[CPU0 ] | DS:0000( 0000| 0| 0) 00000000 000fffff 1 1
00243848161i[CPU0 ] | ES:0000( 0000| 0| 0) 00000000 000fffff 1 1
00243848161i[CPU0 ] | FS:0000( 0000| 0| 0) 00000000 000fffff 1 1
00243848161i[CPU0 ] | GS:0000( 0000| 0| 0) 00000000 000fffff 1 1
00243848161i[CPU0 ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00243848161i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00243848161i[CPU0 ] | EIP=c0100192 (c0100191)
00243848161i[CPU0 ] | CR0=0xe0000011 CR1=0x00000000 CR2=0x00000000
00243848161i[CPU0 ] | CR3=0x01fdd000 CR4=0x00000000
00243848161i[CPU0 ] >> cf
00243848161i[CPU0 ] >> : iret
00243848161i[CPU0 ] -----------------------------------
anyway. if i stop just before the iret here's my stack layout (which looks ok to me)
Code: Select all
0xe0011030: 0x00000000 (this is the pushed errcode)
0xe0011034: 0x00007003 (this is the IP i want to end up at)
0xe0011038: 0x00000000 (this is the CS i want to end up at)
0xe001103c: 0x00030202 (these are the eflags for after the iret)
0xe0011040: 0x00008000 (this is the SP i want to end up with)
0xe0011044: 0x00000000 (this is the SS i want to end up with)
0xe0011048: 0x00000040 (this is my expected ES)
0xe001104c: 0x00000041 (this is my expected DS)
0xe0011050: 0x00000042 (this is my expected FS)
0xe0011054: 0x00000043 (this is my expected GS)
The odd thing is that if my exception handler does NO work at all, i still get this error (which i would expect it to resume and then re-issue the exception in an infinite loop...)
anyone have a clue?
proxy