cpu_id.s revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/privregs.h>
#ifdef __lint
int is486(void) { return (1); }
#else
.ident "%Z%%M% %I% %E% SMI"
.text
#endif /* !lint */
#ifdef lint
/*
* Enable cpuid. Set max_std_cpuid_level and cpu_vendor appropriately. Returns
* 1 if cpuid present and enabled, 0 otherwise.
*/
int enable_cpuid(void) { return(1); }
int max_std_cpuid_level;
unsigned int cpu_vendor;
#else
.text
.data
.align 4
max_std_cpuid_level: .long 0xffffffff
cpu_vendor: .long 0
#endif
#ifdef lint
int largepage_supported(void) { return(1); }
#else
.text
no:
popl %esp
ret
#endif
#ifdef lint
int enable_large_pages(void) { return(1); }
#else
.text
.globl enable_large_pages
enable_large_pages:
movl %cr4, %eax
orl $CR4_PSE, %eax / since we have large pages enable them
movl %eax, %cr4
#endif
#ifdef lint
int global_bit(void) { return(1); }
#else
.text
.globl global_bit
global_bit:
pushl %esp / save our stack value
/ test to see if cpuid level 1 supported
cmpl $1, max_std_cpuid_level
jl nogbit
/ are we a vendor for which we know how to test for PGE
testl $[GenuineIntel|AuthenticAMD], cpu_vendor
jz nogbit
movl $1, %eax / capability test. Mov 1 to eax for cpuid
cpuid
/ are we an AMD
testl $AuthenticAMD, cpu_vendor
jz pge_at_13
/ test to see if we are an AMD-K5 model 0
andw $0xff0, %ax
cmpw $0x500, %ax
jl nogbit
jne pge_at_13
/ we are an AMD-K5 model 0, so GPE is at bit 9
testl $0x200, %edx / do you have GPE?
jmp test_pge
pge_at_13:
testl $0x2000, %edx / do you have PGE?
test_pge:
jnz hasgbit
nogbit:
#endif
#ifdef lint
int enable_global_pages(void) { return(1); }
#else
.text
#endif
#ifdef lint
int pae_supported(void) { return (1); }
#else
.text
popl %esp
ret
#endif