Re: [PATCH 9/20] x86_64: 64bit PIC SMP trampoline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux