Subversion Repositories Kolibri OS

Rev

Rev 5116 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5116 Rev 5121
Line 831... Line 831...
831
        shr     edx, 12
831
        shr     edx, 12
832
        and     edx, 0x3FF
832
        and     edx, 0x3FF
833
.map:
833
.map:
834
        stdcall safe_map_page, [slot], [req_access], [ofs]
834
        stdcall safe_map_page, [slot], [req_access], [ofs]
835
        jnc     .exit
835
        jnc     .exit
836
        add     dword [ebp-4], PAGE_SIZE
836
        add     [count], PAGE_SIZE
837
        add     [ofs], PAGE_SIZE
837
        add     [ofs], PAGE_SIZE
838
        dec     ecx
838
        dec     ecx
839
        jz      .exit
839
        jz      .exit
Line 840... Line 840...
840
 
840
 
Line 850... Line 850...
850
        jz      .exit
850
        jz      .exit
Line 851... Line 851...
851
 
851
 
852
        stdcall map_page, esi, eax, PG_SW
852
        stdcall map_page, esi, eax, PG_SW
853
        xor     edx, edx
853
        xor     edx, edx
854
        jmp     .map
-
 
855
 
854
        jmp     .map
856
.exit:
855
.exit:
857
        pop     eax
856
        mov     eax, [count]
858
        ret
857
        ret
Line 859... Line 858...
859
endp
858
endp
860
 
859
 
-
 
860
proc map_memEx stdcall, lin_addr:dword,slot:dword,\
861
proc map_memEx stdcall, lin_addr:dword,slot:dword,\
861
                        ofs:dword,buf_size:dword,req_access:dword
-
 
862
        locals
-
 
863
             count   dd ?
Line -... Line 864...
-
 
864
             process dd ?
862
                        ofs:dword,buf_size:dword,req_access:dword
865
        endl
863
        push    0 ; initialize number of mapped bytes
866
 
Line 864... Line 867...
864
 
867
        mov     [count], 0
865
        cmp     [buf_size], 0
868
        cmp     [buf_size], 0
866
        jz      .exit
869
        jz      .exit
867
 
870
 
868
        mov     eax, [slot]
871
        mov     eax, [slot]
Line 869... Line 872...
869
        shl     eax, 8
872
        shl     eax, 8
870
        mov     eax, [SLOT_BASE+eax+APPDATA.process]
873
        mov     eax, [SLOT_BASE+eax+APPDATA.process]
871
        mov     eax, [eax+PROC.pdt_0_phys]
874
        test    eax, eax
872
        and     eax, 0xFFFFF000
875
        jz      .exit
873
 
876
 
874
        stdcall map_page, [proc_mem_pdir], eax, PG_UW
-
 
875
        mov     ebx, [ofs]
877
        mov     [process], eax
876
        shr     ebx, 22
-
 
877
        mov     esi, [proc_mem_pdir]
878
        mov     ebx, [ofs]
878
        mov     edi, [proc_mem_tab]
879
        shr     ebx, 22
879
        mov     eax, [esi+ebx*4]
-
 
880
        and     eax, 0xFFFFF000
880
        mov     eax, [eax+PROC.pdt_0+ebx*4]                 ;get page table
881
        test    eax, eax
881
        mov     esi, [proc_mem_tab]
882
        jz      .exit
882
        and     eax, 0xFFFFF000
883
        stdcall map_page, edi, eax, PG_UW
883
        jz      .exit
884
 
884
        stdcall map_page, esi, eax, PG_SW
885
@@:
885
@@:
886
        mov     edi, [lin_addr]
886
        mov     edi, [lin_addr]
Line 887... Line 887...
887
        and     edi, 0xFFFFF000
887
        and     edi, 0xFFFFF000
888
        mov     ecx, [buf_size]
888
        mov     ecx, [buf_size]
889
        add     ecx, 4095
889
        add     ecx, 4095
890
        shr     ecx, 12
-
 
891
        inc     ecx
-
 
892
 
890
        shr     ecx, 12
893
        mov     edx, [ofs]
891
        inc     ecx                  ; ???????????
894
        shr     edx, 12
892
 
895
        and     edx, 0x3FF
-
 
896
        mov     esi, [proc_mem_tab]
893
        mov     edx, [ofs]
897
 
894
        shr     edx, 12
898
.map:
-
 
899
        stdcall safe_map_page, [slot], [req_access], [ofs]
895
        and     edx, 0x3FF
-
 
896
.map:
-
 
897
        stdcall safe_map_page, [slot], [req_access], [ofs]
-
 
898
        jnc     .exit
-
 
899
        add     [count], PAGE_SIZE
-
 
900
        add     [ofs], PAGE_SIZE
900
        jnc     .exit
901
        dec     ecx
-
 
902
        jz      .exit
-
 
903
 
-
 
904
        add     edi, PAGE_SIZE
-
 
905
        inc     edx
-
 
906
        cmp     edx, 1024
-
 
907
        jnz     .map
-
 
908
 
-
 
909
        inc     ebx
-
 
910
        mov     eax, [process]
-
 
911
        mov     eax, [eax+PROC.pdt_0+ebx*4]
901
        add     dword [ebp-4], 0x1000
912
        and     eax, 0xFFFFF000
902
        add     edi, 0x1000
913
        jz      .exit
903
        add     [ofs], 0x1000
914
 
904
        inc     edx
915
        stdcall map_page, esi, eax, PG_SW
Line 905... Line 916...
905
        dec     ecx
916
        xor     edx, edx
906
        jnz     .map
917
        jmp     .map