diff options
Diffstat (limited to 'c/src/lib/libcpu/i386/cpuModel.S')
-rw-r--r-- | c/src/lib/libcpu/i386/cpuModel.S | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/c/src/lib/libcpu/i386/cpuModel.S b/c/src/lib/libcpu/i386/cpuModel.S index 74fffd31d2..263f824004 100644 --- a/c/src/lib/libcpu/i386/cpuModel.S +++ b/c/src/lib/libcpu/i386/cpuModel.S @@ -5,15 +5,15 @@ * * Intel also provides public similar code in the book * called : - * + * * Pentium Processor Family * Developer Family * Volume 3 : Architecture and Programming Manual * * At the following place : - * + * * Chapter 5 : Feature determination - * Chapter 25: CPUID instruction + * Chapter 25: CPUID instruction * * COPYRIGHT (c) 1998 valette@crf.canon.fr * @@ -28,100 +28,100 @@ #include <rtems/score/registers.h> BEGIN_CODE - PUBLIC(checkCPUtypeSetCr0); -/* - * check Processor type: 386, 486, 6x86(L) or CPUID capable processor + PUBLIC(checkCPUtypeSetCr0); +/* + * check Processor type: 386, 486, 6x86(L) or CPUID capable processor */ SYM (checkCPUtypeSetCr0): /* - * Assume 386 for now + * Assume 386 for now */ - movl $3, SYM (x86) + movl $3, SYM (x86) /* * Start using the EFLAGS AC bit determination method described in * the book mentioned above page 5.1. If this bit can be set we * have a 486 or above. */ pushfl /* save EFLAGS */ - + pushfl /* Get EFLAGS in EAX */ popl eax - + movl eax,ecx /* save original EFLAGS in ECX */ xorl $EFLAGS_ALIGN_CHECK,eax /* flip AC bit in EAX */ pushl eax /* set EAX as EFLAGS */ - popfl + popfl pushfl /* Get new EFLAGS in EAX */ popl eax - + xorl ecx,eax /* check if AC bit changed */ - andl $EFLAGS_ALIGN_CHECK,eax + andl $EFLAGS_ALIGN_CHECK,eax je is386 /* If not : we have a 386 */ /* - * Assume 486 for now + * Assume 486 for now */ movl $4,SYM (x86) movl ecx,eax /* Restore orig EFLAGS in EAX */ xorl $EFLAGS_ID,eax /* flip ID flag */ pushl eax /* set EAX as EFLAGS */ - popfl + popfl pushfl /* Get new EFLAGS in EAX */ - popl eax - + popl eax + xorl ecx,eax /* check if ID bit changed */ andl $EFLAGS_ID,eax - /* + /* * if we are on a straight 486DX, * SX, or 487SX we can't change it - * OTOH 6x86MXs and MIIs check OK + * OTOH 6x86MXs and MIIs check OK * Also if we are on a Cyrix 6x86(L) */ je is486x -isnew: +isnew: /* * restore original EFLAGS */ popfl incl SYM(have_cpuid) /* we have CPUID instruction */ - /* use it to get : + /* use it to get : * processor type, * processor model, * processor mask, * by using it with EAX = 1 */ - movl $1, eax - cpuid + movl $1, eax + cpuid movl ecx,SYM(x86_capability_x) /* store ecx feature flags */ movb al, cl /* save reg for future use */ - + andb $0x0f,ah /* mask processor family */ movb ah,SYM (x86) /* put result in x86 var */ - + andb $0xf0, al /* get model */ shrb $4, al movb al,SYM (x86_model) /* store it in x86_model */ - + andb $0x0f, cl /* get mask revision */ movb cl,SYM (x86_mask) /* store it in x86_mask */ - + movl edx,SYM(x86_capability) /* store feature flags in x86_capability */ - + /* get vendor info by using CPUID with EXA = 0 */ - xorl eax, eax + xorl eax, eax cpuid /* * store results contained in ebx, edx, ecx in * x86_vendor_id variable. */ - movl ebx,SYM(x86_vendor_id) - movl edx,SYM(x86_vendor_id)+4 - movl ecx,SYM(x86_vendor_id)+8 + movl ebx,SYM(x86_vendor_id) + movl edx,SYM(x86_vendor_id)+4 + movl ecx,SYM(x86_vendor_id)+8 movl cr0,eax /* 486+ */ andl $(CR0_PAGING | CR0_PROTECTION_ENABLE | CR0_EXTENSION_TYPE), eax @@ -180,7 +180,7 @@ is486x: xor ax,ax getCx86($0xfe) /* DIR0 : let's check this is a 6x86(L) */ andb $0xf0,al /* should be 3xh */ - cmpb $0x30,al + cmpb $0x30,al jne n6x86 getCx86($0xe9) /* CCR5 : we reset the SLOP bit */ andb $0xfd,al /* so that udelay calculation */ @@ -206,7 +206,7 @@ is386: /* restore original EFLAGS */ 2: movl eax,cr0 call check_x87 ret - + /* * We depend on ET to be correct. This checks for 287/387. @@ -228,7 +228,7 @@ check_x87: ret END_CODE - + BEGIN_DATA PUBLIC(x86) PUBLIC(have_cpuid) @@ -239,20 +239,20 @@ BEGIN_DATA PUBLIC(x86_vendor_id) PUBLIC(hard_math) -SYM(x86): +SYM(x86): .byte 0 -SYM(have_cpuid): +SYM(have_cpuid): .long 0 -SYM(x86_model): +SYM(x86_model): .byte 0 -SYM(x86_mask): +SYM(x86_mask): .byte 0 -SYM(x86_capability): - .long 0 -SYM(x86_capability_x): - .long 0 -SYM(x86_vendor_id): +SYM(x86_capability): + .long 0 +SYM(x86_capability_x): + .long 0 +SYM(x86_vendor_id): .zero 13 -SYM(hard_math): +SYM(hard_math): .byte 0 END_DATA |