openblt

a hobby OS from the late 90s
git clone http://frotz.net/git/openblt.git
Log | Files | Refs | LICENSE

cpuid.S (709B)


      1 /* $Id: //depot/blt/kernel/cpuid.S#3 $
      2 **
      3 ** Copyright 1998 Sidney Cammeresi.  All rights reserved.
      4 ** Distributed under the terms of the OpenBLT License.
      5 */
      6 
      7 #include "smp.h"
      8 
      9 .section ".text.init"
     10 
     11 .globl smp_check_cpu
     12 
     13 smp_check_cpu:
     14 		#.byte 0x66
     15 		pushfl
     16 		#.byte 0x66
     17 		popl %eax
     18 		movl %eax, %ebx
     19 		andl $0x00200000, %eax
     20 		jz not_pentium_or_newer
     21 
     22 		xor %eax, %eax
     23 		cpuid
     24 		mov %eax, cpuid_max_level
     25 
     26 		cmp %ebx, CPUID_GEN_EBX
     27 		jne not_genuine_intel
     28 		cmp %ecx, CPUID_GEN_ECX
     29 		jne not_genuine_intel
     30 		cmp %edx, CPUID_GEN_EDX
     31 		jne not_genuine_intel
     32 
     33 		mov %eax, cpuid_eax
     34 		mov %edx, cpuid_edx
     35 		mov $1, %eax
     36 		ret
     37 
     38 not_pentium_or_newer:
     39 not_genuine_intel:
     40 		xor %eax, %eax
     41 		mov %ebx, %eax
     42 		ret
     43