What I did was copy the 32Kb at 0xC0000 to 0x10E000, which is a 9 page area in my kernel dedicated to holding the copied BIOS and enabling VBE. The copy worked. I used my simple _mem_cpy function and checked and double checked that it was working properly. It is. The problem is not the copy. I can see the problem being one of three things:
- The location of the original BIOS in RAM is incorrect (0xC0000)
- The size of the original BIOS in RAM is incorrect (0x8000)
- The scan isn't working properly.
However, I really don't think it's the latter because it's a very simple function that I've recoded a number of ways to test for different bugs and it's had the same outcome of "PMID NOT FOUND" every time. Here is the code:
Code: Select all
global _setup_vbe
_setup_vbe:
; setup stack frame
push ebp
mov ebp,esp
pushad
; Following Exact VBE 3.0 Specs
; =============================
; Step 1.) Allocate a protected mode buffer large enough to hold
; the entire BIOS image (32Kb normally).
; Done in the paging module.
; Step 2.) Copy the BIOS image from the 0xC000 physical memory
; region to the protected mode buffer.
push DWORD 0x00008000 ; 32 kb = 0x8000 bytes
push DWORD 0x000C0000
push DWORD 0x0010E000
call _mem_copy
add esp,DWORD 0x0C
; Step 3.) Scan the BIOS image for the PMInfoBlock structure
; and check that the checksum for the block is 0.
mov ecx,DWORD 0x10E000
add ecx,DWORD 0x8000
sub ecx,DWORD 0x04
mov eax,DWORD 0x10E000
.next_check:
; check if counter reached limit
cmp eax,ecx
jz .not_found
; check for signature
cmp DWORD [ds:eax],0x504D4944 ; "PMID"
jz .found
; increment counter and loop back around
inc eax
jmp .next_check
.not_found:
call _dbg_no
.found:
call _dbg_yes
; jump to end (over code)
jmp .done
; data
.data:
.PMInfoBlock dd 0x00000000
; end
.done:
; clean up stack frame
popad
mov esp,ebp
pop ebp
ret
The "No" on one line followed by "Yes" on the next are the results of calling the _dbg_yes and _dbg_no routines and since "No" is there, the signature wasn't found.
Help appreciated,
Brodeur235