diff options
author | jhb <jhb@FreeBSD.org> | 2000-06-17 06:45:40 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-06-17 06:45:40 +0000 |
commit | beeee4808aeae02ac7c4b02b3563544351d6387f (patch) | |
tree | 1babb61fef8c1453b91cb8b023a7f918c021354e /sys/boot | |
parent | d015bc83c1e38db394b7659bea680d94336a5cdd (diff) | |
download | FreeBSD-src-beeee4808aeae02ac7c4b02b3563544351d6387f.zip FreeBSD-src-beeee4808aeae02ac7c4b02b3563544351d6387f.tar.gz |
Add support for emulating the RDMSR and WRMSR instructions into BTX. In
theory, this should allow the K7V Athlon motherboard to boot ok with boot
virus protection enabled. However, I have no hardware to test this. It
shouldn't break anything though. :)
Prodded by: Kelly Yancey <kbyanc@posi.net>
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/i386/btx/btx/btx.S | 26 | ||||
-rw-r--r-- | sys/boot/i386/btx/btx/btx.s | 26 |
2 files changed, 48 insertions, 4 deletions
diff --git a/sys/boot/i386/btx/btx/btx.S b/sys/boot/i386/btx/btx/btx.S index 00f153c..d957bfc 100644 --- a/sys/boot/i386/btx/btx/btx.S +++ b/sys/boot/i386/btx/btx/btx.S @@ -479,11 +479,15 @@ v86mon.2: cmpb $0xf4,%al # HLT? jne v86mon.7 # No (ignore) jmp intrtn # Return to user mode v86mon.3: cmpb $0xf,%al # Is - jne v86mon.4 # this + jne v86mon.3.1 # this cmpb $0x20,(%esi) # a - jne v86mon.4 # MOV EAX,CR0 + jne v86mon.3.1 # MOV EAX,CR0 cmpb $0xc0,0x1(%esi) # instruction? je v86mov # Yes +v86mon.3.1: cmpb $0x30,(%esi) # Is it a WRMSR? + je v86wrmsr # Yes + cmpb $0x32,(%esi) # Is it a RDMSR? + je v86rdmsr # Yes v86mon.4: cmpb $0xfa,%al # CLI? je v86cli # Yes cmpb $0xfb,%al # STI? @@ -522,6 +526,24 @@ v86mov: movl %cr0,%eax # CR0 to incl %esi # IP jmp v86mon.7 # Finish up # +# Emulate WRMSR +# +v86wrmsr: movl 0x18(%ebp),%ecx # Get user's %ecx (MSR to write) + movl 0x14(%ebp),%edx # Load the value + movl 0x1c(%ebp),%eax # to write + wrmsr # Write MSR + incl %esi # Adjust IP + jmp v86mon.7 # Finish up +# +# Emulate RDMSR +# +v86rdmsr: movl 0x18(%ebp),%ecx # MSR to read + rdmsr # Read the MSR + movl %eax,0x1c(%ebp) # Return the value of + movl %edx,0x14(%ebp) # the MSR to the user + incl %esi # Adjust IP + jmp v86mon.7 +# # Emulate CLI. # v86cli: andb $~0x2,0x31(%ebp) # Clear IF diff --git a/sys/boot/i386/btx/btx/btx.s b/sys/boot/i386/btx/btx/btx.s index 00f153c..d957bfc 100644 --- a/sys/boot/i386/btx/btx/btx.s +++ b/sys/boot/i386/btx/btx/btx.s @@ -479,11 +479,15 @@ v86mon.2: cmpb $0xf4,%al # HLT? jne v86mon.7 # No (ignore) jmp intrtn # Return to user mode v86mon.3: cmpb $0xf,%al # Is - jne v86mon.4 # this + jne v86mon.3.1 # this cmpb $0x20,(%esi) # a - jne v86mon.4 # MOV EAX,CR0 + jne v86mon.3.1 # MOV EAX,CR0 cmpb $0xc0,0x1(%esi) # instruction? je v86mov # Yes +v86mon.3.1: cmpb $0x30,(%esi) # Is it a WRMSR? + je v86wrmsr # Yes + cmpb $0x32,(%esi) # Is it a RDMSR? + je v86rdmsr # Yes v86mon.4: cmpb $0xfa,%al # CLI? je v86cli # Yes cmpb $0xfb,%al # STI? @@ -522,6 +526,24 @@ v86mov: movl %cr0,%eax # CR0 to incl %esi # IP jmp v86mon.7 # Finish up # +# Emulate WRMSR +# +v86wrmsr: movl 0x18(%ebp),%ecx # Get user's %ecx (MSR to write) + movl 0x14(%ebp),%edx # Load the value + movl 0x1c(%ebp),%eax # to write + wrmsr # Write MSR + incl %esi # Adjust IP + jmp v86mon.7 # Finish up +# +# Emulate RDMSR +# +v86rdmsr: movl 0x18(%ebp),%ecx # MSR to read + rdmsr # Read the MSR + movl %eax,0x1c(%ebp) # Return the value of + movl %edx,0x14(%ebp) # the MSR to the user + incl %esi # Adjust IP + jmp v86mon.7 +# # Emulate CLI. # v86cli: andb $~0x2,0x31(%ebp) # Clear IF |