Skip to content

Commit

Permalink
bugfix for DOS LTP library: don't assume CR4 exists, ask the CPU library
Browse files Browse the repository at this point in the history
if it does. prior to this fix, the DOS LTP library would cause an
exception on pre-Pentium systems when probing the page tables.
  • Loading branch information
joncampbell123 committed Mar 13, 2016
1 parent cf71dc3 commit c55f2f3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions hw/dos/dos_ltp.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ int dos_ltp_probe() {

mov eax,cr3
mov r3,eax
}

mov eax,cr4
mov r4,eax
if (cpu_flags & CPU_FLAG_CR4_EXISTS) {
__asm {
mov eax,cr4
mov r4,eax
}
}

dos_ltp_info.cr0 = r0;
dos_ltp_info.cr3 = r3;
dos_ltp_info.cr4 = r4;
Expand Down Expand Up @@ -212,10 +217,15 @@ uint64_t dos_linear_to_phys(uint32_t linear) {

mov eax,cr3
mov r3,eax
}

mov eax,cr4
mov r4,eax
if (cpu_flags & CPU_FLAG_CR4_EXISTS) {
__asm {
mov eax,cr4
mov r4,eax
}
}

dos_ltp_info.cr3 = r3;
dos_ltp_info.cr4 = r4;
}
Expand Down

0 comments on commit c55f2f3

Please sign in to comment.