From owner-p4-projects@FreeBSD.ORG Thu Mar 27 11:56:52 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2C1CB37B404; Thu, 27 Mar 2003 11:56:52 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D6EED37B401 for ; Thu, 27 Mar 2003 11:56:51 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C5EC43F85 for ; Thu, 27 Mar 2003 11:56:51 -0800 (PST) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h2RJup0U092999 for ; Thu, 27 Mar 2003 11:56:51 -0800 (PST) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h2RJupsv092996 for perforce@freebsd.org; Thu, 27 Mar 2003 11:56:51 -0800 (PST) Date: Thu, 27 Mar 2003 11:56:51 -0800 (PST) Message-Id: <200303271956.h2RJupsv092996@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews X-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,PATCH_UNIFIED_DIFF,X_AUTH_WARNING autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Subject: PERFORCE change 27475 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Mar 2003 19:56:54 -0000 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