Subversion Repositories Kolibri OS

Rev

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

Rev 520 Rev 536
Line 1... Line 1...
1
$Revision: 520 $
1
$Revision: 536 $
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
Line 611... Line 611...
611
           jz .exit
611
           jz .exit
Line 612... Line 612...
612
 
612
 
613
           mov eax, [pdir]
613
           mov eax, [pdir]
Line 614... Line 614...
614
           and eax, 0xFFFFF000
614
           and eax, 0xFFFFF000
615
 
615
 
616
           stdcall map_page,[ipc_pdir],eax,dword PG_UW
616
           stdcall map_page,[ipc_pdir],eax,PG_UW
617
           mov ebx, [ofs]
617
           mov ebx, [ofs]
618
           shr ebx, 22
618
           shr ebx, 22
619
           mov esi, [ipc_pdir]
619
           mov esi, [ipc_pdir]
620
           mov edi, [ipc_ptab]
620
           mov edi, [ipc_ptab]
621
           mov eax, [esi+ebx*4]
-
 
622
           and eax, 0xFFFFF000
621
           mov eax, [esi+ebx*4]
623
           test eax, eax
622
           and eax, 0xFFFFF000
624
           jz .exit
623
           jz .exit
625
           stdcall map_page,edi,eax,dword PG_UW
624
           stdcall map_page,edi,eax,PG_UW
626
;           inc ebx
625
;           inc ebx
627
;           add edi, 0x1000
626
;           add edi, 0x1000
628
;           mov eax, [esi+ebx*4]
627
;           mov eax, [esi+ebx*4]
Line 643... Line 642...
643
           and edx, 0x3FF
642
           and edx, 0x3FF
644
           mov esi, [ipc_ptab]
643
           mov esi, [ipc_ptab]
Line 645... Line 644...
645
 
644
 
646
.map:      mov eax, [esi+edx*4]
645
.map:      mov eax, [esi+edx*4]
647
           and eax, 0xFFFFF000
-
 
648
           test eax, eax
646
           and eax, 0xFFFFF000
649
           jz .exit
647
           jz  .exit
-
 
648
           stdcall map_page,edi,eax,PG_UW
-
 
649
           dec ecx
650
           stdcall map_page,edi,eax,dword PG_UW
650
           jz  .exit
651
           add edi, 0x1000
651
           add edi, 0x1000
652
           inc edx
652
           inc edx
653
           dec ecx
653
           cmp edx, 0x400
-
 
654
           jnz .map
-
 
655
           inc ebx
-
 
656
           mov eax, [ipc_pdir]
-
 
657
           mov eax, [eax+ebx*4]
-
 
658
           and eax, 0xFFFFF000
-
 
659
           jz  .exit
-
 
660
           stdcall map_page,esi,eax,PG_UW
-
 
661
           xor edx, edx
Line 654... Line 662...
654
           jnz .map
662
           jmp .map
655
 
663
 
656
.exit:
664
.exit:
Line 747... Line 755...
747
           and ecx, not 4095
755
           and ecx, not 4095
Line 748... Line 756...
748
 
756
 
749
.touch:    mov eax, [ebx]
757
.touch:    mov eax, [ebx]
750
           add ebx, 0x1000
758
           add ebx, 0x1000
751
           cmp ebx, ecx
759
           cmp ebx, ecx
Line 752... Line 760...
752
           jna .touch
760
           jb  .touch
753
 
761
 
754
           popf
762
           popf
755
           xor eax, eax
763
           xor eax, eax
Line 759... Line 767...
759
proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
767
proc sys_ipc_send stdcall, PID:dword, msg_addr:dword, msg_size:dword
760
           locals
768
           locals
761
             dst_slot   dd ?
769
             dst_slot   dd ?
762
             dst_offset dd ?
770
             dst_offset dd ?
763
             buf_size   dd ?
771
             buf_size   dd ?
-
 
772
             used_buf   dd ?
764
           endl
773
           endl
Line 765... Line 774...
765
 
774
 
