Subversion Repositories Kolibri OS

Rev

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

Rev 420 Rev 427
Line 301... Line 301...
301
           add edi,4095
301
           add edi,4095
302
           and edi,not 4095
302
           and edi,not 4095
303
           mov [new_size], edi
303
           mov [new_size], edi
304
 
304
 
Line 305... Line 305...
305
           mov edx,[CURRENT_TASK]
305
           mov edx,[current_slot]
306
           shl edx,8
-
 
307
           cmp [SLOT_BASE+APPDATA.heap_base+edx],0
306
           cmp [edx+APPDATA.heap_base],0
308
           jne .exit
307
           jne .exit
Line 309... Line 308...
309
 
308
 
310
           mov esi, [SLOT_BASE+APPDATA.mem_size+edx]
309
           mov esi, [edx+APPDATA.mem_size]
311
           add esi, 4095
310
           add esi, 4095
Line 312... Line 311...
312
           and esi, not 4095
311
           and esi, not 4095
313
 
312
 
Line 336... Line 335...
336
 
335
 
Line 337... Line 336...
337
           xor eax, eax
336
           xor eax, eax
338
           dec [pg_data.pg_mutex]
337
           dec [pg_data.pg_mutex]
339
           ret
338
           ret
340
 
-
 
341
.expand:
339
.expand:
342
         ;  add edi, new_app_base
-
 
343
         ;  add esi, new_app_base
-
 
Line 344... Line 340...
344
 
340
 
345
           push esi
341
           push esi
Line 346... Line 342...
346
           push edi
342
           push edi
Line 403... Line 399...
403
           ret
399
           ret
404
endp
400
endp
405
 
401
 
Line 406... Line 402...
406
update_mem_size:
402
update_mem_size:
407
; in: edx = slot shl 8
403
; in: edx = slot base
408
;     ebx = new memory size
404
;     ebx = new memory size
409
; destroys eax,ecx,edx
405
; destroys eax,ecx,edx
Line 410... Line 406...
410
 
406
 
411
           mov    [SLOT_BASE+APPDATA.mem_size+edx],ebx
407
           mov    [APPDATA.mem_size+edx],ebx
412
;search threads and update
408
;search threads and update
413
;application memory size infomation
409
;application memory size infomation
414
           mov    ecx,[SLOT_BASE+APPDATA.dir_table+edx]
410
           mov    ecx,[APPDATA.dir_table+edx]
Line 415... Line 411...
415
           mov    eax,2
411
           mov    eax,2
416
 
412
 
417
.search_threads:
413
.search_threads:
Line 454... Line 450...
454
        .err_code equ ebp+32
450
        .err_code equ ebp+32
455
        .err_addr equ ebp-4
451
        .err_addr equ ebp-4
Line 456... Line 452...
456
 
452
 
457
           pushad
-
 
458
 
-
 
459
;     push eax
-
 
460
;     push edx
-
 
461
;     mov edx, 0x400   ;bocsh
-
 
462
;     mov al,0xff      ;bocsh
-
 
463
;     out dx, al       ;bocsh
-
 
464
;     pop edx
-
 
465
;     pop eax
-
 
466
 
453
           pushad
467
           mov ebp, esp
454
           mov ebp, esp
468
           mov eax, cr2
455
           mov eax, cr2
469
           push eax
-
 
470
           push ds
-
 
Line 471... Line 456...
471
           push es
456
           push eax
472
 
457
 
473
           mov ax, 0x10
458
           mov ax, app_data
Line 474... Line 459...
474
           mov ds, ax
459
           mov ds, ax
Line -... Line 460...
-
 
460
           mov es, ax
-
 
461
 
-
 
462
           inc [pg_data.pages_faults]
-
 
463
 
-
 
464
     push eax
-
 
465
     push edx
-
 
466
     mov edx, 0x400   ;bochs
-
 
467
     mov al,0xff      ;bochs
475
           mov es, ax
468
     out dx, al       ;bochs
476
 
469
     pop edx
Line 477... Line 470...
477
           inc [pg_data.pages_faults]
470
     pop eax
478
 
471
 
Line 479... Line 472...
479
           mov ebx, [.err_addr]
472
           mov ebx, [.err_addr]
480
           mov eax, [.err_code]
473
           mov eax, [.err_code]
Line 481... Line 474...
481
 
474
 
482
           cmp ebx, OS_BASE
475
           cmp ebx, OS_BASE
483
           jb .user_space      ;ñòðàíèöà â ïàìÿòè ïðèëîæåíè
476
           jb .user_space      ;ñòðàíèöà â ïàìÿòè ïðèëîæåíèÿ ;
Line 484... Line 477...
484
 
477
 
485
           cmp ebx, page_tabs
478
           cmp ebx, page_tabs
486
           jb .kernel_space    ;ñòðàíèöà â ïàìÿòè ÿäðà
479
           jb .kernel_space    ;ñòðàíèöà â ïàìÿòè ÿäðà
Line 512... Line 505...
512
                               ;íåâåðíûé àäðåñ â ïðîãðàììå
505
                               ;íåâåðíûé àäðåñ â ïðîãðàììå
513
 
506
 
Line 514... Line 507...
514
           mov eax, [page_tabs+ebx*4]
507
           mov eax, [page_tabs+ebx*4]
515
           test eax, 2
508
           test eax, 2
516
           jz .fail            ;àäðåñ íå çàðåçåðâèðîâàí äë
509
           jz .fail            ;àäðåñ íå çàðåçåðâèðîâàí äëÿ ;
517
                               ;èñïîëüçîâàíèÿ. Îøèáêà
510
                               ;èñïîëüçîâàíèÿ. Îøèáêà
518
.alloc:
511
.alloc:
519
           call alloc_page
512
           call alloc_page
520
           and eax, eax
513
           and eax, eax
521
           jz .fail
514
           jz .fail
Line 528... Line 521...
528
           xor eax, eax
521
           xor eax, eax
529
           cld
522
           cld
530
           rep stosd
523
           rep stosd
531
.exit:
524
.exit:
532
           pop es
525
           mov esp, ebp
533
           pop ds
-
 
534
           mov esp, ebp
-
 
535
           popad
526
           popad
536
           add esp, 4
527
           add esp, 4
537
           iretd
528
           iretd
538
 
529
 
Line 555... Line 546...
555
;íå îáðàáàòûâàåì. Îøèáêà
546
;íå îáðàáàòûâàåì. Îøèáêà
556
 
547
 
Line 557... Line 548...
557
.core_tabs:
548
.core_tabs:
558
.fail:
549
.fail:
559
           pop es
-
 
560
           pop ds
-
 
561
           mov esp, ebp
550
           mov esp, ebp
562
           popad
551
           popad
563
           add esp, 4
552
           add esp, 4
564
           iretd
553
           iretd
Line 727... Line 716...
727
 
716
 
Line 728... Line 717...
728
align 4
717
align 4
729
proc set_ipc_buff
718
proc set_ipc_buff
Line 730... Line 719...
730
 
719
 
731
           mov  eax,[CURRENT_TASK]
-
 
732
           shl  eax,8
-
 
733
           add  eax, SLOT_BASE
720
           mov  eax,[current_slot]
734
           pushf
721
           pushf
735
           cli
722
           cli
736
           mov  [eax+0xA0],ebx     ;set fields in extended information area
723
           mov  [eax+APPDATA.ipc_start],ebx     ;set fields in extended information area
Line 737... Line -...
737
           mov  [eax+0xA4],ecx
-
 
738
 
724
           mov  [eax+APPDATA.ipc_size],ecx
739
        ;   add ebx,  new_app_base
725
 
740
           add ecx, ebx
726
           add ecx, ebx
Line 741... Line 727...
741
           add ecx, 4095
727
           add ecx, 4095
Line 912... Line 898...
912
           ret
898
           ret
913
@@:
899
@@:
914
           cmp eax, 13
900
           cmp eax, 13
915
           ja @f
901
           ja @f
916
       ;    add ebx, new_app_base
902
           stdcall user_free, ebx
917
           stdcall user_free, ebx
-
 
918
           mov [esp+36], eax
903
           mov [esp+36], eax
919
           ret
904
           ret
920
@@:
905
@@:
921
           cmp eax, 14
906
           cmp eax, 14
922
           ja @f
907
           ja @f
923
      ;     add ebx, new_app_base
908
           cmp ebx, OS_BASE
924
           cmp ebx, OS_BASE
-
 
925
           jae .fail
909
           jae .fail
926
           stdcall get_event_ex, ebx, ecx
910
           stdcall get_event_ex, ebx, ecx
927
           mov [esp+36], eax
911
           mov [esp+36], eax
928
           ret
912
           ret
929
@@:
913
@@:
930
           cmp eax, 15
914
           cmp eax, 15
931
           ja @f
915
           ja @f
932
           mov ecx, [CURRENT_TASK]
916
           mov ecx, [current_slot]
933
           shl ecx, 8
917
           mov eax, [ecx+APPDATA.fpu_handler]
934
           mov eax, [ecx+SLOT_BASE+APPDATA.fpu_handler]
-
 
935
           mov [ecx+SLOT_BASE+APPDATA.fpu_handler], ebx
918
           mov [ecx+APPDATA.fpu_handler], ebx
936
           mov [esp+36], eax
919
           mov [esp+36], eax
937
           ret
920
           ret
938
@@:
921
@@:
939
           cmp eax, 16
922
           cmp eax, 16
940
           ja @f
923
           ja @f
941
 
924
 
Line 942... Line 925...
942
           test ebx, ebx
925
           test ebx, ebx
943
           jz .fail
926
           jz .fail
944
     ;      add ebx, new_app_base
-
 
945
           cmp ebx, OS_BASE
927
           cmp ebx, OS_BASE
946
           jae .fail
928
           jae .fail
947
           stdcall get_service, ebx
929
           stdcall get_service, ebx
948
           mov [esp+36], eax
930
           mov [esp+36], eax
949
           ret
931
           ret
Line 955... Line 937...
955
           ret
937
           ret
956
@@:
938
@@:
957
           cmp eax, 18
939
           cmp eax, 18
958
           ja @f
940
           ja @f
959
           mov ecx, [CURRENT_TASK]
941
           mov ecx, [current_slot]
960
           shl ecx, 8
942
           mov eax, [ecx+APPDATA.sse_handler]
961
           mov eax, [ecx+SLOT_BASE+APPDATA.sse_handler]
-
 
962
           mov [ecx+SLOT_BASE+APPDATA.sse_handler], ebx
943
           mov [ecx+APPDATA.sse_handler], ebx
963
           mov [esp+36], eax
944
           mov [esp+36], eax
964
           ret
945
           ret
965
@@:
946
@@:
966
           cmp eax, 19
947
           cmp eax, 19
967
           ja .fail
948
           ja .fail
968
      ;     add ebx, new_app_base
949
      ;     add ebx, new_app_base