refactor: mise à jour vers fasm, librairies et noyau
This commit is contained in:
parent
d2028e1803
commit
a9cba3a71a
|
@ -18,4 +18,5 @@ struc cpu
|
|||
.now3d2 db 0
|
||||
.htt db 0
|
||||
.apic db 0
|
||||
.sizeof = $ - .vendor
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ struc diskbuffer
|
|||
.size dw 12
|
||||
.current dw 0FFFFh
|
||||
.chain dw 128 dup (0FFFFh)
|
||||
.sizeof = $ - .size
|
||||
}
|
||||
|
||||
struc dpt
|
||||
|
@ -18,6 +19,7 @@ struc dpt
|
|||
.formatbyte db 0F6h ;Octet de formatage
|
||||
.headsettlingtime db 000h ;Temps de repos des tˆtes
|
||||
.delaymotornormspeed db 008h ;Temps de mont‚e en vitesse du moteur
|
||||
.sizeof = $ - .steprateheadunload
|
||||
}
|
||||
|
||||
struc entries
|
||||
|
@ -35,6 +37,7 @@ struc entries
|
|||
.filedate dw 0
|
||||
.filegroup dw 0
|
||||
.filesize dd 0
|
||||
.sizeof = $ - .filename
|
||||
}
|
||||
|
||||
;Pour recherches
|
||||
|
@ -45,6 +48,7 @@ struc find files
|
|||
.adressdirectory dw 0 ;En cluster
|
||||
.firstsearch db 1 ;Premiere requete ?
|
||||
.result entries
|
||||
.sizeof = $ - .files
|
||||
}
|
||||
|
||||
struc bootinfo vendor,drivename,serialnumber
|
||||
|
@ -69,4 +73,5 @@ struc bootinfo vendor,drivename,serialnumber
|
|||
.serialnumber dd 01020304h ;no de serie
|
||||
.drivename db 'COS2000 ' ;nom de volume
|
||||
.typeoffat db 'FAT12 ' ;FAT
|
||||
.sizeof = $ - .vendor
|
||||
}
|
||||
|
|
|
@ -1,32 +1,36 @@
|
|||
struc point
|
||||
coordx db 0
|
||||
coordy db 0
|
||||
ends point
|
||||
{
|
||||
.coordx db 0
|
||||
.coordy db 0
|
||||
}
|
||||
|
||||
struc vgainf
|
||||
lines db 0
|
||||
columns db 0
|
||||
x db 0
|
||||
y db 0
|
||||
xy dw 0
|
||||
colors db 7
|
||||
mode db 0FFh
|
||||
pagesize dw 0
|
||||
style db 0
|
||||
font db 0
|
||||
graphic db 0
|
||||
nbpage db 0
|
||||
color db 0
|
||||
cursor db 0
|
||||
segments dw 0
|
||||
linesize dw 0
|
||||
adress dw 0
|
||||
base dw 0
|
||||
scrolling db 1
|
||||
ends vgainf
|
||||
{
|
||||
.lines db 0
|
||||
.columns db 0
|
||||
.x db 0
|
||||
.y db 0
|
||||
.xy dw 0
|
||||
.colors db 7
|
||||
.modenum db 0FFh
|
||||
.pagesize dw 0
|
||||
.style db 0
|
||||
.font db 0
|
||||
.graphic db 0
|
||||
.nbpage db 0
|
||||
.color db 0
|
||||
.cursor db 0
|
||||
.segments dw 0
|
||||
.linesize dw 0
|
||||
.adress dw 0
|
||||
.base dw 0
|
||||
.scrolling db 1
|
||||
.sizeof = $ - .lines
|
||||
}
|
||||
|
||||
|
||||
struc vertex2d
|
||||
px dw ?
|
||||
py dw ?
|
||||
ends vertex2d
|
||||
{
|
||||
.px dw ?
|
||||
.py dw ?
|
||||
}
|
||||
|
|
|
@ -111,13 +111,13 @@ macro importing
|
|||
macro noimporting
|
||||
{
|
||||
imports:
|
||||
dd 0
|
||||
ende
|
||||
}
|
||||
|
||||
macro noexporting
|
||||
{
|
||||
imports:
|
||||
dd 0
|
||||
ende
|
||||
}
|
||||
|
||||
macro ende
|
||||
|
@ -132,7 +132,7 @@ macro endi
|
|||
|
||||
macro use lib*,fonction*
|
||||
{
|
||||
db "&lib&::&fonction&",0
|
||||
db `lib,"::",`fonction,0
|
||||
fonction:
|
||||
dd 0
|
||||
dd 0
|
||||
|
@ -140,7 +140,7 @@ fonction:
|
|||
|
||||
macro declare fonction*
|
||||
{
|
||||
db "&fonction&",0
|
||||
db `fonction,0
|
||||
dw fonction
|
||||
}
|
||||
|
||||
|
@ -148,50 +148,27 @@ macro declare fonction*
|
|||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
{
|
||||
common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushw arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushw arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushw arg
|
||||
size@ccall = size@ccall+2
|
||||
push arg
|
||||
common
|
||||
end if
|
||||
push cs
|
||||
call proc
|
||||
if size@ccall
|
||||
add sp,size@ccall
|
||||
end if }
|
||||
}
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
macro invoke proc,[arg] ; directly call STDCALL procedure
|
||||
{
|
||||
common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushw arg
|
||||
size@ccall = size@ccall+2
|
||||
push arg
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add sp,size@ccall
|
||||
end if }
|
||||
call far [cs:proc]
|
||||
}
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
|
@ -231,10 +208,6 @@ macro define@proc name,statement
|
|||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at bp+4
|
||||
|
|
628
lib/detect.asm
628
lib/detect.asm
|
@ -1,17 +1,10 @@
|
|||
model tiny,stdcall
|
||||
p586
|
||||
locals
|
||||
jumps
|
||||
codeseg
|
||||
option procalign:byte
|
||||
|
||||
include "..\include\mem.h"
|
||||
include "..\include\cpu.h"
|
||||
include "..\include\pci.h"
|
||||
|
||||
org 0h
|
||||
|
||||
header exe <"CE",1,0,0,offset exports,,,>
|
||||
header exe 1
|
||||
|
||||
exporting
|
||||
declare cpuinfo
|
||||
|
@ -26,73 +19,68 @@ declare pcireaddword
|
|||
declare detectvmware
|
||||
ende
|
||||
|
||||
PROC detectvmware FAR
|
||||
USES eax,ebx,ecx,edx
|
||||
proc detectvmware uses eax ebx ecx edx
|
||||
mov eax,564D5868h
|
||||
mov ebx,12345h
|
||||
mov ecx,00Ah
|
||||
mov edx,5658h
|
||||
in ax,dx
|
||||
cmp ebx,564D5868h
|
||||
ret
|
||||
endp detectvmware
|
||||
retf
|
||||
endp
|
||||
|
||||
;renvoie un pointer dx:ax vers la classe %0
|
||||
PROC getpciclass FAR
|
||||
ARG @class:word
|
||||
USES di
|
||||
mov di,[@class]
|
||||
proc getpciclass uses di, class:word
|
||||
mov di,[class]
|
||||
and di,0FFh
|
||||
shl di,1
|
||||
mov ax,[cs:offset classes+di]
|
||||
mov ax,[cs:classes+di]
|
||||
mov dx,cs
|
||||
ret
|
||||
endp getpciclass
|
||||
retf
|
||||
endp
|
||||
|
||||
;renvoie un pointer dx:ax vers la sous-classe de %1 et de classe %0
|
||||
PROC getpcisubclass FAR
|
||||
ARG @class:word,@subclass:word
|
||||
USES di
|
||||
mov di,[@class]
|
||||
proc getpcisubclass uses di, class:word,subclass:word
|
||||
mov di,[class]
|
||||
and di,0FFh
|
||||
shl di,1
|
||||
mov di,[cs:offset classesd+di]
|
||||
mov dx,[@subclass]
|
||||
mov di,[cs:classesd+di]
|
||||
mov dx,[subclass]
|
||||
and dx,0FFh
|
||||
cmp dx,80h
|
||||
jne @@suiteac
|
||||
mov ax,offset divers
|
||||
jmp @@found
|
||||
@@suiteac:
|
||||
jne .suiteac
|
||||
mov ax,divers
|
||||
jmp .found
|
||||
.suiteac:
|
||||
shl dx,1
|
||||
add di,dx
|
||||
mov ax,[cs:di]
|
||||
@@found:
|
||||
.found:
|
||||
mov dx,cs
|
||||
ret
|
||||
endp getpcisubclass
|
||||
retf
|
||||
endp
|
||||
|
||||
divers db 'divers',0
|
||||
|
||||
classes:
|
||||
dw offset class0
|
||||
dw offset class1
|
||||
dw offset class2
|
||||
dw offset class3
|
||||
dw offset class4
|
||||
dw offset class5
|
||||
dw offset class6
|
||||
dw offset class7
|
||||
dw offset class8
|
||||
dw offset class9
|
||||
dw offset class10
|
||||
dw offset class11
|
||||
dw offset class12
|
||||
dw offset class13
|
||||
dw offset class14
|
||||
dw offset class15
|
||||
dw offset class16
|
||||
dw offset class17
|
||||
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
|
||||
class0 db 'ancien',0
|
||||
class1 db 'stockage',0
|
||||
class2 db 'reseau',0
|
||||
|
@ -115,37 +103,37 @@ class17 db 'traitement signal',0
|
|||
|
||||
;Classes et sous classes
|
||||
classesd:
|
||||
dw offset class0d
|
||||
dw offset class1d
|
||||
dw offset class2d
|
||||
dw offset class3d
|
||||
dw offset class4d
|
||||
dw offset class5d
|
||||
dw offset class6d
|
||||
dw offset class7d
|
||||
dw offset class8d
|
||||
dw offset class9d
|
||||
dw offset class10d
|
||||
dw offset class11d
|
||||
dw offset class12d
|
||||
dw offset class13d
|
||||
dw offset class14d
|
||||
dw offset class15d
|
||||
dw offset class16d
|
||||
dw offset class17d
|
||||
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
|
||||
|
||||
class0d:
|
||||
dw offset subclass00
|
||||
dw offset subclass01
|
||||
dw subclass00
|
||||
dw subclass01
|
||||
subclass00 db 'divers',0
|
||||
subclass01 db 'vga',0
|
||||
|
||||
class1d:
|
||||
dw offset subclass10
|
||||
dw offset subclass11
|
||||
dw offset subclass12
|
||||
dw offset subclass13
|
||||
dw offset subclass14
|
||||
dw subclass10
|
||||
dw subclass11
|
||||
dw subclass12
|
||||
dw subclass13
|
||||
dw subclass14
|
||||
subclass10 db 'scsi',0
|
||||
subclass11 db 'ide',0
|
||||
subclass12 db 'disquette',0
|
||||
|
@ -153,11 +141,11 @@ subclass13 db 'ipi',0
|
|||
subclass14 db 'raid',0
|
||||
|
||||
class2d:
|
||||
dw offset subclass20
|
||||
dw offset subclass21
|
||||
dw offset subclass22
|
||||
dw offset subclass23
|
||||
dw offset subclass24
|
||||
dw subclass20
|
||||
dw subclass21
|
||||
dw subclass22
|
||||
dw subclass23
|
||||
dw subclass24
|
||||
subclass20 db 'ethernet',0
|
||||
subclass21 db 'token ring',0
|
||||
subclass22 db 'fddi',0
|
||||
|
@ -165,37 +153,37 @@ subclass23 db 'atm',0
|
|||
subclass24 db 'isdn',0
|
||||
|
||||
class3d:
|
||||
dw offset subclass30
|
||||
dw offset subclass31
|
||||
dw offset subclass32
|
||||
dw subclass30
|
||||
dw subclass31
|
||||
dw subclass32
|
||||
subclass30 db 'vga',0
|
||||
subclass31 db 'xga',0
|
||||
subclass32 db '3D',0
|
||||
|
||||
class4d:
|
||||
dw offset subclass40
|
||||
dw offset subclass41
|
||||
dw offset subclass42
|
||||
dw subclass40
|
||||
dw subclass41
|
||||
dw subclass42
|
||||
subclass40 db 'video',0
|
||||
subclass41 db 'audio',0
|
||||
subclass42 db 'telephonie',0
|
||||
|
||||
class5d:
|
||||
dw offset subclass50
|
||||
dw offset subclass51
|
||||
dw subclass50
|
||||
dw subclass51
|
||||
subclass50 db 'ram',0
|
||||
subclass51 db 'flash',0
|
||||
|
||||
class6d:
|
||||
dw offset subclass60
|
||||
dw offset subclass61
|
||||
dw offset subclass62
|
||||
dw offset subclass63
|
||||
dw offset subclass64
|
||||
dw offset subclass65
|
||||
dw offset subclass66
|
||||
dw offset subclass67
|
||||
dw offset subclass68
|
||||
dw subclass60
|
||||
dw subclass61
|
||||
dw subclass62
|
||||
dw subclass63
|
||||
dw subclass64
|
||||
dw subclass65
|
||||
dw subclass66
|
||||
dw subclass67
|
||||
dw subclass68
|
||||
subclass60 db 'hote',0
|
||||
subclass61 db 'isa',0
|
||||
subclass62 db 'eisa',0
|
||||
|
@ -207,21 +195,21 @@ subclass67 db 'cardbus',0
|
|||
subclass68 db 'RACEway',0
|
||||
|
||||
class7d:
|
||||
dw offset subclass70
|
||||
dw offset subclass71
|
||||
dw offset subclass72
|
||||
dw offset subclass73
|
||||
dw subclass70
|
||||
dw subclass71
|
||||
dw subclass72
|
||||
dw subclass73
|
||||
subclass70 db 'serie',0
|
||||
subclass71 db 'parallele',0
|
||||
subclass72 db 'serie multiport',0
|
||||
subclass73 db 'modem',0
|
||||
|
||||
class8d:
|
||||
dw offset subclass80
|
||||
dw offset subclass81
|
||||
dw offset subclass82
|
||||
dw offset subclass83
|
||||
dw offset subclass84
|
||||
dw subclass80
|
||||
dw subclass81
|
||||
dw subclass82
|
||||
dw subclass83
|
||||
dw subclass84
|
||||
subclass80 db 'pic',0
|
||||
subclass81 db 'dma',0
|
||||
subclass82 db 'timer',0
|
||||
|
@ -229,11 +217,11 @@ subclass83 db 'rtc',0
|
|||
subclass84 db 'hotplug',0
|
||||
|
||||
class9d:
|
||||
dw offset subclass90
|
||||
dw offset subclass91
|
||||
dw offset subclass92
|
||||
dw offset subclass93
|
||||
dw offset subclass94
|
||||
dw subclass90
|
||||
dw subclass91
|
||||
dw subclass92
|
||||
dw subclass93
|
||||
dw subclass94
|
||||
subclass90 db 'clavier',0
|
||||
subclass91 db 'stylo',0
|
||||
subclass92 db 'souris',0
|
||||
|
@ -241,15 +229,15 @@ subclass93 db 'scanner',0
|
|||
subclass94 db 'joystick',0
|
||||
|
||||
class10d:
|
||||
dw offset subclass100
|
||||
dw subclass100
|
||||
subclass100 db 'station',0
|
||||
|
||||
class11d:
|
||||
dw offset subclass110
|
||||
dw offset subclass111
|
||||
dw offset subclass112
|
||||
dw offset subclass113
|
||||
dw offset subclass114
|
||||
dw subclass110
|
||||
dw subclass111
|
||||
dw subclass112
|
||||
dw subclass113
|
||||
dw subclass114
|
||||
subclass110 db '386',0
|
||||
subclass111 db '486',0
|
||||
subclass112 db 'pentium',0
|
||||
|
@ -257,12 +245,12 @@ subclass113 db 'alpha',0
|
|||
subclass114 db 'coprocesseur',0
|
||||
|
||||
class12d:
|
||||
dw offset subclass120
|
||||
dw offset subclass121
|
||||
dw offset subclass122
|
||||
dw offset subclass123
|
||||
dw offset subclass124
|
||||
dw offset subclass125
|
||||
dw subclass120
|
||||
dw subclass121
|
||||
dw subclass122
|
||||
dw subclass123
|
||||
dw subclass124
|
||||
dw subclass125
|
||||
subclass120 db 'firewire',0
|
||||
subclass121 db 'access',0
|
||||
subclass122 db 'ssa',0
|
||||
|
@ -271,87 +259,86 @@ subclass124 db 'fibre',0
|
|||
subclass125 db 'smbus',0
|
||||
|
||||
class13d:
|
||||
dw offset subclass130
|
||||
dw offset subclass131
|
||||
dw offset subclass132
|
||||
dw subclass130
|
||||
dw subclass131
|
||||
dw subclass132
|
||||
subclass130 db 'irda',0
|
||||
subclass131 db 'ir',0
|
||||
subclass132 db 'rf',0
|
||||
|
||||
class14d:
|
||||
dw offset subclass140
|
||||
dw subclass140
|
||||
subclass140 db 'IO arch',0
|
||||
|
||||
class15d:
|
||||
dw offset subclass150
|
||||
dw offset subclass151
|
||||
dw offset subclass152
|
||||
dw offset subclass153
|
||||
dw subclass150
|
||||
dw subclass151
|
||||
dw subclass152
|
||||
dw subclass153
|
||||
subclass150 db 'tv',0
|
||||
subclass151 db 'audio',0
|
||||
subclass152 db 'voix',0
|
||||
subclass153 db 'donnees',0
|
||||
|
||||
class16d:
|
||||
dw offset subclass160
|
||||
dw offset subclass161
|
||||
dw subclass160
|
||||
dw subclass161
|
||||
subclass160 db 'reseau',0
|
||||
subclass161 db 'jeux',0
|
||||
|
||||
class17d:
|
||||
dw offset subclass170
|
||||
dw subclass170
|
||||
subclass170 db 'dpio',0
|
||||
|
||||
|
||||
;al=bus cl=deviceid ch=func es:di
|
||||
PROC getcardinfo FAR
|
||||
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||
USES eax,bx,di
|
||||
mov di,[@pointer]
|
||||
cmp [@function],0
|
||||
je @@amultiorfirst
|
||||
call pcireadbyte,[@bus],[@device],0,offset (pcidata).typed
|
||||
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
|
||||
and al,multifunction
|
||||
cmp al,0
|
||||
jne @@amultiorfirst
|
||||
mov [word ptr di],0000h
|
||||
jmp @@notexist
|
||||
@@amultiorfirst:
|
||||
jne .amultiorfirst
|
||||
mov word [di],0000h
|
||||
jmp .notexist
|
||||
.amultiorfirst:
|
||||
xor bx,bx
|
||||
@@goinfos:
|
||||
call pcireadword,[@bus],[@device],[@function],bx
|
||||
.goinfos:
|
||||
stdcall pcireadword,[bus],[device],[function],bx
|
||||
inc bl
|
||||
inc bl
|
||||
cmp bl,2
|
||||
ja @@notzarb
|
||||
ja .notzarb
|
||||
cmp ax,0FFFFh
|
||||
je @@notexist
|
||||
je .notexist
|
||||
cmp ax,00000h
|
||||
je @@notexist
|
||||
@@notzarb:
|
||||
je .notexist
|
||||
.notzarb:
|
||||
mov [ds:di],ax
|
||||
inc di
|
||||
inc di
|
||||
cmp bl,40h
|
||||
jbe @@goinfos
|
||||
jbe .goinfos
|
||||
clc
|
||||
ret
|
||||
@@notexist:
|
||||
retf
|
||||
.notexist:
|
||||
stc
|
||||
ret
|
||||
endp getcardinfo
|
||||
retf
|
||||
endp
|
||||
|
||||
;lit un octet du bus %0 device %1 function %2 nø %3 et le met en AL
|
||||
PROC pcireadbyte FAR
|
||||
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||
USES bx,dx
|
||||
mov al,[byte ptr @bus]
|
||||
proc pcireadbyte uses bx dx, bus:word,device:word,function:word,pointer:word
|
||||
mov al,byte [bus]
|
||||
mov ah,80h
|
||||
shl eax,16
|
||||
mov ah,[byte ptr @device]
|
||||
mov ah,byte [device]
|
||||
shl ah,3
|
||||
or ah,[byte ptr @function]
|
||||
mov bl,[byte ptr @pointer]
|
||||
or ah,byte [function]
|
||||
mov bl,byte [pointer]
|
||||
mov al,bl
|
||||
and al,0fch
|
||||
mov dx,config1addr
|
||||
|
@ -360,20 +347,18 @@ PROC pcireadbyte FAR
|
|||
and bl,3
|
||||
or dl,bl
|
||||
in al,dx
|
||||
ret
|
||||
endp pcireadbyte
|
||||
retf
|
||||
endp
|
||||
|
||||
;lit 2 octet du bus %0 device %1 function %2 nø %3 et le met en AX
|
||||
PROC pcireadword FAR
|
||||
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||
USES bx,dx
|
||||
mov al,[byte ptr @bus]
|
||||
proc pcireadword uses bx dx, bus:word,device:word,function:word,pointer:word
|
||||
mov al,byte [bus]
|
||||
mov ah,80h
|
||||
shl eax,16
|
||||
mov ah,[byte ptr @device]
|
||||
mov ah,byte [device]
|
||||
shl ah,3
|
||||
or ah,[byte ptr @function]
|
||||
mov bl,[byte ptr @pointer]
|
||||
or ah,byte [function]
|
||||
mov bl,byte [pointer]
|
||||
mov al,bl
|
||||
and al,0fch
|
||||
mov dx,config1addr
|
||||
|
@ -382,20 +367,18 @@ PROC pcireadword FAR
|
|||
and bl,3
|
||||
or dl,bl
|
||||
in ax,dx
|
||||
ret
|
||||
endp pcireadword
|
||||
retf
|
||||
endp
|
||||
|
||||
;lit 4 octet du bus %0 device %1 function %2 nø %3 et le met en EAX
|
||||
PROC pcireaddword FAR
|
||||
ARG @bus:word,@device:word,@function:word,@pointer:word
|
||||
USES bx,dx
|
||||
mov al,[byte ptr @bus]
|
||||
proc pcireaddword uses bx dx, bus:word,device:word,function:word,pointer:word
|
||||
mov al,byte [bus]
|
||||
mov ah,80h
|
||||
shl eax,16
|
||||
mov ah,[byte ptr @device]
|
||||
mov ah,byte [device]
|
||||
shl ah,3
|
||||
or ah,[byte ptr @function]
|
||||
mov bl,[byte ptr @pointer]
|
||||
or ah,byte [function]
|
||||
mov bl,byte [pointer]
|
||||
mov al,bl
|
||||
and al,0fch
|
||||
mov dx,config1addr
|
||||
|
@ -404,263 +387,266 @@ PROC pcireaddword FAR
|
|||
and bl,3
|
||||
or dl,bl
|
||||
in eax,dx
|
||||
ret
|
||||
endp pcireaddword
|
||||
retf
|
||||
endp
|
||||
|
||||
;Prob avec str pci
|
||||
;renvoie en %0 la structure pciinf carry if error
|
||||
PROC pciinfo FAR
|
||||
ARG @pointer:word
|
||||
USES ax,bx,cx,edx,edi
|
||||
proc pciinfo uses ax bx cx edx edi, pointer:word
|
||||
mov ax,0B101h
|
||||
xor edi,edi
|
||||
mov edx," PCI"
|
||||
int 1Ah
|
||||
jc @@errorpci
|
||||
jc .errorpci
|
||||
cmp dx,04350h
|
||||
jne @@errorpci
|
||||
jne .errorpci
|
||||
cmp ah,0
|
||||
jne @@errorpci
|
||||
mov di,[@pointer]
|
||||
mov [(pciinf di).version_major],bh
|
||||
mov [(pciinf di).version_minor],bl
|
||||
mov [(pciinf di).types],al
|
||||
mov [(pciinf di).maxbus],cl
|
||||
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
|
||||
clc
|
||||
ret
|
||||
@@errorpci:
|
||||
retf
|
||||
.errorpci:
|
||||
stc
|
||||
ret
|
||||
endp pciinfo
|
||||
retf
|
||||
endp
|
||||
|
||||
|
||||
;retourne en DS:%1 les set supporté du processeur par rapport a la struct %0
|
||||
PROC setinfo FAR
|
||||
ARG @pointer:word,@set:word
|
||||
USES bx,si,di
|
||||
mov di,[@set]
|
||||
lea si,[ds:cpu.mmx]
|
||||
add si,[@pointer]
|
||||
mov bx,offset @@theset
|
||||
@@set:
|
||||
cmp [word ptr cs:bx],0FFFFh
|
||||
je @@endofset
|
||||
cmp [byte ptr si],1
|
||||
jne @@nextset
|
||||
;retfourne en DS:%1 les set supporté 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
|
||||
push bx
|
||||
mov bx,[cs:bx]
|
||||
@@put:
|
||||
.put:
|
||||
mov al,[cs:bx]
|
||||
cmp al,0
|
||||
je @@enofput
|
||||
je .enofput
|
||||
mov [di],al
|
||||
inc bx
|
||||
inc di
|
||||
jmp @@put
|
||||
@@enofput:
|
||||
jmp .put
|
||||
.enofput:
|
||||
pop bx
|
||||
@@nextset:
|
||||
.nextset:
|
||||
inc bx
|
||||
inc bx
|
||||
inc si
|
||||
jmp @@set
|
||||
@@endofset:
|
||||
mov [byte ptr di],0
|
||||
ret
|
||||
jmp .set
|
||||
.endofset:
|
||||
mov byte [di],0
|
||||
retf
|
||||
|
||||
@@theset dw offset @@mmx
|
||||
dw offset @@mmx2
|
||||
dw offset @@sse
|
||||
dw offset @@sse2
|
||||
dw offset @@sse3
|
||||
dw offset @@fpu
|
||||
dw offset @@now3d
|
||||
dw offset @@now3d2
|
||||
dw offset @@htt
|
||||
dw offset @@apic
|
||||
.theset dw .mmx
|
||||
dw .mmx2
|
||||
dw .sse
|
||||
dw .sse2
|
||||
dw .sse3
|
||||
dw .fpu
|
||||
dw .now3d
|
||||
dw .now3d2
|
||||
dw .htt
|
||||
dw .apic
|
||||
dw 0FFFFh
|
||||
|
||||
@@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
|
||||
.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 setinfo
|
||||
endp
|
||||
|
||||
;retourne en DS:%0 les capacités du processeur
|
||||
PROC cpuinfo FAR
|
||||
ARG @pointer:word
|
||||
USES eax,ebx,ecx,edx,si,di,ds,es
|
||||
;retfourne en DS:%0 les capacités du processeur
|
||||
proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
|
||||
push ds
|
||||
pop es
|
||||
mov di,[@pointer]
|
||||
mov di,[pointer]
|
||||
mov al,0
|
||||
mov cx,size cpu
|
||||
virtual at 0
|
||||
.cpu cpu
|
||||
end virtual
|
||||
mov cx,.cpu.sizeof
|
||||
cld
|
||||
rep stosb
|
||||
mov di,[@pointer]
|
||||
mov di,[pointer]
|
||||
call nocpuid ;Test si cpuid est dispo
|
||||
je @@nocpuidatall
|
||||
je .nocpuidatall
|
||||
xor eax,eax
|
||||
cpuid ;Fonction 0 de CPUID
|
||||
mov [dword ptr (cpu di).vendor],ebx ;Vendeur sur 13 octets
|
||||
mov [dword ptr (cpu di+4).vendor],edx
|
||||
mov [dword ptr (cpu di+8).vendor],ecx
|
||||
mov [byte ptr (cpu di+12).vendor],0
|
||||
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
|
||||
cmp eax,1
|
||||
jb @@nofonc1
|
||||
jb .nofonc1
|
||||
mov eax,1
|
||||
cpuid ;Fonction 1 de CPUID
|
||||
mov ebx,eax ;infos de model
|
||||
and ebx,1111b
|
||||
mov [(cpu di).stepping],bl
|
||||
mov [.cpu.stepping],bl
|
||||
shr eax,4
|
||||
mov ebx,eax
|
||||
and ebx,1111b
|
||||
mov [(cpu di).models],bl
|
||||
mov [.cpu.models],bl
|
||||
shr eax,4
|
||||
mov ebx,eax
|
||||
and ebx,1111b
|
||||
mov [(cpu di).family],bl
|
||||
mov [.cpu.family],bl
|
||||
shr eax,4
|
||||
mov ebx,eax
|
||||
and ebx,11b
|
||||
mov [(cpu di).types],bl
|
||||
mov [.cpu.types],bl
|
||||
shr eax,2
|
||||
mov ebx,eax
|
||||
and ebx,1111b
|
||||
mov [(cpu di).emodels],bl
|
||||
mov [.cpu.emodels],bl
|
||||
shr eax,4
|
||||
mov [(cpu di).efamily],al
|
||||
mov [.cpu.efamily],al
|
||||
mov ebx,edx
|
||||
and ebx,1 ;infos de jeu d'instruction
|
||||
setnz [(cpu di).fpu]
|
||||
setnz [.cpu.fpu]
|
||||
mov ebx,edx
|
||||
and ebx,100000000000000000000000b
|
||||
setnz [(cpu di).mmx]
|
||||
setnz [.cpu.mmx]
|
||||
mov ebx,edx
|
||||
and ebx,10000000000000000000000000b
|
||||
setnz [(cpu di).sse]
|
||||
setnz [.cpu.sse]
|
||||
mov ebx,edx
|
||||
and ebx,100000000000000000000000000b
|
||||
setnz [(cpu di).sse2]
|
||||
setnz [.cpu.sse2]
|
||||
mov ebx,ecx
|
||||
and ebx,1b
|
||||
setnz [(cpu di).sse3]
|
||||
setnz [.cpu.sse3]
|
||||
mov ebx,edx
|
||||
and ebx,10000000000000000000000000000b
|
||||
setnz [(cpu di).htt]
|
||||
@@nofonc1:
|
||||
setnz [.cpu.htt]
|
||||
.nofonc1:
|
||||
mov eax,80000000h ;Fonction 80000000 de CPUID
|
||||
cpuid
|
||||
cmp eax,80000001h
|
||||
jb @@nofonc8
|
||||
jb .nofonc8
|
||||
mov eax,80000001h ;Fonction 80000000 de CPUID
|
||||
cpuid
|
||||
mov ebx,edx
|
||||
and ebx,10000000000000000000000b
|
||||
setnz [(cpu di).mmx2]
|
||||
setnz [.cpu.mmx2]
|
||||
mov ebx,edx
|
||||
and ebx,1000000000000000000000000000000b
|
||||
setnz [(cpu di).now3d]
|
||||
setnz [.cpu.now3d]
|
||||
mov ebx,edx
|
||||
and ebx,10000000000000000000000000000000b
|
||||
setnz [(cpu di).now3d2]
|
||||
setnz [.cpu.now3d2]
|
||||
mov ebx,edx
|
||||
and ebx,1000000000b
|
||||
setnz [(cpu di).apic]
|
||||
@@nofonc8:
|
||||
mov si,offset @@marks
|
||||
setnz [.cpu.apic]
|
||||
.nofonc8:
|
||||
mov si,.marks
|
||||
push cs
|
||||
pop ds
|
||||
@@search:
|
||||
mov di,[@pointer]
|
||||
.search:
|
||||
mov di,[pointer]
|
||||
mov cx,12
|
||||
cld
|
||||
rep cmpsb
|
||||
jne @@notthegood
|
||||
jne .notthegood
|
||||
cmp cx,0
|
||||
jne @@notthegood
|
||||
jne .notthegood
|
||||
mov cl,[si]
|
||||
inc si
|
||||
mov di,[@pointer]
|
||||
mov di,[pointer]
|
||||
cld
|
||||
rep movsb
|
||||
mov al,0
|
||||
stosb
|
||||
mov di,[@pointer]
|
||||
cmp [es:(cpu di).family],15
|
||||
jne @@notextended
|
||||
mov al,[es:(cpu di).efamily]
|
||||
mov ah,[es:(cpu di).emodels]
|
||||
mov di,[pointer]
|
||||
cmp [es:.cpu.family],15
|
||||
jne .notextended
|
||||
mov al,[es:.cpu.efamily]
|
||||
mov ah,[es:.cpu.emodels]
|
||||
mov di,[si+2]
|
||||
jmp @@searchmodel
|
||||
@@notextended:
|
||||
mov al,[es:(cpu di).family]
|
||||
mov ah,[es:(cpu di).models]
|
||||
jmp .searchmodel
|
||||
.notextended:
|
||||
mov al,[es:.cpu.family]
|
||||
mov ah,[es:.cpu.models]
|
||||
mov di,[si]
|
||||
@@searchmodel:
|
||||
.searchmodel:
|
||||
cmp [di],ax
|
||||
jne @@notgoodfamily
|
||||
jne .notgoodfamily
|
||||
mov si,di
|
||||
inc si
|
||||
inc si
|
||||
lea di,[es:cpu.names]
|
||||
add di,[@pointer]
|
||||
@@copystr:
|
||||
lea di,[es:.cpu.names]
|
||||
add di,[pointer]
|
||||
.copystr:
|
||||
mov al,[si]
|
||||
mov [es:di],al
|
||||
inc si
|
||||
inc di
|
||||
cmp al,0
|
||||
jne @@copystr
|
||||
jmp @@endofsearch
|
||||
@@notgoodfamily:
|
||||
jne .copystr
|
||||
jmp .endofsearch
|
||||
.notgoodfamily:
|
||||
inc di
|
||||
@@nextelement:
|
||||
.nextelement:
|
||||
inc di
|
||||
cmp [byte ptr di-1],0
|
||||
jne @@nextelement
|
||||
jmp @@searchmodel
|
||||
@@notthegood:
|
||||
cmp byte [di-1],0
|
||||
jne .nextelement
|
||||
jmp .searchmodel
|
||||
.notthegood:
|
||||
inc si
|
||||
cmp [word ptr si],0FFFFh
|
||||
jne @@notthegood
|
||||
cmp word [si],0FFFFh
|
||||
jne .notthegood
|
||||
inc si
|
||||
inc si
|
||||
cmp [word ptr si],0FFFFh
|
||||
je @@endofsearch
|
||||
jmp @@search
|
||||
@@endofsearch:
|
||||
ret
|
||||
@@nocpuidatall:
|
||||
ret
|
||||
cmp word [si],0FFFFh
|
||||
je .endofsearch
|
||||
jmp .search
|
||||
.endofsearch:
|
||||
retf
|
||||
.nocpuidatall:
|
||||
retf
|
||||
|
||||
;tableau avec vendeur taille + chainereelle + pointeur famille + pointeur famille etendue
|
||||
|
||||
@@marks db "GenuineIntel",5,"Intel"
|
||||
dw @@intelfamily,@@intelfamilye
|
||||
.marks db "GenuineIntel",5,"Intel"
|
||||
dw .intelfamily,.intelfamilye
|
||||
dw 0FFFFh
|
||||
|
||||
db "AuthenticAMD",3,"Amd"
|
||||
dw @@amdfamily,@@amdfamilye
|
||||
dw .amdfamily,.amdfamilye
|
||||
dw 0FFFFh
|
||||
|
||||
db "CyrixInstead",5,"Cyrix"
|
||||
dw @@cyrixfamily,@@cyrixfamilye
|
||||
dw .cyrixfamily,.cyrixfamilye
|
||||
dw 0FFFFh
|
||||
dw 0FFFFh
|
||||
|
||||
|
||||
;tableau avec famille modele et chaine 0
|
||||
|
||||
@@intelfamily:
|
||||
.intelfamily:
|
||||
db 4,0,"486 DX-25/33",0
|
||||
db 4,1,"486 DX-50",0
|
||||
db 4,2,"486 SX",0
|
||||
|
@ -690,7 +676,7 @@ db 6,11,"Pentium III (0.13
|
|||
db 7,0,"Itanium (IA-64)",0
|
||||
db 0FFh,0FFh,"Inconnu",0
|
||||
|
||||
@@intelfamilye:
|
||||
.intelfamilye:
|
||||
db 0,0,"Pentium IV (0.18 µm)",0
|
||||
db 0,1,"Pentium IV (0.18 µm)",0
|
||||
db 0,2,"Pentium IV (0.13 µm)",0
|
||||
|
@ -698,7 +684,7 @@ db 0,3,"Pentium IV (0.09
|
|||
db 1,0,"Itanium 2 (IA-64)",0
|
||||
db 0FFh,0FFh,"Inconnu",0
|
||||
|
||||
@@amdfamily:
|
||||
.amdfamily:
|
||||
db 4,3,"486 DX/2",0
|
||||
db 4,7,"486 DX/2-WB",0
|
||||
db 4,8,"486 DX/4",0
|
||||
|
@ -725,12 +711,12 @@ db 6,8,"Athlon (Thoroughbred)",0
|
|||
db 6,10,"Athlon (Barton)",0
|
||||
db 0FFh,0FFh,"Inconnu",0
|
||||
|
||||
@@amdfamilye:
|
||||
.amdfamilye:
|
||||
db 0,4,"Athlon 64",0
|
||||
db 0,5,"Athlon 64 FX/Opteron",0
|
||||
db 0FFh,0FFh,"Inconnu",0
|
||||
|
||||
@@cyrixfamily:
|
||||
.cyrixfamily:
|
||||
db 4,4,"MediaGX",0
|
||||
db 5,2,"6x86/6x86L",0
|
||||
db 5,4,"MediaGX MMX Enhanced",0
|
||||
|
@ -742,10 +728,10 @@ db 6,8,"WinChip C5N",0
|
|||
db 6,9,"WinChip C5XL/WinChip C5P",0
|
||||
db 0FFh,0FFh,"Inconnu",0
|
||||
|
||||
@@cyrixfamilye:
|
||||
.cyrixfamilye:
|
||||
db 0FFh,0FFh,"Inconnu",0
|
||||
|
||||
endp cpuinfo
|
||||
endp
|
||||
|
||||
;Test si CPUID est supporté oui=not Equal
|
||||
nocpuid:
|
||||
|
|
799
lib/video.asm
799
lib/video.asm
File diff suppressed because it is too large
Load Diff
|
@ -384,7 +384,3 @@ endp
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
1009
noyau/disque.asm
1009
noyau/disque.asm
File diff suppressed because it is too large
Load Diff
697
noyau/video.asm
697
noyau/video.asm
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue