PERFORCE change 27475 for review
John Baldwin
jhb at FreeBSD.org
Thu Mar 27 11:56:54 PST 2003
http://perforce.freebsd.org/chv.cgi?CH=27475
Change 27475 by jhb at jhb_laptop on 2003/03/27 11:56:17
First pass at letting BIOS programs read both %CR0 and %CR4
into any register rather than just %eax. Unfortunately, boot2
now overflows by 29 bytes. Also, this isn't tested. I'm not
quite sure how I will test it either. :-(
Affected files ...
.. //depot/projects/smpng/sys/boot/i386/btx/btx/btx.s#4 edit
Differences ...
==== //depot/projects/smpng/sys/boot/i386/btx/btx/btx.s#4 (text+ko) ====
@@ -494,9 +494,9 @@
cmpb $0x32,(%esi) # Is it a RDMSR?
je v86rdmsr # Yes
cmpb $0x20,(%esi) # Is this a
- jne v86mon.4 # MOV EAX,CR0
- cmpb $0xc0,0x1(%esi) # instruction?
- je v86mov # Yes
+ jne v86mon.4 # MOV reg,CR[04]
+ testb $0x18,0x1(%esi) # instruction?
+ jz v86mov # Yes
v86mon.4: cmpb $0xfa,%al # CLI?
je v86cli # Yes
cmpb $0xfb,%al # STI?
@@ -527,10 +527,17 @@
leal 0x8(%esp,1),%esp # Discard int no, error
iret # To V86 mode
#
-# Emulate MOV EAX,CR0.
+# Emulate MOV reg,CR[04].
#
-v86mov: movl %cr0,%eax # CR0 to
- movl %eax,0x1c(%ebp) # saved EAX
+v86mov: movb 0x1(%esi),%bl # Fetch Mod R/M byte
+ movl %cr0,%eax # Read CR0
+ testb $0x20,%bl # Read CR4 instead?
+ jz v86mov.1 # No
+ movl %cr4,%eax # Read CR4
+v86mov.1: andl $0x7,%ebx # Compute offset in
+ shl $2,%ebx # frame of destination
+ neg %ebx # register
+ movl %eax,0x1c(%ebp,%ebx,1) # Store CR to reg
incl %esi # Adjust IP
#
# Return from emulating a 0x0f prefixed instruction
More information about the p4-projects
mailing list