2019-07-13 20:49:22 +02:00
|
|
|
|
use16
|
|
|
|
|
align 1
|
|
|
|
|
|
2007-03-13 21:49:51 +01:00
|
|
|
|
include "..\include\mem.h"
|
|
|
|
|
include "..\include\cpu.h"
|
|
|
|
|
include "..\include\pci.h"
|
|
|
|
|
|
|
|
|
|
org 0h
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
header exe 1
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
2007-03-14 11:22:42 +01:00
|
|
|
|
exporting
|
|
|
|
|
declare cpuinfo
|
|
|
|
|
declare setinfo
|
|
|
|
|
declare pciinfo
|
|
|
|
|
declare getpciclass
|
|
|
|
|
declare getpcisubclass
|
|
|
|
|
declare getcardinfo
|
|
|
|
|
declare pcireadbyte
|
|
|
|
|
declare pcireadword
|
|
|
|
|
declare pcireaddword
|
|
|
|
|
declare detectvmware
|
|
|
|
|
ende
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc detectvmware uses eax ebx ecx edx
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov eax,564D5868h
|
|
|
|
|
mov ebx,12345h
|
|
|
|
|
mov ecx,00Ah
|
|
|
|
|
mov edx,5658h
|
|
|
|
|
in ax,dx
|
|
|
|
|
cmp ebx,564D5868h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
;renvoie un pointer dx:ax vers la classe %0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getpciclass uses di, class:word
|
|
|
|
|
mov di,[class]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
and di,0FFh
|
|
|
|
|
shl di,1
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov ax,[cs:classes+di]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov dx,cs
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
;renvoie un pointer dx:ax vers la sous-classe de %1 et de classe %0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getpcisubclass uses di, class:word,subclass:word
|
|
|
|
|
mov di,[class]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
and di,0FFh
|
|
|
|
|
shl di,1
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[cs:classesd+di]
|
|
|
|
|
mov dx,[subclass]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
and dx,0FFh
|
|
|
|
|
cmp dx,80h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .suiteac
|
|
|
|
|
mov ax,divers
|
|
|
|
|
jmp .found
|
|
|
|
|
.suiteac:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shl dx,1
|
|
|
|
|
add di,dx
|
|
|
|
|
mov ax,[cs:di]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.found:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov dx,cs
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
divers db 'divers',0
|
|
|
|
|
|
|
|
|
|
classes:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw class0
|
|
|
|
|
dw class1
|
|
|
|
|
dw class2
|
|
|
|
|
dw class3
|
|
|
|
|
dw class4
|
|
|
|
|
dw class5
|
|
|
|
|
dw class6
|
|
|
|
|
dw class7
|
|
|
|
|
dw class8
|
|
|
|
|
dw class9
|
|
|
|
|
dw class10
|
|
|
|
|
dw class11
|
|
|
|
|
dw class12
|
|
|
|
|
dw class13
|
|
|
|
|
dw class14
|
|
|
|
|
dw class15
|
|
|
|
|
dw class16
|
|
|
|
|
dw class17
|
2007-03-13 21:49:51 +01:00
|
|
|
|
class0 db 'ancien',0
|
|
|
|
|
class1 db 'stockage',0
|
|
|
|
|
class2 db 'reseau',0
|
|
|
|
|
class3 db 'affichage',0
|
|
|
|
|
class4 db 'multimedia',0
|
|
|
|
|
class5 db 'memoire',0
|
|
|
|
|
class6 db 'pont',0
|
|
|
|
|
class7 db 'communication',0
|
|
|
|
|
class8 db 'systeme',0
|
|
|
|
|
class9 db 'acquisition',0
|
|
|
|
|
class10 db 'dock',0
|
|
|
|
|
class11 db 'processeur',0
|
|
|
|
|
class12 db 'bus serie',0
|
|
|
|
|
class13 db 'sans fil',0
|
|
|
|
|
class14 db 'intelligent',0
|
|
|
|
|
class15 db 'satellite',0
|
|
|
|
|
class16 db 'cryptage',0
|
|
|
|
|
class17 db 'traitement signal',0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;Classes et sous classes
|
|
|
|
|
classesd:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw class0d
|
|
|
|
|
dw class1d
|
|
|
|
|
dw class2d
|
|
|
|
|
dw class3d
|
|
|
|
|
dw class4d
|
|
|
|
|
dw class5d
|
|
|
|
|
dw class6d
|
|
|
|
|
dw class7d
|
|
|
|
|
dw class8d
|
|
|
|
|
dw class9d
|
|
|
|
|
dw class10d
|
|
|
|
|
dw class11d
|
|
|
|
|
dw class12d
|
|
|
|
|
dw class13d
|
|
|
|
|
dw class14d
|
|
|
|
|
dw class15d
|
|
|
|
|
dw class16d
|
|
|
|
|
dw class17d
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
class0d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass00
|
|
|
|
|
dw subclass01
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass00 db 'divers',0
|
|
|
|
|
subclass01 db 'vga',0
|
|
|
|
|
|
|
|
|
|
class1d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass10
|
|
|
|
|
dw subclass11
|
|
|
|
|
dw subclass12
|
|
|
|
|
dw subclass13
|
|
|
|
|
dw subclass14
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass10 db 'scsi',0
|
|
|
|
|
subclass11 db 'ide',0
|
|
|
|
|
subclass12 db 'disquette',0
|
|
|
|
|
subclass13 db 'ipi',0
|
|
|
|
|
subclass14 db 'raid',0
|
|
|
|
|
|
|
|
|
|
class2d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass20
|
|
|
|
|
dw subclass21
|
|
|
|
|
dw subclass22
|
|
|
|
|
dw subclass23
|
|
|
|
|
dw subclass24
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass20 db 'ethernet',0
|
|
|
|
|
subclass21 db 'token ring',0
|
|
|
|
|
subclass22 db 'fddi',0
|
|
|
|
|
subclass23 db 'atm',0
|
|
|
|
|
subclass24 db 'isdn',0
|
|
|
|
|
|
|
|
|
|
class3d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass30
|
|
|
|
|
dw subclass31
|
|
|
|
|
dw subclass32
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass30 db 'vga',0
|
|
|
|
|
subclass31 db 'xga',0
|
|
|
|
|
subclass32 db '3D',0
|
|
|
|
|
|
|
|
|
|
class4d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass40
|
|
|
|
|
dw subclass41
|
|
|
|
|
dw subclass42
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass40 db 'video',0
|
|
|
|
|
subclass41 db 'audio',0
|
|
|
|
|
subclass42 db 'telephonie',0
|
|
|
|
|
|
|
|
|
|
class5d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass50
|
|
|
|
|
dw subclass51
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass50 db 'ram',0
|
|
|
|
|
subclass51 db 'flash',0
|
|
|
|
|
|
|
|
|
|
class6d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass60
|
|
|
|
|
dw subclass61
|
|
|
|
|
dw subclass62
|
|
|
|
|
dw subclass63
|
|
|
|
|
dw subclass64
|
|
|
|
|
dw subclass65
|
|
|
|
|
dw subclass66
|
|
|
|
|
dw subclass67
|
|
|
|
|
dw subclass68
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass60 db 'hote',0
|
|
|
|
|
subclass61 db 'isa',0
|
|
|
|
|
subclass62 db 'eisa',0
|
|
|
|
|
subclass63 db 'mca',0
|
|
|
|
|
subclass64 db 'pci',0
|
|
|
|
|
subclass65 db 'pcmcia',0
|
|
|
|
|
subclass66 db 'nubus',0
|
|
|
|
|
subclass67 db 'cardbus',0
|
|
|
|
|
subclass68 db 'RACEway',0
|
|
|
|
|
|
|
|
|
|
class7d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass70
|
|
|
|
|
dw subclass71
|
|
|
|
|
dw subclass72
|
|
|
|
|
dw subclass73
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass70 db 'serie',0
|
|
|
|
|
subclass71 db 'parallele',0
|
|
|
|
|
subclass72 db 'serie multiport',0
|
|
|
|
|
subclass73 db 'modem',0
|
|
|
|
|
|
|
|
|
|
class8d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass80
|
|
|
|
|
dw subclass81
|
|
|
|
|
dw subclass82
|
|
|
|
|
dw subclass83
|
|
|
|
|
dw subclass84
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass80 db 'pic',0
|
|
|
|
|
subclass81 db 'dma',0
|
|
|
|
|
subclass82 db 'timer',0
|
|
|
|
|
subclass83 db 'rtc',0
|
|
|
|
|
subclass84 db 'hotplug',0
|
|
|
|
|
|
|
|
|
|
class9d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass90
|
|
|
|
|
dw subclass91
|
|
|
|
|
dw subclass92
|
|
|
|
|
dw subclass93
|
|
|
|
|
dw subclass94
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass90 db 'clavier',0
|
|
|
|
|
subclass91 db 'stylo',0
|
|
|
|
|
subclass92 db 'souris',0
|
|
|
|
|
subclass93 db 'scanner',0
|
|
|
|
|
subclass94 db 'joystick',0
|
|
|
|
|
|
|
|
|
|
class10d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass100
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass100 db 'station',0
|
|
|
|
|
|
|
|
|
|
class11d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass110
|
|
|
|
|
dw subclass111
|
|
|
|
|
dw subclass112
|
|
|
|
|
dw subclass113
|
|
|
|
|
dw subclass114
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass110 db '386',0
|
|
|
|
|
subclass111 db '486',0
|
|
|
|
|
subclass112 db 'pentium',0
|
|
|
|
|
subclass113 db 'alpha',0
|
|
|
|
|
subclass114 db 'coprocesseur',0
|
|
|
|
|
|
|
|
|
|
class12d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass120
|
|
|
|
|
dw subclass121
|
|
|
|
|
dw subclass122
|
|
|
|
|
dw subclass123
|
|
|
|
|
dw subclass124
|
|
|
|
|
dw subclass125
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass120 db 'firewire',0
|
|
|
|
|
subclass121 db 'access',0
|
|
|
|
|
subclass122 db 'ssa',0
|
|
|
|
|
subclass123 db 'usb',0
|
|
|
|
|
subclass124 db 'fibre',0
|
|
|
|
|
subclass125 db 'smbus',0
|
|
|
|
|
|
|
|
|
|
class13d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass130
|
|
|
|
|
dw subclass131
|
|
|
|
|
dw subclass132
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass130 db 'irda',0
|
|
|
|
|
subclass131 db 'ir',0
|
|
|
|
|
subclass132 db 'rf',0
|
|
|
|
|
|
|
|
|
|
class14d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass140
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass140 db 'IO arch',0
|
|
|
|
|
|
|
|
|
|
class15d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass150
|
|
|
|
|
dw subclass151
|
|
|
|
|
dw subclass152
|
|
|
|
|
dw subclass153
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass150 db 'tv',0
|
|
|
|
|
subclass151 db 'audio',0
|
|
|
|
|
subclass152 db 'voix',0
|
|
|
|
|
subclass153 db 'donnees',0
|
|
|
|
|
|
|
|
|
|
class16d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass160
|
|
|
|
|
dw subclass161
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass160 db 'reseau',0
|
|
|
|
|
subclass161 db 'jeux',0
|
|
|
|
|
|
|
|
|
|
class17d:
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw subclass170
|
2007-03-13 21:49:51 +01:00
|
|
|
|
subclass170 db 'dpio',0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;al=bus cl=deviceid ch=func es:di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc getcardinfo uses eax bx di, bus:word,device:word,function:word,pointer:word
|
|
|
|
|
mov di,[pointer]
|
|
|
|
|
cmp [function],0
|
|
|
|
|
je .amultiorfirst
|
|
|
|
|
virtual at 0
|
|
|
|
|
.pcidata pcidata
|
|
|
|
|
end virtual
|
|
|
|
|
stdcall pcireadbyte,[bus],[device],0,.pcidata.typed
|
2007-03-13 21:49:51 +01:00
|
|
|
|
and al,multifunction
|
|
|
|
|
cmp al,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .amultiorfirst
|
|
|
|
|
mov word [di],0000h
|
|
|
|
|
jmp .notexist
|
|
|
|
|
.amultiorfirst:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
xor bx,bx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.goinfos:
|
|
|
|
|
stdcall pcireadword,[bus],[device],[function],bx
|
2007-03-13 21:49:51 +01:00
|
|
|
|
inc bl
|
|
|
|
|
inc bl
|
|
|
|
|
cmp bl,2
|
2019-07-09 10:33:10 +02:00
|
|
|
|
ja .notzarb
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cmp ax,0FFFFh
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .notexist
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cmp ax,00000h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .notexist
|
|
|
|
|
.notzarb:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov [ds:di],ax
|
|
|
|
|
inc di
|
|
|
|
|
inc di
|
|
|
|
|
cmp bl,40h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jbe .goinfos
|
2007-03-13 21:49:51 +01:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.notexist:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
2007-03-23 17:36:54 +01:00
|
|
|
|
;lit un octet du bus %0 device %1 function %2 n<> %3 et le met en AL
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc pcireadbyte uses bx dx, bus:word,device:word,function:word,pointer:word
|
|
|
|
|
mov al,byte [bus]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ah,80h
|
|
|
|
|
shl eax,16
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov ah,byte [device]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shl ah,3
|
2019-07-09 10:33:10 +02:00
|
|
|
|
or ah,byte [function]
|
|
|
|
|
mov bl,byte [pointer]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov al,bl
|
|
|
|
|
and al,0fch
|
|
|
|
|
mov dx,config1addr
|
|
|
|
|
out dx,eax
|
|
|
|
|
mov dx,config1data
|
|
|
|
|
and bl,3
|
|
|
|
|
or dl,bl
|
|
|
|
|
in al,dx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
2007-03-23 17:36:54 +01:00
|
|
|
|
;lit 2 octet du bus %0 device %1 function %2 n<> %3 et le met en AX
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc pcireadword uses bx dx, bus:word,device:word,function:word,pointer:word
|
|
|
|
|
mov al,byte [bus]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ah,80h
|
|
|
|
|
shl eax,16
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov ah,byte [device]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shl ah,3
|
2019-07-09 10:33:10 +02:00
|
|
|
|
or ah,byte [function]
|
|
|
|
|
mov bl,byte [pointer]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov al,bl
|
|
|
|
|
and al,0fch
|
|
|
|
|
mov dx,config1addr
|
|
|
|
|
out dx,eax
|
|
|
|
|
mov dx,config1data
|
|
|
|
|
and bl,3
|
|
|
|
|
or dl,bl
|
|
|
|
|
in ax,dx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
2007-03-23 17:36:54 +01:00
|
|
|
|
;lit 4 octet du bus %0 device %1 function %2 n<> %3 et le met en EAX
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc pcireaddword uses bx dx, bus:word,device:word,function:word,pointer:word
|
|
|
|
|
mov al,byte [bus]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ah,80h
|
|
|
|
|
shl eax,16
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov ah,byte [device]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shl ah,3
|
2019-07-09 10:33:10 +02:00
|
|
|
|
or ah,byte [function]
|
|
|
|
|
mov bl,byte [pointer]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov al,bl
|
|
|
|
|
and al,0fch
|
|
|
|
|
mov dx,config1addr
|
|
|
|
|
out dx,eax
|
|
|
|
|
mov dx,config1data
|
|
|
|
|
and bl,3
|
|
|
|
|
or dl,bl
|
|
|
|
|
in eax,dx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
;Prob avec str pci
|
|
|
|
|
;renvoie en %0 la structure pciinf carry if error
|
2019-07-09 10:33:10 +02:00
|
|
|
|
proc pciinfo uses ax bx cx edx edi, pointer:word
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ax,0B101h
|
|
|
|
|
xor edi,edi
|
|
|
|
|
mov edx," PCI"
|
|
|
|
|
int 1Ah
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jc .errorpci
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cmp dx,04350h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .errorpci
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cmp ah,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .errorpci
|
|
|
|
|
mov di,[pointer]
|
|
|
|
|
virtual at di
|
|
|
|
|
.pciinf pciinf
|
|
|
|
|
end virtual
|
|
|
|
|
mov [.pciinf.version_major],bh
|
|
|
|
|
mov [.pciinf.version_minor],bl
|
|
|
|
|
mov [.pciinf.types],al
|
|
|
|
|
mov [.pciinf.maxbus],cl
|
2007-03-13 21:49:51 +01:00
|
|
|
|
clc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
.errorpci:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
stc
|
2019-07-09 10:33:10 +02:00
|
|
|
|
retf
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
;retfourne en DS:%1 les set support<72> du processeur par rapport a la struct %0
|
|
|
|
|
proc setinfo uses bx si di, pointer:word,set:word
|
|
|
|
|
mov di,[set]
|
|
|
|
|
virtual at 0
|
|
|
|
|
.cpu cpu
|
|
|
|
|
end virtual
|
|
|
|
|
lea si,[ds:.cpu.mmx]
|
|
|
|
|
add si,[pointer]
|
|
|
|
|
mov bx,.theset
|
|
|
|
|
.set:
|
|
|
|
|
cmp word [cs:bx],0FFFFh
|
|
|
|
|
je .endofset
|
|
|
|
|
cmp byte [si],1
|
|
|
|
|
jne .nextset
|
2007-03-13 21:49:51 +01:00
|
|
|
|
push bx
|
|
|
|
|
mov bx,[cs:bx]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.put:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov al,[cs:bx]
|
|
|
|
|
cmp al,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .enofput
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov [di],al
|
|
|
|
|
inc bx
|
|
|
|
|
inc di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .put
|
|
|
|
|
.enofput:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
pop bx
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.nextset:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
inc bx
|
|
|
|
|
inc bx
|
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .set
|
|
|
|
|
.endofset:
|
|
|
|
|
mov byte [di],0
|
|
|
|
|
retf
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.theset dw .mmx
|
|
|
|
|
dw .mmx2
|
|
|
|
|
dw .sse
|
|
|
|
|
dw .sse2
|
|
|
|
|
dw .sse3
|
|
|
|
|
dw .fpu
|
|
|
|
|
dw .now3d
|
|
|
|
|
dw .now3d2
|
|
|
|
|
dw .htt
|
|
|
|
|
dw .apic
|
2007-03-13 21:49:51 +01:00
|
|
|
|
dw 0FFFFh
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.mmx db "MMX ",0
|
|
|
|
|
.mmx2 db "MMX2 ",0
|
|
|
|
|
.now3d db "3dNow! ",0
|
|
|
|
|
.now3d2 db "3dNow Extended! ",0
|
|
|
|
|
.htt db "HyperThreading",0
|
|
|
|
|
.sse db "SSE ",0
|
|
|
|
|
.sse2 db "SSE2 ",0
|
|
|
|
|
.sse3 db "SSE3 ",0
|
|
|
|
|
.apic db "APIC ",0
|
|
|
|
|
.fpu db "FPU ",0
|
|
|
|
|
|
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
;retfourne en DS:%0 les capacit<69>s du processeur
|
|
|
|
|
proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
|
2007-03-13 21:49:51 +01:00
|
|
|
|
push ds
|
|
|
|
|
pop es
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov al,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
virtual at 0
|
|
|
|
|
.cpu cpu
|
|
|
|
|
end virtual
|
|
|
|
|
mov cx,.cpu.sizeof
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cld
|
|
|
|
|
rep stosb
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
call nocpuid ;Test si cpuid est dispo
|
2019-07-09 10:33:10 +02:00
|
|
|
|
je .nocpuidatall
|
2007-03-13 21:49:51 +01:00
|
|
|
|
xor eax,eax
|
|
|
|
|
cpuid ;Fonction 0 de CPUID
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov dword [.cpu.vendor],ebx ;Vendeur sur 13 octets
|
|
|
|
|
mov dword [.cpu.vendor+4],edx
|
|
|
|
|
mov dword [.cpu.vendor+8],ecx
|
|
|
|
|
mov byte [.cpu.vendor+12],0
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cmp eax,1
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .nofonc1
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov eax,1
|
|
|
|
|
cpuid ;Fonction 1 de CPUID
|
|
|
|
|
mov ebx,eax ;infos de model
|
|
|
|
|
and ebx,1111b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [.cpu.stepping],bl
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shr eax,4
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
and ebx,1111b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [.cpu.models],bl
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shr eax,4
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
and ebx,1111b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [.cpu.family],bl
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shr eax,4
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
and ebx,11b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [.cpu.types],bl
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shr eax,2
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
and ebx,1111b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [.cpu.emodels],bl
|
2007-03-13 21:49:51 +01:00
|
|
|
|
shr eax,4
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov [.cpu.efamily],al
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,1 ;infos de jeu d'instruction
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.fpu]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,100000000000000000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.mmx]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,10000000000000000000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.sse]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,100000000000000000000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.sse2]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,ecx
|
|
|
|
|
and ebx,1b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.sse3]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,10000000000000000000000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.htt]
|
|
|
|
|
.nofonc1:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov eax,80000000h ;Fonction 80000000 de CPUID
|
|
|
|
|
cpuid
|
|
|
|
|
cmp eax,80000001h
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jb .nofonc8
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov eax,80000001h ;Fonction 80000000 de CPUID
|
|
|
|
|
cpuid
|
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,10000000000000000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.mmx2]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,1000000000000000000000000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.now3d]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,10000000000000000000000000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.now3d2]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov ebx,edx
|
|
|
|
|
and ebx,1000000000b
|
2019-07-09 10:33:10 +02:00
|
|
|
|
setnz [.cpu.apic]
|
|
|
|
|
.nofonc8:
|
|
|
|
|
mov si,.marks
|
2007-03-13 21:49:51 +01:00
|
|
|
|
push cs
|
|
|
|
|
pop ds
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.search:
|
|
|
|
|
mov di,[pointer]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov cx,12
|
|
|
|
|
cld
|
|
|
|
|
rep cmpsb
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .notthegood
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cmp cx,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .notthegood
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov cl,[si]
|
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
mov al,0
|
|
|
|
|
stosb
|
2019-07-09 10:33:10 +02:00
|
|
|
|
mov di,[pointer]
|
|
|
|
|
cmp [es:.cpu.family],15
|
|
|
|
|
jne .notextended
|
|
|
|
|
mov al,[es:.cpu.efamily]
|
|
|
|
|
mov ah,[es:.cpu.emodels]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov di,[si+2]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jmp .searchmodel
|
|
|
|
|
.notextended:
|
|
|
|
|
mov al,[es:.cpu.family]
|
|
|
|
|
mov ah,[es:.cpu.models]
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov di,[si]
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.searchmodel:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
cmp [di],ax
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .notgoodfamily
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov si,di
|
|
|
|
|
inc si
|
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
lea di,[es:.cpu.names]
|
|
|
|
|
add di,[pointer]
|
|
|
|
|
.copystr:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
mov al,[si]
|
|
|
|
|
mov [es:di],al
|
|
|
|
|
inc si
|
|
|
|
|
inc di
|
|
|
|
|
cmp al,0
|
2019-07-09 10:33:10 +02:00
|
|
|
|
jne .copystr
|
|
|
|
|
jmp .endofsearch
|
|
|
|
|
.notgoodfamily:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
inc di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.nextelement:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
inc di
|
2019-07-09 10:33:10 +02:00
|
|
|
|
cmp byte [di-1],0
|
|
|
|
|
jne .nextelement
|
|
|
|
|
jmp .searchmodel
|
|
|
|
|
.notthegood:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
cmp word [si],0FFFFh
|
|
|
|
|
jne .notthegood
|
2007-03-13 21:49:51 +01:00
|
|
|
|
inc si
|
|
|
|
|
inc si
|
2019-07-09 10:33:10 +02:00
|
|
|
|
cmp word [si],0FFFFh
|
|
|
|
|
je .endofsearch
|
|
|
|
|
jmp .search
|
|
|
|
|
.endofsearch:
|
|
|
|
|
retf
|
|
|
|
|
.nocpuidatall:
|
|
|
|
|
retf
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
;tableau avec vendeur taille + chainereelle + pointeur famille + pointeur famille etendue
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.marks db "GenuineIntel",5,"Intel"
|
|
|
|
|
dw .intelfamily,.intelfamilye
|
2007-03-13 21:49:51 +01:00
|
|
|
|
dw 0FFFFh
|
|
|
|
|
|
|
|
|
|
db "AuthenticAMD",3,"Amd"
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw .amdfamily,.amdfamilye
|
2007-03-13 21:49:51 +01:00
|
|
|
|
dw 0FFFFh
|
|
|
|
|
|
|
|
|
|
db "CyrixInstead",5,"Cyrix"
|
2019-07-09 10:33:10 +02:00
|
|
|
|
dw .cyrixfamily,.cyrixfamilye
|
2007-03-13 21:49:51 +01:00
|
|
|
|
dw 0FFFFh
|
|
|
|
|
dw 0FFFFh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;tableau avec famille modele et chaine 0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.intelfamily:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
db 4,0,"486 DX-25/33",0
|
|
|
|
|
db 4,1,"486 DX-50",0
|
|
|
|
|
db 4,2,"486 SX",0
|
|
|
|
|
db 4,3,"486 DX/2",0
|
|
|
|
|
db 4,4,"486 SL",0
|
|
|
|
|
db 4,5,"486 SX/2",0
|
|
|
|
|
db 4,7,"486 DX/2-WB",0
|
|
|
|
|
db 4,8,"486 DX/4",0
|
|
|
|
|
db 4,9,"486 DX/4-WB",0
|
|
|
|
|
db 5,0,"Pentium 60/66 A-step",0
|
|
|
|
|
db 5,1,"Pentium 60/66",0
|
|
|
|
|
db 5,2,"Pentium 75 - 200",0
|
|
|
|
|
db 5,3,"OverDrive PODP5V83",0
|
|
|
|
|
db 5,4,"Pentium MMX",0
|
|
|
|
|
db 5,7,"Mobile Pentium 75-200",0
|
|
|
|
|
db 5,8,"Mobile Pentium MMX",0
|
|
|
|
|
db 6,0,"Pentium Pro A-step",0
|
|
|
|
|
db 6,1,"Pentium Pro",0
|
|
|
|
|
db 6,3,"Pentium II (Klamath)",0
|
|
|
|
|
db 6,5,"Pentium II (Deschutes)",0
|
|
|
|
|
db 6,6,"Mobile Pentium II",0
|
|
|
|
|
db 6,7,"Pentium III (Katmai)",0
|
|
|
|
|
db 6,8,"Pentium III (Coppermine)",0
|
|
|
|
|
db 6,9,"Mobile Pentium III",0
|
|
|
|
|
db 6,10,"Pentium III (0.18 <20>m)",0
|
|
|
|
|
db 6,11,"Pentium III (0.13 <20>m)",0
|
|
|
|
|
db 7,0,"Itanium (IA-64)",0
|
|
|
|
|
db 0FFh,0FFh,"Inconnu",0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.intelfamilye:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
db 0,0,"Pentium IV (0.18 <20>m)",0
|
|
|
|
|
db 0,1,"Pentium IV (0.18 <20>m)",0
|
|
|
|
|
db 0,2,"Pentium IV (0.13 <20>m)",0
|
|
|
|
|
db 0,3,"Pentium IV (0.09 <20>m)",0
|
|
|
|
|
db 1,0,"Itanium 2 (IA-64)",0
|
|
|
|
|
db 0FFh,0FFh,"Inconnu",0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.amdfamily:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
db 4,3,"486 DX/2",0
|
|
|
|
|
db 4,7,"486 DX/2-WB",0
|
|
|
|
|
db 4,8,"486 DX/4",0
|
|
|
|
|
db 4,9,"486 DX/4-WB",0
|
|
|
|
|
db 4,14,"Am5x86-WT",0
|
|
|
|
|
db 4,15,"Am5x86-WB",0
|
|
|
|
|
db 5,0,"K5/SSA5",0
|
|
|
|
|
db 5,1,"K5 (PR120/133)",0
|
|
|
|
|
db 5,2,"K5 (PR166)",0
|
|
|
|
|
db 5,3,"K5 (PR200)",0
|
|
|
|
|
db 5,6,"K6 (0.30 <20>m)",0
|
|
|
|
|
db 5,7,"K6 (0.25 <20>m)",0
|
|
|
|
|
db 5,8,"K6-2",0
|
|
|
|
|
db 5,9,"K6-3",0
|
|
|
|
|
db 5,13,"K6-2+/K6-III+ (0.18 <20>m)",0
|
|
|
|
|
db 6,0,"Athlon (25 <20>m)",0
|
|
|
|
|
db 6,1,"Athlon (25 <20>m)",0
|
|
|
|
|
db 6,2,"Athlon (18 <20>m)",0
|
|
|
|
|
db 6,3,"Duron",0
|
|
|
|
|
db 6,4,"Athlon (Thunderbird)",0
|
|
|
|
|
db 6,6,"Athlon (Palamino)",0
|
|
|
|
|
db 6,7,"Duron (Morgan)",0
|
|
|
|
|
db 6,8,"Athlon (Thoroughbred)",0
|
|
|
|
|
db 6,10,"Athlon (Barton)",0
|
|
|
|
|
db 0FFh,0FFh,"Inconnu",0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.amdfamilye:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
db 0,4,"Athlon 64",0
|
|
|
|
|
db 0,5,"Athlon 64 FX/Opteron",0
|
|
|
|
|
db 0FFh,0FFh,"Inconnu",0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.cyrixfamily:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
db 4,4,"MediaGX",0
|
|
|
|
|
db 5,2,"6x86/6x86L",0
|
|
|
|
|
db 5,4,"MediaGX MMX Enhanced",0
|
|
|
|
|
db 6,0,"MII (6x86MX)",0
|
|
|
|
|
db 6,5,"VIA Cyrix M2 core",0
|
|
|
|
|
db 6,6,"WinChip C5A",0
|
|
|
|
|
db 6,7,"WinChip C5B/WinChip C5C",0
|
|
|
|
|
db 6,8,"WinChip C5N",0
|
|
|
|
|
db 6,9,"WinChip C5XL/WinChip C5P",0
|
|
|
|
|
db 0FFh,0FFh,"Inconnu",0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
.cyrixfamilye:
|
2007-03-13 21:49:51 +01:00
|
|
|
|
db 0FFh,0FFh,"Inconnu",0
|
|
|
|
|
|
2019-07-09 10:33:10 +02:00
|
|
|
|
endp
|
2007-03-13 21:49:51 +01:00
|
|
|
|
|
|
|
|
|
;Test si CPUID est support<72> oui=not Equal
|
|
|
|
|
nocpuid:
|
|
|
|
|
pushfd
|
|
|
|
|
pop eax
|
|
|
|
|
xor eax,00200000h
|
|
|
|
|
push eax
|
|
|
|
|
popfd
|
|
|
|
|
pushfd
|
|
|
|
|
pop eax
|
|
|
|
|
cmp eax,ebx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|