766
           pushf
775
           pushf
Line 783... Line 792...
783
           mov [dst_offset], ebx
792
           mov [dst_offset], ebx
Line 784... Line 793...
784
 
793
 
785
           mov esi, [eax+SLOT_BASE+0xa4]
794
           mov esi, [eax+SLOT_BASE+0xa4]
Line -... Line 795...
-
 
795
           mov [buf_size], esi
-
 
796
 
-
 
797
           mov ecx, [ipc_tmp]
-
 
798
           cmp esi, 0x40000-0x1000 ; size of [ipc_tmp] minus one page
-
 
799
           jbe @f
-
 
800
           push eax esi edi
-
 
801
           add esi,0x1000
-
 
802
           stdcall alloc_kernel_space,esi
-
 
803
           mov ecx, eax
-
 
804
           pop edi esi eax
786
           mov [buf_size], esi
805
@@:
787
 
806
           mov [used_buf], ecx
Line 788... Line 807...
788
           stdcall map_mem, [ipc_tmp], [SLOT_BASE+eax+0xB8],\
807
           stdcall map_mem, ecx, [SLOT_BASE+eax+0xB8],\
789
                             edi, esi
808
                             edi, esi
790
 
809
 
791
           mov edi, [dst_offset]
810
           mov edi, [dst_offset]
Line 792... Line 811...
792
           add edi, [ipc_tmp]
811
           add edi, [used_buf]
793
           cmp dword [edi], 0
812
           cmp dword [edi], 0
Line 801... Line 820...
801
           ja .buffer_overflow         ;esi<0 - not enough memory in buffer
820
           ja .buffer_overflow         ;esi<0 - not enough memory in buffer
Line 802... Line 821...
802
 
821
 
803
           mov dword [edi+4], ebx
822
           mov dword [edi+4], ebx
804
           mov eax,[TASK_BASE]
823
           mov eax,[TASK_BASE]
805
           mov eax, [eax+0x04]         ;eax - our PID
-
 
806
           mov edi, [dst_offset]
-
 
807
           add edi, [ipc_tmp]
824
           mov eax, [eax+0x04]         ;eax - our PID
808
           add edi, edx
825
           add edi, edx
809
           mov [edi], eax
826
           mov [edi], eax
Line 810... Line 827...
810
           mov ecx, [msg_size]
827
           mov ecx, [msg_size]
Line 843... Line 860...
843
           cmp  dword [check_idle_semaphore],20
860
           cmp  dword [check_idle_semaphore],20
844
           jge  .ipc_no_cis
861
           jge  .ipc_no_cis
Line 845... Line 862...
845
 
862
 
846
           mov  dword [check_idle_semaphore],5
863
           mov  dword [check_idle_semaphore],5
847
.ipc_no_cis:
864
.ipc_no_cis:
848
           popf
-
 
849
           xor eax, eax
865
           push 0
850
           ret
866
           jmp .ret
851
.no_pid:
867
.no_pid:
852
           popf
868
           popf
853
           mov  eax, 4
869
           mov eax, 4
854
           ret
870
           ret
855
.no_ipc_area:
871
.no_ipc_area:
856
           popf
872
           popf
857
           xor eax, eax
873
           xor eax, eax
858
           inc eax
874
           inc eax
859
           ret
875
           ret
860
.ipc_blocked:
876
.ipc_blocked:
861
           popf
-
 
862
           mov  eax, 2
877
           push 2
863
           ret
878
           jmp .ret
-
 
879
.buffer_overflow:
-
 
880
           push 3
-
 
881
.ret:
-
 
882
           mov eax, [used_buf]
-
 
883
           cmp eax, [ipc_tmp]
-
 
884
           jz @f
-
 
885
           stdcall free_kernel_space,eax
-
 
886
@@:
864
.buffer_overflow:
887
           pop eax
865
           popf
-
 
866
           mov  eax, 3
888
           popf
867
           ret
889
           ret
Line 868... Line 890...
868
endp
890
endp
869
 
891