Subversion Repositories Kolibri OS

Rev

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

Rev 9832 Rev 9900
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;;
4
;;  Distributed under terms of the GNU General Public License.  ;;
4
;;  Distributed under terms of the GNU General Public License.  ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 9832 $
8
$Revision: 9900 $
Line 9... Line 9...
9
 
9
 
Line 370... Line 370...
370
        cmp     eax, ecx
370
        cmp     eax, ecx
371
        jbe     @B
371
        jbe     @B
Line 372... Line 372...
372
 
372
 
373
        mov     eax, edi
373
        mov     eax, edi
374
        call    get_pg_addr
374
        call    get_pg_addr
Line 375... Line 375...
375
        mov     [edi - 4096 + PROC.pdt_0_phys], eax
375
        mov     [edi - PAGE_SIZE + PROC.pdt_0_phys], eax
376
 
376
 
377
        mov     ecx, (OS_BASE shr 20)/4
377
        mov     ecx, (OS_BASE shr 20)/4
Line 382... Line 382...
382
        mov     esi, sys_proc + PROC.pdt_0 + (OS_BASE shr 20)
382
        mov     esi, sys_proc + PROC.pdt_0 + (OS_BASE shr 20)
383
        rep movsd
383
        rep movsd
Line 384... Line 384...
384
 
384
 
385
        mov     eax, [edi - 8192 + PROC.pdt_0_phys]
385
        mov     eax, [edi - 8192 + PROC.pdt_0_phys]
386
        or      eax, PG_SWR
386
        or      eax, PG_SWR
Line 387... Line 387...
387
        mov     [edi - 4096 + (page_tabs shr 20)], eax
387
        mov     [edi - PAGE_SIZE + (page_tabs shr 20)], eax
388
 
388
 
Line 389... Line 389...
389
        lea     edx, [edi-4096]
389
        lea     edx, [edi - PAGE_SIZE]
390
        mov     esi, [app_tabs]
390
        mov     esi, [app_tabs]
391
 
391
 
Line 472... Line 472...
472
        mov     edi, (0x80000000 shr 20)/4
472
        mov     edi, (0x80000000 shr 20)/4
473
.destroy:
473
.destroy:
474
        mov     eax, [esi]
474
        mov     eax, [esi]
475
        test    eax, 1
475
        test    eax, 1
476
        jz      .next
476
        jz      .next
477
        and     eax, not 0xFFF
477
        and     eax, -PAGE_SIZE
478
        stdcall map_page, [tmp_task_ptab], eax, PG_SWR
478
        stdcall map_page, [tmp_task_ptab], eax, PG_SWR
479
        stdcall destroy_page_table, [tmp_task_ptab]
479
        stdcall destroy_page_table, [tmp_task_ptab]
480
        mov     eax, [esi]
480
        mov     eax, [esi]
481
        call    free_page
481
        call    free_page
482
.next:
482
.next:
Line 728... Line 728...
728
        mov     eax, [ebx + APPDATA.tls_base]
728
        mov     eax, [ebx + APPDATA.tls_base]
729
        test    eax, eax
729
        test    eax, eax
730
        jz      @F
730
        jz      @F
Line 731... Line 731...
731
 
731
 
732
        push    edx
732
        push    edx
733
        stdcall user_alloc, 4096
733
        stdcall user_alloc, PAGE_SIZE
734
        pop     edx
734
        pop     edx
735
        test    eax, eax
735
        test    eax, eax
736
        jz      .failed1;eax=0
736
        jz      .failed1;eax=0
737
@@:
737
@@:
Line 761... Line 761...
761
proc map_process_image stdcall, img_size:dword, file_base:dword, file_size:dword
761
proc map_process_image stdcall, img_size:dword, file_base:dword, file_size:dword
Line 762... Line 762...
762
 
762
 
763
        mov     edx, [img_size]
763
        mov     edx, [img_size]
764
        mov     esi, [file_base]
764
        mov     esi, [file_base]
765
        mov     ecx, [file_size]
765
        mov     ecx, [file_size]
766
        add     edx, 4095
766
        add     edx, PAGE_SIZE-1
767
        add     ecx, 4095
767
        add     ecx, PAGE_SIZE-1
768
        shr     edx, 12        ; total pages
768
        shr     edx, 12        ; total pages
Line 769... Line 769...
769
        shr     ecx, 12        ; image pages
769
        shr     ecx, 12        ; image pages
770
 
770
 
771
        mov     edi, page_tabs
771
        mov     edi, page_tabs
Line 772... Line 772...
772
        shr     esi, 10
772
        shr     esi, 10
773
        add     esi, edi
773
        add     esi, edi
774
 
774
 
775
.map_image:
775
.map_image:
776
        lodsd
776
        lodsd
777
        and     eax, -4096
777
        and     eax, -PAGE_SIZE
778
        or      eax, PG_UWR
778
        or      eax, PG_UWR
Line 792... Line 792...
792
        dec     edx
792
        dec     edx
793
        jnz     .map_bss
793
        jnz     .map_bss
Line 794... Line 794...
794
 
794
 
795
        mov     edi, [file_size]
795
        mov     edi, [file_size]
796
        mov     ecx, [img_size]
796
        mov     ecx, [img_size]
797
        add     edi, 4095
797
        add     edi, PAGE_SIZE-1
798
        and     edi, -4096
798
        and     edi, -PAGE_SIZE
799
        add     ecx, 4095
799
        add     ecx, PAGE_SIZE-1
800
        and     ecx, -4096
800
        and     ecx, -PAGE_SIZE
801
        sub     ecx, edi
801
        sub     ecx, edi
802
        shr     ecx, 2
802
        shr     ecx, 2
803
        xor     eax, eax
803
        xor     eax, eax
804
        rep stosd
804
        rep stosd
Line 841... Line 841...
841
        lea     esi, [ebp + sizeof.APP_HDR]
841
        lea     esi, [ebp + sizeof.APP_HDR]
842
        mov     ecx, [ebp + APP_HDR.cmdline_size]
842
        mov     ecx, [ebp + APP_HDR.cmdline_size]
843
        cmp     ecx, 256
843
        cmp     ecx, 256
844
        jb      .copy_cmdline
844
        jb      .copy_cmdline
845
        mov     edi, [ebp + APP_HDR._emem]
845
        mov     edi, [ebp + APP_HDR._emem]
846
        add     edi, 4095
846
        add     edi, PAGE_SIZE-1
847
        and     edi, -4096
847
        and     edi, -PAGE_SIZE
848
        sub     edi, ecx
848
        sub     edi, ecx
849
        dec     edi
849
        dec     edi
850
        cmp     word [6], '00'
850
        cmp     word [6], '00'
851
        jne     @f
851
        jne     @f
852
        mov     [APP_HEADER_00_.i_param], edi
852
        mov     [APP_HEADER_00_.i_param], edi
Line 862... Line 862...
862
        mov     byte [edi], 0
862
        mov     byte [edi], 0
863
.check_tls_header:
863
.check_tls_header:
864
        cmp     word [6], '02'
864
        cmp     word [6], '02'
865
        jne     .try_load_dll ;.cleanup
865
        jne     .try_load_dll ;.cleanup
866
        call    init_heap
866
        call    init_heap
867
        stdcall user_alloc, 4096
867
        stdcall user_alloc, PAGE_SIZE
868
        mov     edx, [current_slot]
868
        mov     edx, [current_slot]
869
        mov     [edx + APPDATA.tls_base], eax
869
        mov     [edx + APPDATA.tls_base], eax
870
        mov     [tls_data_l+2], ax
870
        mov     [tls_data_l+2], ax
871
        shr     eax, 16
871
        shr     eax, 16
872
        mov     [tls_data_l+4], al
872
        mov     [tls_data_l+4], al