~ubuntu-branches/ubuntu/precise/arj/precise-security

« back to all changes in this revision

Viewing changes to det_x86.asm

  • Committer: Bazaar Package Importer
  • Author(s): Guillem Jover
  • Date: 2004-06-27 08:07:09 UTC
  • Revision ID: james.westby@ubuntu.com-20040627080709-1gkxm72ex66gkwe4
Tags: upstream-3.10.21
ImportĀ upstreamĀ versionĀ 3.10.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
;*
 
2
;* $Id: det_x86.asm,v 1.1.1.1 2002/03/28 00:02:20 andrew_belov Exp $
 
3
;* ---------------------------------------------------------------------------
 
4
;* This code uses the  classic way  of determining what Intel x86 CPU is used.
 
5
;* The exact author is unknown.
 
6
;*
 
7
 
 
8
INCLUDE         ASM_INCL.INC
 
9
 
 
10
public          detect_x86
 
11
 
 
12
.CODE
 
13
 
 
14
;*
 
15
;* Returns one of the following values for corresponding CPU types:
 
16
;*
 
17
;*    0x0086 -> 8086/8088
 
18
;*    0x0186 -> 80186/80188
 
19
;*    0x0286 -> 80286
 
20
;*    0x0386 -> 80386 and higher
 
21
;*
 
22
 
 
23
detect_x86      proc
 
24
                pushf
 
25
                xor     ax, ax
 
26
                push    ax
 
27
                popf
 
28
                pushf
 
29
                pop     ax
 
30
                and     ax, 0F000h
 
31
                cmp     ax, 0F000h
 
32
                jnz     test_386
 
33
                push    cx
 
34
                mov     ax, 0FFFFh
 
35
                mov     cl, 21h
 
36
                shl     ax, cl
 
37
                pop     cx
 
38
                jnz     l186
 
39
                mov     ax, 86h
 
40
                popf
 
41
                jmp     short done
 
42
l186:
 
43
                mov     ax, 186h
 
44
                popf
 
45
                jmp     short done
 
46
test_386:
 
47
                mov     ax, 7000h
 
48
                push    ax
 
49
                popf
 
50
                pushf
 
51
                pop     ax
 
52
                and     ax, 7000h
 
53
                jnz     l386
 
54
                mov     ax, 286h
 
55
                popf
 
56
                jmp     short done
 
57
l386:
 
58
                mov     ax, 386h
 
59
                popf
 
60
                jmp     short $+2
 
61
done:
 
62
                ret
 
63
detect_x86      endp
 
64
 
 
65
                end