Rev 6078 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6078 | Rev 6339 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2015. 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: 6078 $ |
8 | $Revision: 6339 $ |
9 | 9 | ||
Line 592... | Line 592... | ||
592 | mov [um_file], eax |
592 | mov [um_file], eax |
593 | test eax, eax |
593 | test eax, eax |
594 | jz .err_2 |
594 | jz .err_2 |
Line 595... | Line 595... | ||
595 | 595 | ||
596 | mov edx, [file_size] ;preallocate page memory |
596 | mov edx, [file_size] ;preallocate page memory |
597 | shr eax, 10 |
597 | shr eax, 9 |
598 | lea edi, [page_tabs+eax] |
598 | lea edi, [page_tabs+eax] |
599 | add edx, 4095 |
599 | add edx, 4095 |
600 | shr edx, 12 |
600 | shr edx, 12 |
601 | @@: |
601 | @@: |
602 | call alloc_page |
602 | call alloc_page |
603 | test eax, eax |
603 | test eax, eax |
Line 604... | Line 604... | ||
604 | jz .err_3 |
604 | jz .err_3 |
605 | 605 | ||
- | 606 | or eax, PG_UWR |
|
- | 607 | stosd |
|
606 | or eax, PG_UWR |
608 | xor eax, eax |
607 | stosd |
609 | stosd |
Line 608... | Line 610... | ||
608 | dec edx |
610 | dec edx |
609 | jnz @B |
611 | jnz @B |
Line 647... | Line 649... | ||
647 | mov [um_file], eax |
649 | mov [um_file], eax |
Line 648... | Line 650... | ||
648 | 650 | ||
649 | test eax, eax |
651 | test eax, eax |
Line 650... | Line 652... | ||
650 | jz .err_2 |
652 | jz .err_2 |
Line 651... | Line 653... | ||
651 | 653 | ||
652 | shr eax, 10 ; and remap pages. |
654 | shr eax, 9 ; and remap pages. |
653 | 655 | ||
Line 654... | Line 656... | ||
654 | mov ecx, [file_size] |
656 | mov ecx, [file_size] |
655 | add ecx, 4095 |
657 | add ecx, 4095 |
656 | shr ecx, 12 |
658 | shr ecx, 12 |
Line 657... | Line 659... | ||
657 | 659 | ||
Line 658... | Line 660... | ||
658 | mov esi, [km_file] |
660 | mov esi, [km_file] |
659 | shr esi, 10 |
661 | shr esi, 9 |
660 | add esi, page_tabs |
662 | add esi, page_tabs |
661 | 663 | ||
662 | lea edi, [page_tabs+eax] |
664 | lea edi, [page_tabs+eax] |
663 | 665 | ||
- | 666 | cld |
|
- | 667 | @@: |
|
664 | cld |
668 | lodsd |
Line 665... | Line 669... | ||
665 | @@: |
669 | and eax, 0xFFFFF000 |
666 | lodsd |
670 | or eax, PG_UWR |
667 | and eax, 0xFFFFF000 |
671 | stosd |
Line 1220... | Line 1224... | ||
1220 | mov [eax+HDLL.size], edi |
1224 | mov [eax+HDLL.size], edi |
1221 | mov [eax+HDLL.refcount], 1 |
1225 | mov [eax+HDLL.refcount], 1 |
1222 | mov [eax+HDLL.parent], esi |
1226 | mov [eax+HDLL.parent], esi |
1223 | mov edx, ebx |
1227 | mov edx, ebx |
1224 | shr edx, 12 |
1228 | shr edx, 12 |
1225 | or dword [page_tabs+(edx-1)*4], DONT_FREE_BLOCK |
1229 | or dword [page_tabs+(edx-1)*8], DONT_FREE_BLOCK |
1226 | ; copy entries of page table from kernel-side image to usermode |
1230 | ; copy entries of page table from kernel-side image to usermode |
1227 | ; use copy-on-write for user-mode image, so map as readonly |
1231 | ; use copy-on-write for user-mode image, so map as readonly |
1228 | xor edi, edi |
1232 | xor edi, edi |
1229 | mov ecx, [esi+DLLDESCR.data] |
1233 | mov ecx, [esi+DLLDESCR.data] |
1230 | shr ecx, 12 |
1234 | shr ecx, 12 |
1231 | .map_pages_loop: |
1235 | .map_pages_loop: |
1232 | mov eax, [page_tabs+ecx*4] |
1236 | mov eax, [page_tabs+ecx*8] |
1233 | and eax, not 0xFFF |
1237 | and eax, not 0xFFF |
1234 | or al, PG_UR |
1238 | or al, PG_UR |
1235 | xchg eax, [page_tabs+edx*4] |
1239 | xchg eax, [page_tabs+edx*8] |
1236 | test al, 1 |
1240 | test al, 1 |
1237 | jz @f |
1241 | jz @f |
1238 | call free_page |
1242 | call free_page |
1239 | @@: |
1243 | @@: |
1240 | invlpg [ebx+edi] |
1244 | invlpg [ebx+edi] |