Rev 41 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 41 | Rev 61 | ||
---|---|---|---|
Line 84... | Line 84... | ||
84 | push ebx |
84 | push ebx |
85 | push eax |
85 | push eax |
86 | call find_new_process_place ;find empty process slot |
86 | call find_new_process_place ;find empty process slot |
87 | sti |
87 | sti |
88 | test eax,eax |
88 | test eax,eax |
- | 89 | mov ecx, -0x20 ; too many processes |
|
89 | jz .failed |
90 | jz .failed |
Line 90... | Line 91... | ||
90 | 91 | ||
91 | mov edi,eax |
92 | mov edi,eax |
92 | shl edi,8 |
93 | shl edi,8 |
Line 95... | Line 96... | ||
95 | xor eax,eax |
96 | xor eax,eax |
96 | cld |
97 | cld |
97 | rep stosd ;clean extended information about process |
98 | rep stosd ;clean extended information about process |
Line 98... | Line 99... | ||
98 | 99 | ||
99 | ;set new process name |
- | |
100 | xor eax,eax |
100 | ;set new process name |
101 | mov [appl_path_size],eax |
101 | mov [appl_path_size],eax |
- | 102 | pop eax |
|
102 | mov eax,[esp] ;+8] |
103 | push eax |
103 | .find_last_byte: |
104 | .find_last_byte: |
104 | cmp byte [eax],0 |
105 | cmp byte [eax],0 |
105 | jz .find_last_byte_end |
106 | jz .find_last_byte_end |
106 | inc eax |
107 | inc eax |
Line 124... | Line 125... | ||
124 | mov esi,12 ;file name length |
125 | mov esi,12 ;file name length |
125 | mov edi,[esp+8] |
126 | mov edi,[esp+8] |
126 | ; cli |
127 | ; cli |
127 | call floppy_fileread ;read file from FD |
128 | call floppy_fileread ;read file from FD |
128 | ; sti |
129 | ; sti |
129 | cmp eax,0 |
130 | mov ecx, eax |
- | 131 | neg ecx |
|
130 | jne .cleanfailed |
132 | jnz .cleanfailed |
131 | ;check MENUET signature |
133 | ;check MENUET signature |
- | 134 | mov ecx, -0x1F ; not Menuet/Kolibri executable |
|
132 | cmp [0x90000],dword 'MENU' |
135 | cmp [0x90000],dword 'MENU' |
133 | jnz .cleanfailed |
136 | jnz .cleanfailed |
134 | cmp [0x90004],word 'ET' |
137 | cmp [0x90004],word 'ET' |
135 | jnz .cleanfailed |
138 | jnz .cleanfailed |
Line 136... | Line 139... | ||
136 | 139 | ||
137 | call get_app_params ;parse header fields |
140 | call get_app_params ;parse header fields |
138 | cmp esi,0 |
141 | test esi, esi |
Line 139... | Line 142... | ||
139 | jz .cleanfailed |
142 | jz .cleanfailed |
- | 143 | ||
140 | 144 | mov eax,[new_process_place] |
|
141 | mov eax,[new_process_place] |
145 | inc ecx ; -0x1E = no memory |
142 | call create_app_cr3_table ;create page directory for new process |
146 | call create_app_cr3_table ;create page directory for new process |
Line 143... | Line 147... | ||
143 | test eax,eax |
147 | test eax,eax |
Line 150... | Line 154... | ||
150 | add ecx,4095 |
154 | add ecx,4095 |
151 | shr ecx,12 |
155 | shr ecx,12 |
152 | mov edx,eax |
156 | mov edx,eax |
153 | call mem_alloc_specified_region ;allocate memory for application |
157 | call mem_alloc_specified_region ;allocate memory for application |
154 | test eax,eax |
158 | test eax,eax |
- | 159 | mov ecx, -0x1E |
|
155 | jz .cleanfailed_mem1 |
160 | jz .cleanfailed_mem1 |
Line 156... | Line 161... | ||
156 | 161 | ||
157 | mov eax,[edx+(std_application_base_address shr 20)] |
162 | mov eax,[edx+(std_application_base_address shr 20)] |
158 | and eax,not (4096-1) ;eax - physical address of first (for application memory) page table |
163 | and eax,not (4096-1) ;eax - physical address of first (for application memory) page table |
Line 207... | Line 212... | ||
207 | .cleanfailed_mem: |
212 | .cleanfailed_mem: |
208 | ;there is no mem for directory entry, display message. |
213 | ;there is no mem for directory entry, display message. |
209 | mov esi,start_not_enough_memory |
214 | mov esi,start_not_enough_memory |
210 | call sys_msg_board_str |
215 | call sys_msg_board_str |
211 | .cleanfailed: ;clean process name |
216 | .cleanfailed: ;clean process name |
- | 217 | push ecx ; save error code |
|
212 | ;can't read file, clean process name. |
218 | ;can't read file, clean process name. |
213 | ;this avoid problems with panel application. |
219 | ;this avoid problems with panel application. |
214 | mov edi,[new_process_place] |
220 | mov edi,[new_process_place] |
215 | shl edi,8 |
221 | shl edi,8 |
216 | add edi,0x80000 |
222 | add edi,0x80000 |
217 | mov ecx,11 |
223 | mov ecx,11 |
218 | mov eax,' ' |
224 | mov eax,' ' |
219 | cld |
225 | cld |
220 | rep stosb |
226 | rep stosb |
- | 227 | pop eax |
|
221 | .failed: |
228 | .failed: |
222 | ;no more slots |
229 | ;no more slots |
223 | add esp,8+4 |
230 | add esp,8+4 |
224 | mov [application_table_status],0 |
231 | mov [application_table_status],0 |
- | 232 | mov [esp+1Ch], eax |
|
225 | popad |
233 | popad |
226 | sti |
234 | sti |
227 | mov eax,-1 |
- | |
228 | ret |
235 | ret |
Line 229... | Line 236... | ||
229 | 236 | ||
230 | ;----------------------------------------------------------------------------- |
237 | ;----------------------------------------------------------------------------- |
231 | new_start_application_fl: |
238 | new_start_application_fl: |
Line 256... | Line 263... | ||
256 | push ebx |
263 | push ebx |
257 | push eax |
264 | push eax |
258 | call find_new_process_place ;find empty process slot |
265 | call find_new_process_place ;find empty process slot |
259 | call safe_sti |
266 | call safe_sti |
260 | test eax,eax |
267 | test eax,eax |
- | 268 | mov ecx, -0x20 ; too many processes |
|
261 | jz .failed |
269 | jz .failed |
Line 262... | Line 270... | ||
262 | 270 | ||
263 | mov edi,eax |
271 | mov edi,eax |
264 | shl edi,8 |
272 | shl edi,8 |
Line 282... | Line 290... | ||
282 | mov edx,0x90000 ;temp area |
290 | mov edx,0x90000 ;temp area |
283 | mov esi,12 ;file name length |
291 | mov esi,12 ;file name length |
284 | cli |
292 | cli |
285 | call fileread ;read file from RD |
293 | call fileread ;read file from RD |
286 | call safe_sti |
294 | call safe_sti |
287 | cmp eax,0 |
295 | mov ecx, eax |
- | 296 | neg ecx |
|
288 | jne .cleanfailed |
297 | jnz .cleanfailed |
289 | ;check MENUET signature |
298 | ;check MENUET signature |
- | 299 | mov ecx, -0x1F ; not Menuet/Kolibri executable |
|
290 | cmp [0x90000],dword 'MENU' |
300 | cmp [0x90000],dword 'MENU' |
291 | jnz .cleanfailed |
301 | jnz .cleanfailed |
292 | cmp [0x90004],word 'ET' |
302 | cmp [0x90004],word 'ET' |
293 | jnz .cleanfailed |
303 | jnz .cleanfailed |
Line 294... | Line 304... | ||
294 | 304 | ||
295 | call get_app_params ;parse header fields |
305 | call get_app_params ;parse header fields |
296 | cmp esi,0 |
306 | test esi,esi |
Line 297... | Line 307... | ||
297 | jz .cleanfailed |
307 | jz .cleanfailed |
298 | 308 | ||
- | 309 | mov eax,[new_process_place] |
|
299 | mov eax,[new_process_place] |
310 | call create_app_cr3_table ;create page directory for new process |
300 | call create_app_cr3_table ;create page directory for new process |
311 | inc ecx ; -0x1E = no memory |
Line 301... | Line 312... | ||
301 | test eax,eax |
312 | test eax,eax |
Line 308... | Line 319... | ||
308 | add ecx,4095 |
319 | add ecx,4095 |
309 | shr ecx,12 |
320 | shr ecx,12 |
310 | mov edx,eax |
321 | mov edx,eax |
311 | call mem_alloc_specified_region ;allocate memory for application |
322 | call mem_alloc_specified_region ;allocate memory for application |
312 | test eax,eax |
323 | test eax,eax |
- | 324 | mov ecx, -0x1E |
|
313 | jz .cleanfailed_mem1 |
325 | jz .cleanfailed_mem1 |
Line 314... | Line 326... | ||
314 | 326 | ||
315 | mov eax,[edx+(std_application_base_address shr 20)] |
327 | mov eax,[edx+(std_application_base_address shr 20)] |
316 | and eax,not (4096-1) ;eax - physical address of first (for application memory) page table |
328 | and eax,not (4096-1) ;eax - physical address of first (for application memory) page table |
Line 364... | Line 376... | ||
364 | .cleanfailed_mem: |
376 | .cleanfailed_mem: |
365 | ;there is no mem for directory entry, display message. |
377 | ;there is no mem for directory entry, display message. |
366 | mov esi,start_not_enough_memory |
378 | mov esi,start_not_enough_memory |
367 | call sys_msg_board_str |
379 | call sys_msg_board_str |
368 | .cleanfailed: ;clean process name |
380 | .cleanfailed: ;clean process name |
- | 381 | push ecx ; save error code |
|
369 | ;can't read file, clean process name. |
382 | ;can't read file, clean process name. |
370 | ;this avoid problems with panel application. |
383 | ;this avoid problems with panel application. |
371 | mov edi,[new_process_place] |
384 | mov edi,[new_process_place] |
372 | shl edi,8 |
385 | shl edi,8 |
373 | add edi,0x80000 |
386 | add edi,0x80000 |
374 | mov ecx,11 |
387 | mov ecx,11 |
375 | mov eax,' ' |
388 | mov eax,' ' |
376 | cld |
389 | cld |
377 | rep stosb |
390 | rep stosb |
- | 391 | pop eax |
|
378 | .failed: |
392 | .failed: |
379 | ;no more slots |
393 | ;no more slots |
380 | add esp,8 |
394 | add esp,8 |
381 | mov [application_table_status],0 |
395 | mov [application_table_status],0 |
- | 396 | mov [esp+1Ch], eax |
|
382 | popad |
397 | popad |
383 | call safe_sti |
398 | call safe_sti |
384 | mov eax,-1 |
- | |
385 | ret |
399 | ret |
Line 386... | Line 400... | ||
386 | 400 | ||
387 | .add_app_parameters: |
401 | .add_app_parameters: |
388 | ;input: |
402 | ;input: |
Line 1201... | Line 1215... | ||
1201 | push eax |
1215 | push eax |
1202 | push ecx |
1216 | push ecx |
1203 | call find_new_process_place ;find new process slot |
1217 | call find_new_process_place ;find new process slot |
1204 | sti |
1218 | sti |
1205 | test eax,eax |
1219 | test eax,eax |
- | 1220 | mov ecx, -0x20 ; too many processes |
|
1206 | jz .failed |
1221 | jz .failed |
Line 1207... | Line 1222... | ||
1207 | 1222 | ||
1208 | ;write application name |
1223 | ;write application name |
1209 | xor eax,eax |
1224 | xor eax,eax |
Line 1229... | Line 1244... | ||
1229 | mov eax,[esp+4] ;file name |
1244 | mov eax,[esp+4] ;file name |
1230 | mov esi,[esp] ;work area |
1245 | mov esi,[esp] ;work area |
1231 | mov ecx,1 ;read from first block |
1246 | mov ecx,1 ;read from first block |
1232 | mov edx,1 ;read 1 block |
1247 | mov edx,1 ;read 1 block |
1233 | call read_hd_file |
1248 | call read_hd_file |
1234 | test eax,eax |
1249 | mov ecx, eax |
- | 1250 | neg ecx |
|
1235 | jnz .cleanfailed |
1251 | jnz .cleanfailed |
Line 1236... | Line 1252... | ||
1236 | 1252 | ||
- | 1253 | pop esi |
|
1237 | mov esi,[esp] |
1254 | push esi |
- | 1255 | ;check menuet signature |
|
1238 | ;check menuet signature |
1256 | mov ecx, -0x1F ; not Menuet/Kolibri executable |
1239 | cmp [esi+1024+0],dword 'MENU' ;read_hd_file function write file to +1024 offset |
1257 | cmp [esi+1024+0],dword 'MENU' ;read_hd_file function write file to +1024 offset |
1240 | jnz .cleanfailed |
1258 | jnz .cleanfailed |
1241 | cmp [esi+1024+4],word 'ET' |
1259 | cmp [esi+1024+4],word 'ET' |
1242 | jnz .cleanfailed |
1260 | jnz .cleanfailed |
1243 | add esi,1024 |
1261 | add esi,1024 |
1244 | mov edi,0x90000 |
1262 | mov edi,0x90000 |
1245 | mov ecx,512/4 |
1263 | mov ecx,512/4 |
1246 | cld |
1264 | cld |
1247 | rep movsd ;copy first block to 0x90000 address for get_app_params function |
1265 | rep movsd ;copy first block to 0x90000 address for get_app_params function |
- | 1266 | call get_app_params |
|
1248 | call get_app_params |
1267 | mov ecx, -0x1F ; not Menuet/Kolibri executable |
1249 | test esi,esi |
1268 | test esi,esi |
Line 1250... | Line 1269... | ||
1250 | jz .cleanfailed |
1269 | jz .cleanfailed |
1251 | 1270 | ||
1252 | mov eax,[new_process_place] |
1271 | mov eax,[new_process_place] |
- | 1272 | call create_app_cr3_table ;create page directory |
|
1253 | call create_app_cr3_table ;create page directory |
1273 | test eax,eax |
Line 1254... | Line 1274... | ||
1254 | test eax,eax |
1274 | inc ecx ; -0x1E = no memory |
Line 1255... | Line 1275... | ||
1255 | jz .cleanfailed_mem |
1275 | jz .cleanfailed_mem |
1256 | 1276 | ||
1257 | call MEM_Get_Linear_Address |
1277 | call MEM_Get_Linear_Address |
1258 | 1278 | ||
1259 | mov ebx,std_application_base_address |
1279 | mov ebx,std_application_base_address |
1260 | mov ecx,[app_mem] |
1280 | mov ecx,[app_mem] |
- | 1281 | add ecx,4096-1 |
|
1261 | add ecx,4096-1 |
1282 | shr ecx,12 |
1262 | shr ecx,12 |
1283 | mov edx,eax ;edx - linear address of page directory |
Line 1263... | Line 1284... | ||
1263 | mov edx,eax ;edx - linear address of page directory |
1284 | call mem_alloc_specified_region ;allocate memory for application |
1264 | call mem_alloc_specified_region ;allocate memory for application |
1285 | mov ecx, -0x1E ; no memory |
Line 1348... | Line 1369... | ||
1348 | .cleanfailed_mem: |
1369 | .cleanfailed_mem: |
1349 | ;there is no mem for directory entry, display message. |
1370 | ;there is no mem for directory entry, display message. |
1350 | mov esi,start_not_enough_memory |
1371 | mov esi,start_not_enough_memory |
1351 | call sys_msg_board_str |
1372 | call sys_msg_board_str |
1352 | .cleanfailed: ;clean process name |
1373 | .cleanfailed: ;clean process name |
- | 1374 | push ecx |
|
1353 | ;can't read file, clean process name. |
1375 | ;can't read file, clean process name. |
1354 | ;this avoid problems with panel application. |
1376 | ;this avoid problems with panel application. |
1355 | mov edi,[new_process_place] |
1377 | mov edi,[new_process_place] |
1356 | shl edi,8 |
1378 | shl edi,8 |
1357 | add edi,0x80000 |
1379 | add edi,0x80000 |
1358 | mov ecx,11 |
1380 | mov ecx,11 |
1359 | mov eax,' ' |
1381 | mov eax,' ' |
1360 | cld |
1382 | cld |
1361 | rep stosb |
1383 | rep stosb |
- | 1384 | pop eax |
|
1362 | .failed: |
1385 | .failed: |
1363 | ;no more slots |
1386 | ;no more slots |
1364 | add esp,16 |
1387 | add esp,16 |
- | 1388 | mov [esp+1Ch], eax |
|
1365 | popad |
1389 | popad |
1366 | mov eax,-1 |
- | |
1367 | mov [application_table_status],0 |
1390 | mov [application_table_status],0 |
1368 | sti |
1391 | sti |
1369 | ret |
1392 | ret |
1370 | end if |
1393 | end if |