From 20d5374674d9a2330816103433755b95de54c297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Fri, 19 Nov 2004 17:19:05 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20passage=20au=20format=20CE,=20offset=20a?= =?UTF-8?q?=200=20Ajout=20de=20la=20fonction=20MBSearchfunc=20qui=20recher?= =?UTF-8?q?che=20une=20fonction=20dans=20la=20m=C3=A9moire=20et=20MBLoadfu?= =?UTF-8?q?ncs=20qui=20permet=20de=20resoudre=20les=20dependance=20du=20fo?= =?UTF-8?q?rmat=20CE=20correction=20d'un=20bogue=20dans=20MBcreate=20lors?= =?UTF-8?q?=20de=20l'utilisation=20d'un=20bloc=20de=20meme=20taille=20que?= =?UTF-8?q?=20le=20libre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noyau/mcb.asm | 127 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 4 deletions(-) diff --git a/noyau/mcb.asm b/noyau/mcb.asm index aa586e1..8563682 100644 --- a/noyau/mcb.asm +++ b/noyau/mcb.asm @@ -3,13 +3,13 @@ smart .code -org 0100h +org 0h include ..\include\mem.h include ..\include\divers.h start: -maxfunc equ 10 +maxfunc equ 13 jmp tsr ;Saute à la routine résidente nameed db 'MB' ;Nom drivers @@ -64,9 +64,117 @@ tables dw MBinit ;Table qui contient les adresses de toutes les fonctions de VI dw MBAlloc dw MBclean dw MBfindsb + dw MBnonresident + dw MBSearchfunc + dw MBLoadfuncs + ;dw MBdefrag + ;dw MBcopy + ;dw MBchname FirstMB dw 0 +;Resouds les dépendances du bloc de mémoire GS +MBloadfuncs: + push ax bx ecx dx si di ds es gs + push gs + pop ds + cmp word ptr ds:[102h],"EC" + jne notloaded + mov si,ds:[100h+exe.import+2] +loadfuncs: + cmp word ptr [si],0 + je endofloading + call MBSearchfunc + jnc toendoftext + mov bx,si +findend2: + inc bx + cmp byte ptr [bx], ':' + jne findend2 + mov byte ptr [bx],0 + mov ah,17 + int 48h + jc notloaded + mov byte ptr [bx],':' + call MBSearchfunc + jc notloaded +toendoftext: + mov al,[si] + cmp al,0 + je oktonext2 + inc si + jmp toendoftext +oktonext2: + inc si + mov [si],dx + mov [si+2],gs + add si,4 + jmp loadfuncs +endofloading: + clc + pop gs es ds di si dx ecx bx ax + ret +notloaded: + stc + pop gs es ds di si dx ecx bx ax + ret + + + + + +;Recherche une fonction pointé par DS:SI en mémoire et renvoie son adresse en GS:DX +MBSearchfunc: + push bx si di + mov bx,si +findend: + inc bx + cmp byte ptr [bx], ':' + jne findend + mov byte ptr [bx],0 + call MBfind + mov byte ptr [bx],':' + jc notfoundattallthesb + cmp word ptr gs:[102h],"EC" + jne notfoundattallthesb + mov di,gs:[100h+exe.export+2] + inc bx + inc bx +functions: + cmp word ptr gs:[di],0 + je notfoundattallthesb + mov si,bx +cmpnamesfunc: + mov al,gs:[di] + cmp al,ds:[si] + jne notfoundthesb + cmp al,0 + je seemsok + inc si + inc di + jmp cmpnamesfunc +notfoundthesb: + mov al,gs:[di] + cmp al,0 + je oktonext + inc di + jmp notfoundthesb +oktonext: + inc di + inc di + inc di + jmp functions +seemsok: + mov dx,gs:[di+1] + clc + pop di si bx + ret +notfoundattallthesb: + stc + pop di si bx + ret + + ;Mise a nivo de la mémoire (jonction de blocs libre) MBclean: push ax bx dx es gs @@ -400,10 +508,10 @@ endofloops: inc bx inc bx sub ax,cx - dec ax - dec ax cmp ax,0 je nofree + dec ax + dec ax mov es:[MB.Sizes],cx add cx,bx mov es,cx @@ -442,4 +550,15 @@ MBresident: pop es bx ret +;Rend le segment GS résident +MBnonresident: + push bx es + mov bx,gs + dec bx + dec bx + mov es,bx + mov es:[MB.IsResident],False + pop es bx + ret + end start