Rev 3 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3 | Rev 4 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | .failed: |
48 | .failed: |
49 | xor eax,eax |
49 | xor eax,eax |
50 | pop ebx |
50 | pop ebx |
51 | ret |
51 | ret |
52 | ;----------------------------------------------------------------------------- |
52 | ;----------------------------------------------------------------------------- |
- | 53 | safe_sti: |
|
- | 54 | cmp byte [0xe000], 1 |
|
- | 55 | jne @f |
|
- | 56 | sti |
|
- | 57 | @@:ret |
|
Line 53... | Line 58... | ||
53 | 58 | ||
54 | new_start_application_floppy: |
59 | new_start_application_floppy: |
55 | ;input: |
60 | ;input: |
56 | ; eax - pointer to filename |
61 | ; eax - pointer to filename |
Line 228... | Line 233... | ||
228 | call set_application_table_status |
233 | call set_application_table_status |
229 | ;we can change system tables now |
234 | ;we can change system tables now |
230 | push ebx |
235 | push ebx |
231 | push eax |
236 | push eax |
232 | call find_new_process_place ;find empty process slot |
237 | call find_new_process_place ;find empty process slot |
233 | sti |
238 | call safe_sti |
234 | test eax,eax |
239 | test eax,eax |
235 | jz .failed |
240 | jz .failed |
Line 236... | Line 241... | ||
236 | 241 | ||
237 | mov edi,eax |
242 | mov edi,eax |
Line 255... | Line 260... | ||
255 | mov ecx,2 ;number of blocks |
260 | mov ecx,2 ;number of blocks |
256 | mov edx,0x90000 ;temp area |
261 | mov edx,0x90000 ;temp area |
257 | mov esi,12 ;file name length |
262 | mov esi,12 ;file name length |
258 | cli |
263 | cli |
259 | call fileread ;read file from RD |
264 | call fileread ;read file from RD |
260 | sti |
265 | call safe_sti |
261 | cmp eax,0 |
266 | cmp eax,0 |
262 | jne .cleanfailed |
267 | jne .cleanfailed |
263 | ;check MENUET signature |
268 | ;check MENUET signature |
264 | cmp [0x90000],dword 'MENU' |
269 | cmp [0x90000],dword 'MENU' |
265 | jnz .cleanfailed |
270 | jnz .cleanfailed |
Line 306... | Line 311... | ||
306 | mov ecx,8 ;number of blocks read |
311 | mov ecx,8 ;number of blocks read |
307 | push ebx |
312 | push ebx |
308 | cli |
313 | cli |
309 | call fileread |
314 | call fileread |
310 | ;ebx=file size |
315 | ;ebx=file size |
311 | sti |
316 | call safe_sti |
312 | pop ecx |
317 | pop ecx |
313 | shr ebx,9 |
318 | shr ebx,9 |
314 | cmp ecx,ebx |
319 | cmp ecx,ebx |
315 | jg .endloop1 ;if end of file? |
320 | jg .endloop1 ;if end of file? |
316 | mov ebx,ecx |
321 | mov ebx,ecx |
Line 341... | Line 346... | ||
341 | rep stosb |
346 | rep stosb |
342 | .failed: |
347 | .failed: |
343 | add esp,8 |
348 | add esp,8 |
344 | mov [application_table_status],0 |
349 | mov [application_table_status],0 |
345 | popad |
350 | popad |
346 | sti |
351 | call safe_sti |
347 | mov eax,-1 |
352 | mov eax,-1 |
348 | ret |
353 | ret |
Line 349... | Line 354... | ||
349 | 354 | ||
350 | .add_app_parameters: |
355 | .add_app_parameters: |
Line 437... | Line 442... | ||
437 | mov [l.eip],eax ;set eip in TSS |
442 | mov [l.eip],eax ;set eip in TSS |
438 | mov eax,[app_esp] |
443 | mov eax,[app_esp] |
439 | mov [l.esp],eax ;set stack in TSS |
444 | mov [l.esp],eax ;set stack in TSS |
Line 440... | Line 445... | ||
440 | 445 | ||
441 | ;gdt |
446 | ;gdt |
442 | mov ebx,[new_process_place] |
447 | ;mov ebx,[new_process_place] |
443 | shl ebx,3 |
448 | ;shl ebx,3 |
444 | mov ax,app_code ;ax - selector of code segment |
449 | mov ax,app_code ;ax - selector of code segment |
445 | add ax,bx |
450 | ;add ax,bx |
446 | mov [l.cs],ax |
451 | mov [l.cs],ax |
447 | mov ax,app_data |
452 | mov ax,app_data |
448 | add ax,bx ;ax - selector of data segment |
453 | ;add ax,bx ;ax - selector of data segment |
449 | mov [l.ss],ax |
454 | mov [l.ss],ax |
450 | mov [l.ds],ax |
455 | mov [l.ds],ax |
451 | mov [l.es],ax |
456 | mov [l.es],ax |
452 | mov [l.fs],ax |
457 | mov [l.fs],ax |
453 | mov ax,graph_data ;ax - selector of graphic segment |
458 | mov ax,graph_data ;ax - selector of graphic segment |
454 | mov [l.gs],ax |
459 | mov [l.gs],ax |
455 | mov [l.io],word 128 |
460 | mov [l.io],word 128 |
456 | mov [l.eflags],dword 0x11202 |
461 | mov [l.eflags],dword 0x11202 |
- | 462 | mov [l.ss0],os_data |
|
457 | mov [l.ss0],os_data |
463 | mov ebx,[new_process_place] |
458 | shl ebx,9 |
464 | shl ebx,12 |
459 | add ebx,sysint_stack_data |
465 | add ebx,sysint_stack_data |
460 | mov [l.esp0],ebx |
- | |
461 | ; mov [l.esp1],0x56000 |
- | |
Line 462... | Line 466... | ||
462 | ; mov [l.esp2],0x57000 |
466 | mov [l.esp0],ebx |
463 | 467 | ||
464 | ;copy tss to it place |
468 | ;copy tss to it place |
465 | mov eax,tss_sceleton |
469 | mov eax,tss_sceleton |
Line 488... | Line 492... | ||
488 | shr eax,16 |
492 | shr eax,16 |
489 | mov [edi+gdts+tss0+4],al ;part of offset |
493 | mov [edi+gdts+tss0+4],al ;part of offset |
490 | mov [edi+gdts+tss0+7],ah ;part of offset |
494 | mov [edi+gdts+tss0+7],ah ;part of offset |
491 | mov [edi+gdts+tss0+5],word 01010000b*256+11101001b ;system flags |
495 | mov [edi+gdts+tss0+5],word 01010000b*256+11101001b ;system flags |
Line 492... | Line -... | ||
492 | - | ||
493 | ;set code and data segments |
- | |
494 | mov eax,[new_process_place] |
- | |
495 | shl eax,3 |
- | |
496 | ;set base address of code segment |
- | |
497 | mov word [eax+gdts+app_code-3+2],0 |
- | |
498 | mov byte [eax+gdts+app_code-3+4],0 |
- | |
499 | mov byte [eax+gdts+app_code-3+7],std_application_base_address shr 24 |
- | |
500 | ;set limit of code segment |
- | |
501 | ; mov ebx,[app_mem] |
- | |
502 | ; add ebx,4095 |
- | |
503 | ; shr ebx,12 |
- | |
504 | mov ebx,(0x80000000-std_application_base_address) shr 12 |
- | |
505 | mov [eax+gdts+app_code-3+0],bx |
- | |
506 | mov [eax+gdts+app_code-3+5],word 11010000b*256+11111010b+256*((0x80000000-std_application_base_address) shr 28) |
- | |
507 | ;set base address of data segment |
- | |
508 | mov word [eax+gdts+app_data-3+2],0 |
- | |
509 | mov byte [eax+gdts+app_data-3+4],0 |
- | |
510 | mov byte [eax+gdts+app_data-3+7],std_application_base_address shr 24 |
- | |
511 | ;set limit of data segment |
- | |
512 | mov [eax+gdts+app_data-3+0],bx |
- | |
513 | mov [eax+gdts+app_data-3+5],word 11010000b*256+11110010b+256*((0x80000000-std_application_base_address) shr 28) |
- | |
Line 514... | Line 496... | ||
514 | 496 | ||
515 | 497 | ||
516 | ;flush keyboard and buttons queue |
498 | ;flush keyboard and buttons queue |
Line 534... | Line 516... | ||
534 | 516 | ||
535 | ; add esp,4 ;pop pointer to parameters |
517 | ; add esp,4 ;pop pointer to parameters |
536 | ; popad |
518 | ; popad |
537 | mov eax,[process_number] ;set result |
519 | mov eax,[process_number] ;set result |
538 | mov [application_table_status],0 ;unlock application_table_status mutex |
520 | mov [application_table_status],0 ;unlock application_table_status mutex |
539 | sti |
521 | call safe_sti |
540 | ret 4 |
522 | ret 4 |
541 | ;----------------------------------------------------------------------------- |
523 | ;----------------------------------------------------------------------------- |
542 | new_sys_threads: |
524 | new_sys_threads: |
543 | ;eax=1 - create thread |
525 | ;eax=1 - create thread |