feat: ajout d'un listing et compilation des outils fasm

This commit is contained in:
Nicolas Hordé 2019-07-28 14:56:41 +02:00
parent 06caf6f907
commit b4b858fa2f
6 changed files with 49 additions and 40 deletions

View File

@ -20,3 +20,6 @@ struc cpu
.apic db 0 .apic db 0
.sizeof = $ - .vendor .sizeof = $ - .vendor
} }
virtual at 0
cpu cpu
end virtual

View File

@ -18,6 +18,9 @@ struc pcidata
;bit 7: multi-function device ;bit 7: multi-function device
.result db 0 ;Built-In Self-Test result .result db 0 ;Built-In Self-Test result
} }
virtual at 0
pcidata pcidata
end virtual
struc pciinf struc pciinf
{ {

View File

@ -299,10 +299,7 @@ proc getcardinfo uses eax bx di, bus:word,device:word,function:word,pointer:word
mov di,[pointer] mov di,[pointer]
cmp [function],0 cmp [function],0
je .amultiorfirst je .amultiorfirst
virtual at 0 stdcall pcireadbyte,[bus],[device],0,pcidata.typed
.pcidata pcidata
end virtual
stdcall pcireadbyte,[bus],[device],0,.pcidata.typed
and al,multifunction and al,multifunction
cmp al,0 cmp al,0
jne .amultiorfirst jne .amultiorfirst
@ -424,10 +421,7 @@ endp
;retourne en DS:%1 les set supporté du processeur par rapport a la struct %0 ;retourne en DS:%1 les set supporté du processeur par rapport a la struct %0
proc setinfo uses bx si di, pointer:word,set:word proc setinfo uses bx si di, pointer:word,set:word
mov di,[set] mov di,[set]
virtual at 0 lea si,[ds:cpu.mmx]
.cpu cpu
end virtual
lea si,[ds:.cpu.mmx]
add si,[pointer] add si,[pointer]
mov bx,.theset mov bx,.theset
.set: .set:
@ -487,10 +481,7 @@ proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
pop es pop es
mov di,[pointer] mov di,[pointer]
mov al,0 mov al,0
virtual at 0 mov cx,cpu.sizeof
.cpu cpu
end virtual
mov cx,.cpu.sizeof
cld cld
rep stosb rep stosb
mov di,[pointer] mov di,[pointer]
@ -498,53 +489,53 @@ proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
je .nocpuidatall je .nocpuidatall
xor eax,eax xor eax,eax
cpuid ;Fonction 0 de CPUID cpuid ;Fonction 0 de CPUID
mov dword [.cpu.vendor],ebx ;Vendeur sur 13 octets mov dword [cpu.vendor],ebx ;Vendeur sur 13 octets
mov dword [.cpu.vendor+4],edx mov dword [cpu.vendor+4],edx
mov dword [.cpu.vendor+8],ecx mov dword [cpu.vendor+8],ecx
mov byte [.cpu.vendor+12],0 mov byte [cpu.vendor+12],0
cmp eax,1 cmp eax,1
jb .nofonc1 jb .nofonc1
mov eax,1 mov eax,1
cpuid ;Fonction 1 de CPUID cpuid ;Fonction 1 de CPUID
mov ebx,eax ;infos de model mov ebx,eax ;infos de model
and ebx,1111b and ebx,1111b
mov [.cpu.stepping],bl mov [cpu.stepping],bl
shr eax,4 shr eax,4
mov ebx,eax mov ebx,eax
and ebx,1111b and ebx,1111b
mov [.cpu.models],bl mov [cpu.models],bl
shr eax,4 shr eax,4
mov ebx,eax mov ebx,eax
and ebx,1111b and ebx,1111b
mov [.cpu.family],bl mov [cpu.family],bl
shr eax,4 shr eax,4
mov ebx,eax mov ebx,eax
and ebx,11b and ebx,11b
mov [.cpu.types],bl mov [cpu.types],bl
shr eax,2 shr eax,2
mov ebx,eax mov ebx,eax
and ebx,1111b and ebx,1111b
mov [.cpu.emodels],bl mov [cpu.emodels],bl
shr eax,4 shr eax,4
mov [.cpu.efamily],al mov [cpu.efamily],al
mov ebx,edx mov ebx,edx
and ebx,1 ;infos de jeu d'instruction and ebx,1 ;infos de jeu d'instruction
setnz [.cpu.fpu] setnz [cpu.fpu]
mov ebx,edx mov ebx,edx
and ebx,100000000000000000000000b and ebx,100000000000000000000000b
setnz [.cpu.mmx] setnz [cpu.mmx]
mov ebx,edx mov ebx,edx
and ebx,10000000000000000000000000b and ebx,10000000000000000000000000b
setnz [.cpu.sse] setnz [cpu.sse]
mov ebx,edx mov ebx,edx
and ebx,100000000000000000000000000b and ebx,100000000000000000000000000b
setnz [.cpu.sse2] setnz [cpu.sse2]
mov ebx,ecx mov ebx,ecx
and ebx,1b and ebx,1b
setnz [.cpu.sse3] setnz [cpu.sse3]
mov ebx,edx mov ebx,edx
and ebx,10000000000000000000000000000b and ebx,10000000000000000000000000000b
setnz [.cpu.htt] setnz [cpu.htt]
.nofonc1: .nofonc1:
mov eax,80000000h ;Fonction 80000000 de CPUID mov eax,80000000h ;Fonction 80000000 de CPUID
cpuid cpuid
@ -554,16 +545,16 @@ proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
cpuid cpuid
mov ebx,edx mov ebx,edx
and ebx,10000000000000000000000b and ebx,10000000000000000000000b
setnz [.cpu.mmx2] setnz [cpu.mmx2]
mov ebx,edx mov ebx,edx
and ebx,1000000000000000000000000000000b and ebx,1000000000000000000000000000000b
setnz [.cpu.now3d] setnz [cpu.now3d]
mov ebx,edx mov ebx,edx
and ebx,10000000000000000000000000000000b and ebx,10000000000000000000000000000000b
setnz [.cpu.now3d2] setnz [cpu.now3d2]
mov ebx,edx mov ebx,edx
and ebx,1000000000b and ebx,1000000000b
setnz [.cpu.apic] setnz [cpu.apic]
.nofonc8: .nofonc8:
mov si,.marks mov si,.marks
push cs push cs
@ -584,15 +575,15 @@ proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
mov al,0 mov al,0
stosb stosb
mov di,[pointer] mov di,[pointer]
cmp [es:.cpu.family],15 cmp [es:cpu.family],15
jne .notextended jne .notextended
mov al,[es:.cpu.efamily] mov al,[es:cpu.efamily]
mov ah,[es:.cpu.emodels] mov ah,[es:cpu.emodels]
mov di,[si+2] mov di,[si+2]
jmp .searchmodel jmp .searchmodel
.notextended: .notextended:
mov al,[es:.cpu.family] mov al,[es:cpu.family]
mov ah,[es:.cpu.models] mov ah,[es:cpu.models]
mov di,[si] mov di,[si]
.searchmodel: .searchmodel:
cmp [di],ax cmp [di],ax
@ -600,7 +591,7 @@ proc cpuinfo uses eax ebx ecx edx si di ds es, pointer:word
mov si,di mov si,di
inc si inc si
inc si inc si
lea di,[es:.cpu.names] lea di,[es:cpu.names]
add di,[pointer] add di,[pointer]
.copystr: .copystr:
mov al,[si] mov al,[si]

View File

@ -18,6 +18,14 @@ backup: clean
copy: copy:
make -C final make -C final
tools:
fasm /usr/share/fasm/tools/libc/listing.asm
fasm /usr/share/fasm/tools/libc/prepsrc.asm
fasm /usr/share/fasm/tools/libc/symbols.asm
gcc -m32 -static /usr/share/fasm/tools/libc/listing.o -o /usr/bin/listing
gcc -m32 -static /usr/share/fasm/tools/libc/prepsrc.o -o /usr/bin/prepsrc
gcc -m32 -static /usr/share/fasm/tools/libc/symbols.o -o /usr/bin/symbols
test: all copy qemu test: all copy qemu
retest: clean test retest: clean test

View File

@ -1,11 +1,13 @@
ASM=fasm ASM=fasm
CLEAN=rm -rf CLEAN=rm -rf
LISTING=listing
all: disque.sys video.sys systeme.sys all: disque.sys video.sys systeme.sys
sync sync
systeme.sys: systeme.asm systeme.sys: systeme.asm
$(ASM) $^ $@ $(ASM) $^ $@ -s systeme.fas
$(LISTING) systeme.fas systeme.txt
disque.sys: disque.asm disque.sys: disque.asm
$(ASM) $^ $@ $(ASM) $^ $@
@ -15,3 +17,5 @@ video.sys: video.asm
clean: clean:
$(CLEAN) *.sys $(CLEAN) *.sys
$(CLEAN) *.fas
$(CLEAN) *.txt

View File

@ -181,7 +181,7 @@ temporary db 256 dup (0)
makereturn db 0dh,0ah,0 makereturn db 0dh,0ah,0
msg_memory db "Initialisation de la memoire",0 msg_memory db "Initialisation de la memoire",0
msg_memory_init db " -Creation du bloc primordial",0 msg_memory_init db " -Creation du bloc primordial",0
msg_memory_section db " -Developpement des sections",0dh,0ah,0 msg_memory_section db " -Developpement des sections",0
msg_memory_jumps db "Redirection du systeme",0 msg_memory_jumps db "Redirection du systeme",0
msg_video_init db "Initialisation du pilote VIDEO",0 msg_video_init db "Initialisation du pilote VIDEO",0
msg_handler db "Initialisation du gestionnaire d'interruption",0 msg_handler db "Initialisation du gestionnaire d'interruption",0