Code: Select all
void main()
{
init_sys();
add_Task(...);
asm("jmp $0x50,$0"); // switch to new task
}
Problem is that under Bochs my VM is reseting and in log I'm getting something like this
Code: Select all
00004601482i[FDD ] partial read() on floppy image returns 192/512
00004618365i[CPU0 ] read_virtual_checks(): read beyond limit
00004618377i[CPU0 ] read_virtual_checks(): read beyond limit
00004618389i[CPU0 ] read_virtual_checks(): read beyond limit
(Last line is repeated many times and at after that I have)
00009269278i[CPU0 ] can_push(): expand-up: esp < N
00009269278i[CPU0 ] can_push(): expand-up: esp < N
00009269278e[CPU0 ] exception(): 3rd (12) exception with no resolution, shutdown status is 00h, resetting
I don't know what I'm doing wrong. I've tried to decrease TSS limit to be below 0x67. Then I'm getting 10th exception so till this moment everything is ok - 3rd point of task switching in intel manual (page 6-13). I've set T flag in TSS but I'm not getting 1st exception so somewhere between points 4 - 14 (intel manual) in task switching somethings goes wrong. At the end of Bochs log I've
Code: Select all
00009269278i[CPU0 ] protected mode
00009269278i[CPU0 ] CS.d_b = 32 bit
00009269278i[CPU0 ] SS.d_b = 32 bit
00009269278i[CPU0 ] | EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000000
00009269278i[CPU0 ] | ESP=00000003 EBP=0000000f ESI=00000000 EDI=00000000
00009269278i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df if tf sf zf af pf cf
00009269278i[CPU0 ] | SEG selector base limit G D
00009269278i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00009269278i[CPU0 ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00009269278i[CPU0 ] | DS:000c( 0001| 1| 0) 00011260 0000ffff 0 1
00009269278i[CPU0 ] | SS:002c( 0005| 1| 0) 000bfffc 0000ffff 0 1
00009269278i[CPU0 ] | ES:000c( 0001| 1| 0) 00011260 0000ffff 0 1
00009269278i[CPU0 ] | FS:000c( 0001| 1| 0) 00011260 0000ffff 0 1
00009269278i[CPU0 ] | GS:000c( 0001| 1| 0) 00011260 0000ffff 0 1
00009269278i[CPU0 ] | EIP=00010099 (00010099)
00009269278i[CPU0 ] | CR0=0x00000019 CR1=0 CR2=0x00000000
00009269278i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
When I delete asm("jmp $0x50,$0"); instruction from my code everything works fine.
If anyone know what is wrong, what should I check or how to get more info from bochs than 'read_virtual_checks...' Iwould be very grateful.