Another Fix for 286 Protected->Real Mode Switching

modified: Fri Jun 12 1998


There have been several suggestions about changes for the Minix code that allows Intel 286-based machines to switch from protected mode to real mode and back. The original design of the 80286 CPU provided for switching to protected mode after starting in real mode, but not for switching back. Using the PC BIOS requires switching in both directions, however. The difficulty of doing this is one reason why Microsoft Windows never took off until version 3.1, when Microsoft decided to stop trying to provide support for 286 machines.

There may be no single good solution to this problem. The standard Minix 2.0.0 kernel supports standard IBM AT-286 machines and clones, but there have been suggestions that the code may not work with IBM PS/2s and some clones. A while ago Osamu Ihsibashi posted a patch for Minix on 286s that fixed problems he encountered on his machine, a Toshiba 286 laptop.

Kees Bot has suggested an alternative. The following is edited from several messages from Kees dated May 4 and 5, 1998.

From: Kees J Bot
Subject: Re: 286 protected mode patch

Below is a link to a patch to klib88.s for the changes I made after I got hold of HIMEM.ASM, a somewhat old source of HIMEM.SYS. The A20 en/disable code is a bit better for the AT, and I also added code to en/disable the A20 line for a PC with an MCA bus, i.e. most PS/2's.

So if any of you is running 16-bit Minix on a machine with an MCA bus then this may be for you to get rid of processor=86.

I believe Osamu's patch is too Toshiba / weird Japanese PC specific. My patch is simply what I came up with after reading HIMEM.SYS, you know, the driver that handles extended memory on the PC written by Microsoft themselves (which, of course, doesn't mean it's any good.)

The PS/2 side of the patch is the great unknown, since I don't have a PS/2 to test it on. Who knows, maybe someone will tell us if it works this time.

Kees' patch may be found at http://minix1.hampshire.edu/pub/minix.2.0/2.0.0/fixes/xfix-286mode2.

Osamu's patch is at http://minix1.hampshire.edu/pub/minix.2.0/fixes/2.0.0/xfix-286mode.

Apply either patch like this:

	cd /usr/src/kernel
	patch klib88.s klib88.dif
	cd ../tools
	make hdboot
	shutdown -x 'unset processor;boot'

Be aware that these two patches are independent, and probably are not compatible. However, each tries to solve more than one problem, so for a particular machine some combination of elements of both may be what is needed. Please be sure to make a backup of your original klib88.s and a working kernel before you try one of these. And if you write to Kees, Osamu, or me to report success or failure please be sure to tell us what kind of machine you tried it on.

asw 12 June 1998

Return to the Minix hints page .

Return to Al Woodhull's MINIX home page at Hampshire College, Amherst, MA, USA.