Quote
An unrecoverable processor error has been encountered.
(I was testing this in a virtual machine.)
ORG 0x00 USE16 db "S3" MEM_SZ_1 equ 0x1000 MEM_SZ_2 equ 0x1002 start: xor ax, ax mov es, ax call GetMemorySize mov word [MEM_SZ_1], ax mov ax, bx mov word [MEM_SZ_2], ax ;; Set up the Global Descriptor Table. xor ax, ax mov bx, 0x2000 ;; Put it at 0x2000 mov word [bx+00], ax ;; This is the NULL entry. mov word [bx+02], ax ;; And this is still the same entry. mov word [bx+04], 0xFFFF ;; Limit -1. mov word [bx+06], 0x8000 ;; Low word of base address is this. mov byte [bx+08], 0x01 ;; Higher byte of base address is this. mov byte [bx+09], 10011010b ;; Some other stuff... mov byte [bx+10], 11001111b ;; ..... mov byte [bx+11], 0x00 ;; The rest of the base address. mov word [bx+12], 0xFFFF ;; The limit. mov word [bx+14], 0x00 ;; The base address should be 0. mov byte [bx+16], 0x00 ;; So should be the rest of the base address. mov byte [bx+17], 10010010b ;; And some other stuff... mov byte [bx+18], 11001111b ;; ..... mov byte [bx+19], 0x00 ;; And the last byte of the base address. lgdt [GDT_desc] ;; Load the global descriptor table. ;; Enable protected mode. mov eax, cr0 or eax, 1 mov cr0, eax ;; Use protected mode and jump to start of p.m. part of program. jmp 00001000b:start_pm ;; Table size is 12 bytes and start is at 0x2000. GDT_desc: dw 12 dd 0x2000 ;; The start of the protected mode part of the program. USE32 start_pm: ;; Set up DS and ES. mov ax, 10000b mov ds, ax mov es, ax ;; Get ready to write to screen. mov ebx, 0xB8000 ;; "PM" stands for "Protected Mode" mov byte [ebx+00], "P" mov byte [ebx+02], "M" ;; "OK" stands for "OKay" mov byte [ebx+04], "O" mov byte [ebx+06], "K" ;; Now, we just sit there and do nothing. .lp1: hlt jmp .lp1 ;; This function is supposed to use the BIOS service ;; to get the memory size. GetMemorySize: xor cx, cx xor dx, dx mov ax, 0xE801 int 0x15 cmp dx, 0 jz .over1 mov ax, cx mov bx, dx .over1: ret
I tried commenting everything out and uncommenting (?) and testing things step by step, and I figured out that the problem occurs after the LGDT instruction. Can anyone tell me what's wrong?
(This program is loaded to address 0x1800:0x0000, if that helps any.)
Maybe there's something wrong with the entries in the GDT?
Edit: I tried inserting this:
hlt jmp start_pmright after the line with the label "start_pm:" , and it still gets that error, so I think the error happens somewhere after the LGDT instruction and before the stuff after the "start_pm:" label.
Edited by RhetoricalRuvim, 17 July 2011 - 09:03 PM.


Sign In
Create Account


Back to top









