Subversion Repositories Kolibri OS

Rev

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

Rev 5201 Rev 5565
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2012. 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: 5201 $
8
$Revision: 5565 $
Line 9... Line 9...
9
 
9
 
Line 487... Line 487...
487
        stosd
487
        stosd
488
        inc     eax
488
        inc     eax
489
        cmp     eax, ecx
489
        cmp     eax, ecx
490
        jbe     @B
490
        jbe     @B
Line 491... Line 491...
491
 
491
 
492
        mov     [edi-4096+PROC.ht_next], 1      ;reserve handle 0
492
        mov     [edi-4096+PROC.ht_next], 3      ;reserve handles for stdin stdout and stderr
493
        mov     eax, edi
493
        mov     eax, edi
494
        call    get_pg_addr
494
        call    get_pg_addr
Line 495... Line 495...
495
        mov     [edi-4096+PROC.pdt_0_phys], eax
495
        mov     [edi-4096+PROC.pdt_0_phys], eax
Line 501... Line 501...
501
        mov     ecx, (OS_BASE shr 20)/4
501
        mov     ecx, (OS_BASE shr 20)/4
502
        mov     esi, sys_proc+PROC.pdt_0+(OS_BASE shr 20)
502
        mov     esi, sys_proc+PROC.pdt_0+(OS_BASE shr 20)
503
        rep movsd
503
        rep movsd
Line 504... Line 504...
504
 
504
 
505
        mov     eax, [edi-8192+PROC.pdt_0_phys]
505
        mov     eax, [edi-8192+PROC.pdt_0_phys]
506
        or      eax, PG_SW
506
        or      eax, PG_SWR
Line 507... Line 507...
507
        mov     [edi-4096+(page_tabs shr 20)], eax
507
        mov     [edi-4096+(page_tabs shr 20)], eax
508
 
508
 
Line 509... Line 509...
509
        lea     eax, [edi-8192]
509
        lea     eax, [edi-8192]
510
        call    set_cr3
-
 
511
 
-
 
512
        mov     ecx, [app_tabs]
-
 
513
        test    ecx, ecx
510
        call    set_cr3
514
        jz      .done
511
 
515
 
512
        mov     edx, [app_tabs]
516
        xor     edi, edi
513
        xor     edi, edi
517
@@:
514
@@:
Line 518... Line 515...
518
        call    alloc_page
515
        call    alloc_page
519
        test    eax, eax
516
        test    eax, eax
-
 
517
        jz      .fail
520
        jz      .fail
518
 
Line 521... Line 519...
521
 
519
        stdcall map_page_table, edi, eax
Line 522... Line 520...
522
        stdcall map_page_table, edi, eax
520
        add     edi, 0x00400000
523
        add     edi, 0x00400000
521
        dec     edx
524
        loop    @B
522
        jnz     @B
525
 
523
 
Line 526... Line -...
526
        mov     edi, page_tabs
-
 
527
 
524
        mov     edi, page_tabs
528
        mov     ecx, [app_tabs]
525
 
529
        shl     ecx, 10
-
 
530
        xor     eax, eax
-
 
531
        rep stosd
-
 
532
 
526
        mov     ecx, [app_tabs]
533
        xor     edx, edx
527
        shl     ecx, 10
534
        mov     ecx, [img_pages]
528
        xor     eax, eax
535
        jcxz    .bss
529
        rep stosd
536
 
530
 
537
        sub     [app_pages], ecx
531
        mov     ecx, [img_pages]
538
 
532
        mov     ebx, PG_UWR
539
        mov     ebx, PG_UW
533
        xor     edx, edx
540
        mov     esi, [img_base]
534
        mov     esi, [img_base]
541
        shr     esi, 10
535
        shr     esi, 10
542
        add     esi, page_tabs
536
        add     esi, page_tabs
-
 
537
        mov     edi, page_tabs
-
 
538
.remap:
543
        mov     edi, page_tabs
539
        lodsd
544
.remap:
540
        and     eax, 0xFFFFF000
545
        lodsd
541
        or      eax, ebx; force user level r/w access
546
        and     eax, 0xFFFFF000
542
        stosd
547
        or      eax, ebx; force user level r/w access
543
        add     edx, 0x1000
Line 548... Line 544...
548
        stosd
544
        dec     [app_pages]
549
        add     edx, 0x1000
545
        dec     ecx
550
        loop    .remap
546
        jnz     .remap
551
.bss:
547
 
Line 552... Line 548...
552
        mov     ebx, [app_pages]
548
        mov     ecx, [app_pages]
553
        test    ebx, ebx
549
        test    ecx, ecx
554
        jz      .done
550
        jz      .done
555
 
551
 
Line 556... Line 552...
556
.map_bss:
552
.alloc:
557
        call    alloc_page
553
        call    alloc_page
558
        test    eax, eax
554
        test    eax, eax
559
        jz      .fail
555
        jz      .fail
Line 645... Line 641...
645
.destroy:
641
.destroy:
646
        mov     eax, [esi]
642
        mov     eax, [esi]
647
        test    eax, 1
643
        test    eax, 1
648
        jz      .next
644
        jz      .next
649
        and     eax, not 0xFFF
645
        and     eax, not 0xFFF
650
        stdcall map_page, [tmp_task_ptab], eax, PG_SW
646
        stdcall map_page, [tmp_task_ptab], eax, PG_SWR
651
        stdcall destroy_page_table, [tmp_task_ptab]
647
        stdcall destroy_page_table, [tmp_task_ptab]
652
        mov     eax, [esi]
648
        mov     eax, [esi]
653
        call    free_page
649
        call    free_page
654
.next:
650
.next:
655
        add     esi, 4
651
        add     esi, 4
Line 790... Line 786...
790
@@:
786
@@:
791
        mov     ebx, [offset]
787
        mov     ebx, [offset]
Line 792... Line 788...
792
 
788
 
793
        push    ecx
789
        push    ecx
794
        stdcall map_memEx, [proc_mem_map], \
790
        stdcall map_memEx, [proc_mem_map], \
795
                [slot], ebx, ecx, PG_MAP
791
                [slot], ebx, ecx, PG_READ
Line 796... Line 792...
796
        pop     ecx
792
        pop     ecx
797
 
793
 
798
        mov     esi, [offset]
794
        mov     esi, [offset]
Line 861... Line 857...
861
@@:
857
@@:
862
        mov     ebx, [offset]
858
        mov     ebx, [offset]
863
      ;     add ebx, new_app_base
859
      ;     add ebx, new_app_base
864
        push    ecx
860
        push    ecx
865
        stdcall map_memEx, [proc_mem_map], \
861
        stdcall map_memEx, [proc_mem_map], \
866
                [slot], ebx, ecx, PG_SW
862
                [slot], ebx, ecx, PG_SWR
867
        pop     ecx
863
        pop     ecx
Line 868... Line 864...
868
 
864
 
869
        mov     edi, [offset]
865
        mov     edi, [offset]
870
        and     edi, 0xfff
866
        and     edi, 0xfff
Line 1143... Line 1139...
1143
 
1139
 
1144
;set draw data to full screen
1140
;set draw data to full screen
1145
        xor     eax, eax
1141
        xor     eax, eax
1146
        mov     [ecx+0], dword eax
1142
        mov     [ecx+0], dword eax
1147
        mov     [ecx+4], dword eax
1143
        mov     [ecx+4], dword eax
1148
        mov     eax, [Screen_Max_X]
1144
        mov     eax, [screen_workarea.right]
1149
        mov     [ecx+8], eax
1145
        mov     [ecx+8], eax
1150
        mov     eax, [Screen_Max_Y]
1146
        mov     eax, [screen_workarea.bottom]
Line 1151... Line 1147...
1151
        mov     [ecx+12], eax
1147
        mov     [ecx+12], eax
1152
 
1148
 
1153
        mov     ebx, [pl0_stack]
1149
        mov     ebx, [pl0_stack]