Re: [GIT PULL] x86 setup: correct booting on 486DX4

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: H. Peter Anvin <hpa@...>, Jeremy Fitzhardinge <jeremy@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Thomas Gleixner <tglx@...>, Ingo Molnar <mingo@...>, Mikael Petterson <mikpe@...>, Eric Biederman <ebiederm@...>
Date: Sunday, November 4, 2007 - 7:59 pm

On Sun, 4 Nov 2007, H. Peter Anvin wrote:

I still disagree.

I took out "Programming the 80386" just to check, and the documentation 
very clearly states that when changing the CR0 bits (I quote):

	"The program must execute a jump instruction immediately after 
	 changing the value of the PE bit in order to flush the execution 
	 pipeline of any instructions that may have been fetched in the 
	 wrong mode. [...]"

In other words, not only is this documented since day 1, it makes total 
sense, and they even said exactöy *why* that jump had to be done.

In fact, there's even a code example. It's page 624 in my copy of the 
book, and yes, it has a short jump to flush things, followed by a long 
jump. The code there looks like this:

	; *****
	; ** [4] Enter Protected Mode
	; *****
		SMSW AX
		OR   AX, PE
		LMSW AX
		JMP  Flush
	Flush:
		JMP far ptr Start32


which is pretty damn conclusive. It's documented, it has examples, it 
works. In other words, it's how you should do things.

And Linux always did it correctly. I don't understand why you disagree, 
and why Jeremy says

	"Having successfully broken the rules for a long time so far, 
	 maybe we can get away with still cutting corners..."

when the fact is, we used to *not* cut corners, we used to *not* break the 
rules, and what we used to do (a short jump immediately after setting PE) 
was exactly what Intel always said you should do, and there is no question 
what-so-ever about it.

So here's a suggestion:

 - make the code do what it used to do. A regular jump to flush the 
   pipeline. Which is what Intel has always said should be done.

and I really don't see that there is any argument about this. 

			Linus
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [GIT PULL] x86 setup: correct booting on 486DX4, Linus Torvalds, (Sun Nov 4, 7:17 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, H. Peter Anvin, (Sun Nov 4, 7:26 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, Linus Torvalds, (Sun Nov 4, 7:59 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, H. Peter Anvin, (Sun Nov 4, 8:02 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, Eric W. Biederman, (Sun Nov 4, 8:43 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, Linus Torvalds, (Sun Nov 4, 9:10 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, H. Peter Anvin, (Sun Nov 4, 8:12 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, Jeremy Fitzhardinge, (Sun Nov 4, 7:27 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, Linus Torvalds, (Sun Nov 4, 7:25 pm)
Re: [GIT PULL] x86 setup: correct booting on 486DX4, H. Peter Anvin, (Sun Nov 4, 7:36 pm)