Date: Thu, 27 Mar 2003 11:56:51 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 27475 for review Message-ID: <200303271956.h2RJupsv092996@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=27475 Change 27475 by jhb@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303271956.h2RJupsv092996>