lkml.org 
[lkml]   [2006]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 9/20] x86_64: 64bit PIC SMP trampoline
Hi!

> that long mode is supported. Asking if long mode is implemented is
> down right silly but we have traditionally had some of these checks,
> and they can't hurt anything. So when the totally ludicrous happens
> we just might handle it correctly.

Well, it is silly, and it is 50 lines of dense assembly. can we get
rid of it or get it shared with bootup version?

The REQUIRED_MASK1/2 look like something that could get out of sync,
for example.

The rest of patch looks okay.

(The traditional checks were unneeded, so it is okay to drop them...)

Pavel

> + .code16
> +verify_cpu:
> + pushl $0 # Kill any dangerous flags
> + popfl
> +
> + /* minimum CPUID flags for x86-64 */
> + /* see http://www.x86-64.org/lists/discuss/msg02971.html */
> +#define REQUIRED_MASK1 ((1<<0)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<8)|\
> + (1<<13)|(1<<15)|(1<<24)|(1<<25)|(1<<26))
> +#define REQUIRED_MASK2 (1<<29)
> +
> + pushfl # check for cpuid
> + popl %eax
> + movl %eax, %ebx
> + xorl $0x200000,%eax
> + pushl %eax
> + popfl
> + pushfl
> + popl %eax
> + pushl %ebx
> + popfl
> + cmpl %eax, %ebx
> + jz no_longmode
> +
> + xorl %eax, %eax # See if cpuid 1 is implemented
> + cpuid
> + cmpl $0x1, %eax
> + jb no_longmode
> +
> + movl $0x01, %eax # Does the cpu have what it takes?
> + cpuid
> + andl $REQUIRED_MASK1, %edx
> + xorl $REQUIRED_MASK1, %edx
> + jnz no_longmode
> +
> + movl $0x80000000, %eax # See if extended cpuid is implemented
> + cpuid
> + cmpl $0x80000001, %eax
> + jb no_longmode
> +
> + movl $0x80000001, %eax # Does the cpu have what it takes?
> + cpuid
> + andl $REQUIRED_MASK2, %edx
> + xorl $REQUIRED_MASK2, %edx
> + jnz no_longmode
> +
> + ret # The cpu supports long mode
> +
> +no_longmode:
> + hlt
> + jmp no_longmode
> +

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-11-18 01:31    [W:0.149 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site