Rev 6319 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6319 | Rev 6332 | ||
---|---|---|---|
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: 6319 $ |
8 | $Revision: 6332 $ |
Line 9... | Line 9... | ||
9 | 9 | ||
Line 48... | Line 48... | ||
48 | xor eax, eax |
48 | xor eax, eax |
49 | cld |
49 | cld |
50 | rep stosd |
50 | rep stosd |
51 | } |
51 | } |
Line -... | Line 52... | ||
- | 52 | ||
52 | 53 | align 4 |
|
53 | _strlen: |
54 | _strnlen: |
54 | mov ecx, 0xFFFFFFFF |
55 | mov edx, ecx |
55 | xor eax, eax |
56 | xor eax, eax |
- | 57 | repne scasb |
|
- | 58 | jne @F |
|
- | 59 | inc ecx |
|
56 | repne scasb |
60 | @@: |
57 | mov eax, 0xFFFFFFFE |
61 | mov eax, edx |
58 | sub eax, ecx |
62 | sub eax, ecx |
Line 59... | Line 63... | ||
59 | retn |
63 | retn |
60 | 64 | ||
Line 154... | Line 158... | ||
154 | mov edi, [cmdline] |
158 | mov edi, [cmdline] |
155 | xor eax, eax |
159 | xor eax, eax |
156 | test edi, edi |
160 | test edi, edi |
157 | jz @F |
161 | jz @F |
Line -... | Line 162... | ||
- | 162 | ||
158 | 163 | mov ecx, 65535 |
|
159 | call _strlen |
164 | call _strnlen |
160 | cmp eax, 256 |
165 | cmp eax, 256 |
161 | jb @F |
166 | jb @F |
162 | lea ebx, [eax+1] |
167 | lea ebx, [eax+1] |
163 | add [hdr_emem], ebx |
168 | add [hdr_emem], ebx |
Line 183... | Line 188... | ||
183 | lea ecx, [eax+PROC.thr_list] |
188 | lea ecx, [eax+PROC.thr_list] |
184 | list_add_tail edx, ecx |
189 | list_add_tail edx, ecx |
Line 185... | Line 190... | ||
185 | 190 | ||
186 | mov esi, sizeof.APP_HDR |
191 | mov esi, sizeof.APP_HDR |
- | 192 | add esi, [cmdline_size] |
|
187 | add esi, [cmdline_size] |
193 | |
- | 194 | mov edi, [filename] |
|
188 | mov edi, [filename] |
195 | mov ecx, 1023 |
189 | call _strlen |
196 | call _strnlen |
190 | add esi, eax |
197 | add esi, eax |
Line 191... | Line 198... | ||
191 | mov [filename_size], eax |
198 | mov [filename_size], eax |
192 | 199 | ||
Line 832... | Line 839... | ||
832 | and ecx, -4096 |
839 | and ecx, -4096 |
833 | sub ecx, edi |
840 | sub ecx, edi |
834 | shr ecx, 2 |
841 | shr ecx, 2 |
835 | xor eax, eax |
842 | xor eax, eax |
836 | rep stosd |
843 | rep stosd |
837 | - | ||
838 | .done: |
844 | .done: |
839 | .fail: |
845 | .fail: |
840 | ret |
846 | ret |
841 | endp |
847 | endp |
Line 857... | Line 863... | ||
857 | mov ecx, [ebp+APP_HDR.filename_size] |
863 | mov ecx, [ebp+APP_HDR.filename_size] |
858 | test edi, edi |
864 | test edi, edi |
859 | jnz .copy_filename |
865 | jnz .copy_filename |
Line 860... | Line 866... | ||
860 | 866 | ||
861 | add esi, ecx |
867 | add esi, ecx |
Line 862... | Line 868... | ||
862 | jmp .copy_cmdline |
868 | jmp .check_cmdline |
863 | 869 | ||
864 | .copy_filename: |
870 | .copy_filename: |
Line 865... | Line 871... | ||
865 | rep movsb |
871 | rep movsb |
866 | stosb |
872 | stosb |
867 | 873 | ||
868 | .copy_cmdline: |
874 | .check_cmdline: |
869 | mov edi, [ebp+APP_HDR.cmdline] |
875 | mov edi, [ebp+APP_HDR.cmdline] |
Line -... | Line 876... | ||
- | 876 | mov ecx, [ebp+APP_HDR.cmdline_size] |
|
- | 877 | test edi, edi |
|
- | 878 | jz .check_tls_header |
|
- | 879 | ||
- | 880 | cmp ecx, 256 |
|
- | 881 | jb .copy_cmdline |
|
- | 882 | ||
- | 883 | mov edi, [ebp+APP_HDR._emem] |
|
- | 884 | add edi, 4095 |
|
- | 885 | and edi, -4096 |
|
- | 886 | sub edi, ecx |
|
- | 887 | dec edi |
|
- | 888 | ||
- | 889 | cmp word [6], '00' |
|
- | 890 | jne @F |
|
- | 891 | mov [APP_HEADER_00_.i_param], edi |
|
- | 892 | jmp .copy_cmdline |
|
870 | mov ecx, [ebp+APP_HDR.cmdline_size] |
893 | @@: |
871 | test edi, edi |
894 | mov [APP_HEADER_01_.i_param], edi |
Line 872... | Line 895... | ||
872 | jz .check_tls_header |
895 | |
873 | - | ||
874 | rep movsb |
896 | .copy_cmdline: |
875 | stosb |
897 | rep movsb |
Line 876... | Line 898... | ||
876 | 898 | stosb |
|
877 | .check_tls_header: |
899 | |
Line 1042... | Line 1064... | ||
1042 | lea edx, [SLOT_BASE+ebx*8] |
1064 | lea edx, [SLOT_BASE+ebx*8] |
1043 | call scheduler_add_thread |
1065 | call scheduler_add_thread |
1044 | ret |
1066 | ret |
1045 | endp |
1067 | endp |
Line 1046... | Line -... | ||
1046 | - | ||
1047 | 1068 | ||
1048 | align 4 |
- | |
1049 | 1069 | align 4 |
|
1050 | get_stack_base: |
1070 | get_stack_base: |
1051 | mov eax, [current_slot] |
1071 | mov eax, [current_slot] |
1052 | mov eax, [eax+APPDATA.pl0_stack] |
1072 | mov eax, [eax+APPDATA.pl0_stack] |