Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Mar 1998 01:27:08 +0900
From:      KATO Takenori <kato@migmatite.eps.nagoya-u.ac.jp>
To:        current@FreeBSD.ORG
Subject:   Re: VM86 does not work on pre-Pentium CPU
Message-ID:  <19980325012708O.kato@gneiss.eps.nagoya-u.ac.jp>
In-Reply-To: Your message of "Tue, 24 Mar 1998 15:25:00 %2B0900" <19980324152500H.kato@gneiss.eps.nagoya-u.ac.jp>
References:  <19980324152500H.kato@gneiss.eps.nagoya-u.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
KATO Takenori <kato@migmatite.eps.nagoya-u.ac.jp> wrote:

> Because vm86_initialize() always accesses CR4, it generates fault on
> pre-Pentium CPU machine.

Before accessing CR4, bit 1 of cpu_feature should be tested as
following patch:

---------- BEGIN ----------
*** vm86.c.ORIG	Wed Mar 25 01:22:57 1998
--- vm86.c	Wed Mar 25 01:23:05 1998
***************
*** 418,424 ****
  	ext->ext_iomap = (caddr_t)(offset + ((u_int)&ext->ext_tss & PG_FRAME));
  
  	ext->ext_vm86.vm86_intmap = ext->ext_iomap - 32;
! 	ext->ext_vm86.vm86_has_vme = (rcr4() & CR4_VME ? 1 : 0);
  
  	addr = (u_long *)ext->ext_vm86.vm86_intmap;
  	for (i = 0; i < (ctob(IOPAGES) + 32 + 16) / sizeof(u_long); i++)
--- 418,427 ----
  	ext->ext_iomap = (caddr_t)(offset + ((u_int)&ext->ext_tss & PG_FRAME));
  
  	ext->ext_vm86.vm86_intmap = ext->ext_iomap - 32;
! 	if (cpu_feature & CPUID_VME)
! 		ext->ext_vm86.vm86_has_vme = (rcr4() & CR4_VME ? 1 : 0);
! 	else
! 		ext->ext_vm86.vm86_has_vme = 0;
  
  	addr = (u_long *)ext->ext_vm86.vm86_intmap;
  	for (i = 0; i < (ctob(IOPAGES) + 32 + 16) / sizeof(u_long); i++)
---------- END ----------

If a CPU has the virtual mode extensions, the CPU has the CR4
register.


----
KATO Takenori <kato@ganko.eps.nagoya-u.ac.jp>
Dept. Earth Planet. Sci., Nagoya Univ.,  Nagoya, 464-01, Japan
PGP public key: finger kato@eclogite.eps.nagoya-u.ac.jp
------------------- Powered by FreeBSD(98) -------------------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980325012708O.kato>