I hadn't done anything on my OS for about a month, and I recently started working on it again, e.g. I have rewritten the memory manager to optimize it for use with paging, finished the FAT filesystem, and now I'm working on user-mode.
I have made kernel pages and user-mode GDT entries user accessible for now.
I am using a .COM pure binary to test user-mode programs.
MOV instructions and memory accessing through DS segment seems to work without problems, but when the program executes an system call handler, e.g. (INT 0x90), it triple page faults.
I have enabled CPU0 logging in bochsdbg and this is I've found this happens because of 0xFFFFFFFC memory access (page not exists)??
Code: Select all
00017417572d[CPU0 ] interrupt(): vector = 90, TYPE = 4, EXT = 0
00017417572d[CPU0 ] interrupt(): INTERRUPT TO INNER PRIVILEGE
00017417572d[CPU0 ] page walk for address 0x00000000c080000e
00017417572d[CPU0 ] page walk for address 0x00000000fffffffc
00017417572d[CPU0 ] PTE: entry not present
00017417572d[CPU0 ] page fault for address 00000000fffffffc @ 0000000000002019
00017417572d[CPU0 ] exception(0x0e): error_code=0002
00017417572d[CPU0 ] interrupt(): vector = 0e, TYPE = 3, EXT = 1
00017417572d[CPU0 ] interrupt(): INTERRUPT TO INNER PRIVILEGE
00017417572d[CPU0 ] page walk for address 0x00000000fffffffc
00017417572d[CPU0 ] PTE: entry not present
00017417572d[CPU0 ] page fault for address 00000000fffffffc @ 0000000000002017
00017417572d[CPU0 ] exception(0x0e): error_code=0002
00017417572d[CPU0 ] exception(0x08): error_code=0000
00017417572d[CPU0 ] interrupt(): vector = 08, TYPE = 3, EXT = 1
00017417572d[CPU0 ] interrupt(): INTERRUPT TO INNER PRIVILEGE
00017417572d[CPU0 ] page walk for address 0x00000000fffffffc
00017417572d[CPU0 ] PTE: entry not present
00017417572d[CPU0 ] page fault for address 00000000fffffffc @ 0000000000002017
00017417572d[CPU0 ] exception(0x0e): error_code=0002
00017417572i[CPU0 ] CPU is in protected mode (active)
00017417572i[CPU0 ] CS.mode = 32 bit
00017417572i[CPU0 ] SS.mode = 32 bit
00017417572i[CPU0 ] EFER = 0x00000000
00017417572i[CPU0 ] | EAX=00000000 EBX=00000000 ECX=0000201a EDX=00000000
00017417572i[CPU0 ] | ESP=00003006 EBP=00003006 ESI=c0100ca0 EDI=00000000
00017417572i[CPU0 ] | IOPL=0 id vip vif ac vm RF nt of df IF tf sf ZF af PF cf
00017417572i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00017417572i[CPU0 ] | CS:0023( 0004| 0| 3) 00000000 ffffffff 1 1
00017417572i[CPU0 ] | DS:001b( 0003| 0| 3) 00000000 ffffffff 1 1
00017417572i[CPU0 ] | SS:001b( 0003| 0| 3) 00000000 ffffffff 1 1
00017417572i[CPU0 ] | ES:001b( 0003| 0| 3) 00000000 ffffffff 1 1
00017417572i[CPU0 ] | FS:001b( 0003| 0| 3) 00000000 ffffffff 1 1
00017417572i[CPU0 ] | GS:001b( 0003| 0| 3) 00000000 ffffffff 1 1
00017417572i[CPU0 ] | EIP=00002017 (00002017)
00017417572i[CPU0 ] | CR0=0xe0000011 CR2=0xfffffffc
00017417572i[CPU0 ] | CR3=0x00030000 CR4=0x00000200
00017417572p[CPU0 ] >>PANIC<< exception(): 3rd (14) exception with no resolution
I'll give any code needed you think where may the bug be.