Rev 133 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 133 | Rev 384 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | ;; ;; |
2 | ;; ;; |
3 | ;; System service for filesystem call ;; |
3 | ;; System service for filesystem call ;; |
4 | ;; (C) 2004 Ville Turjanmaa, License: GPL ;; |
4 | ;; (C) 2004 Ville Turjanmaa, License: GPL ;; |
5 | ;; 29.04.2006 Elimination of hangup after the ;; |
5 | ;; 29.04.2006 Elimination of hangup after the ;; |
6 | ;; expiration hd_wait_timeout (for LBA) - Mario79 ;; |
6 | ;; expiration hd_wait_timeout (for LBA) - Mario79 ;; |
7 | ;; xx.04.2006 LFN support - diamond ;; |
- | |
8 | ;; 15.01.2005 get file size/attr/date, file_append (only for hd) - ATV ;; |
7 | ;; 15.01.2005 get file size/attr/date, file_append (only for hd) - ATV ;; |
9 | ;; 23.11.2004 test if hd/partition is set - ATV ;; |
8 | ;; 23.11.2004 test if hd/partition is set - ATV ;; |
10 | ;; 18.11.2004 get_disk_info and more error codes - ATV ;; |
9 | ;; 18.11.2004 get_disk_info and more error codes - ATV ;; |
11 | ;; 08.11.2004 expand_pathz and rename (only for hd) - ATV ;; |
10 | ;; 08.11.2004 expand_pathz and rename (only for hd) - ATV ;; |
12 | ;; 20.10.2004 Makedir/Removedir (only for hd) - ATV ;; |
11 | ;; 20.10.2004 Makedir/Removedir (only for hd) - ATV ;; |
Line 35... | Line 34... | ||
35 | 34 | ||
36 | ; IN: |
35 | ; IN: |
37 | ; |
36 | ; |
38 | ; eax = 0 ; read file /RamDisk/First 6 |
37 | ; eax = 0 ; read file /RamDisk/First 6 |
39 | ; eax = 1 ; write file /RamDisk/First 33 /HardDisk/First 56 |
- | |
40 | ; eax = 2 ; delete file /RamDisk/First 32 |
- | |
41 | ; eax = 4 ; makedir |
- | |
42 | ; eax = 5 ; rename file/directory |
38 | ; eax = 1 ; write file /RamDisk/First 33 /HardDisk/First 56 |
43 | ; eax = 8 ; lba read |
39 | ; eax = 8 ; lba read |
44 | ; eax = 15 ; get_disk_info |
- | |
45 | ; eax = 16 ; start application |
40 | ; eax = 15 ; get_disk_info |
46 | ; |
41 | ; |
47 | ; OUT: |
42 | ; OUT: |
48 | ; |
43 | ; |
49 | ; eax = 0 : read ok |
44 | ; eax = 0 : read ok |
Line 87... | Line 82... | ||
87 | ; Extract parameters |
82 | ; Extract parameters |
88 | add eax, std_application_base_address ; abs start of info block |
83 | add eax, std_application_base_address ; abs start of info block |
Line 89... | Line 84... | ||
89 | 84 | ||
90 | cmp dword [eax+0],15 ; GET_DISK_INFO |
85 | cmp dword [eax+0],15 ; GET_DISK_INFO |
91 | je fs_info |
- | |
92 | cmp dword [eax+0],16 ; RUN - dont care about read&write blocks |
- | |
93 | je fs_read |
- | |
94 | cmp dword [eax+0],5 ; RENAME - dont care about read&write blocks |
- | |
95 | je fs_read |
- | |
96 | cmp dword [eax+0],4 ; MAKEDIR - dont care about read&write blocks |
- | |
97 | je fs_read |
- | |
98 | cmp dword [eax+0],2 ; DELETE - dont care about read&write blocks |
- | |
Line 99... | Line 86... | ||
99 | je fs_read |
86 | je fs_info |
100 | 87 | ||
101 | cmp dword [0x3000],1 ; no memory checks for kernel requests |
88 | cmp dword [CURRENT_TASK],1 ; no memory checks for kernel requests |
102 | jz no_checks_for_kernel |
89 | jz no_checks_for_kernel |
103 | mov edx,eax |
90 | mov edx,eax |
104 | cmp dword [eax+0],1 |
91 | cmp dword [eax+0],1 |
Line 147... | Line 134... | ||
147 | ; root - only read is allowed |
134 | ; root - only read is allowed |
148 | ; other operations return "access denied", eax=10 |
135 | ; other operations return "access denied", eax=10 |
149 | ; (execute operation returns eax=-10) |
136 | ; (execute operation returns eax=-10) |
150 | cmp dword [eax], 0 |
137 | cmp dword [eax], 0 |
151 | jz .read_root |
138 | jz .read_root |
152 | mov ecx, 10 |
- | |
153 | cmp dword [eax], 16 |
139 | mov dword [esp+36], 10 |
154 | jnz @f |
- | |
155 | neg ecx |
- | |
156 | @@: mov [esp+36], ecx |
- | |
157 | ret |
140 | ret |
158 | .read_root: |
141 | .read_root: |
159 | ; \end{diamond}[18.03.2006] |
142 | ; \end{diamond}[18.03.2006] |
160 | mov esi,dir0 |
143 | mov esi,dir0 |
161 | mov edi,[eax+12] |
144 | mov edi,[eax+12] |
Line 288... | Line 271... | ||
288 | ; eax=0 ok - eax=1 not enough free space |
271 | ; eax=0 ok - eax=1 not enough free space |
Line 289... | Line 272... | ||
289 | 272 | ||
Line 290... | Line 273... | ||
290 | jmp file_system_return |
273 | jmp file_system_return |
291 | - | ||
292 | fs_noramdisk_write: |
- | |
293 | - | ||
294 | cmp dword [esp+20],16 ; START APPLICATION |
- | |
295 | jne fs_noramdisk_start_application |
- | |
296 | - | ||
297 | mov eax,[esp+4] ; fname |
- | |
298 | add eax,2*12+1 |
- | |
299 | - | ||
300 | xor ebx,ebx ; parameters to pass |
- | |
301 | cmp dword [esp+12],ebx;0 |
- | |
302 | je no_fl_start_param |
- | |
303 | mov ebx, [esp+12] |
- | |
304 | add ebx, std_application_base_address |
- | |
305 | no_fl_start_param: |
- | |
306 | mov edx,[esp+16] ; flags |
- | |
307 | - | ||
308 | call start_application_fl |
- | |
309 | - | ||
310 | jmp file_system_startapp_return |
- | |
311 | - | ||
312 | fs_noramdisk_start_application: ;there's new code - Mihasik |
- | |
313 | cmp dword [esp+20],2 ;DELETE |
- | |
314 | jne fs_noramdisk_delete |
- | |
315 | mov eax,[esp+4] ; fname |
- | |
316 | add eax,2*12+1 |
- | |
317 | call filedelete |
- | |
318 | jmp file_system_return |
- | |
319 | 274 | ||
Line 320... | Line 275... | ||
320 | fs_noramdisk_delete: |
275 | fs_noramdisk_write: |
321 | fs_noramdisk: |
276 | fs_noramdisk: |
322 | 277 | ||
Line 383... | Line 338... | ||
383 | 338 | ||
Line 384... | Line 339... | ||
384 | jmp file_system_return |
339 | jmp file_system_return |
Line 385... | Line -... | ||
385 | - | ||
386 | fs_noflpdisk_write: |
- | |
387 | - | ||
388 | cmp dword [esp+20],2 ; DELETE |
- | |
389 | jne fs_noflpdisk_delete |
- | |
390 | - | ||
391 | mov eax,[esp+4] ; fname |
- | |
392 | add eax,2*12+1 |
- | |
393 | call floppy_filedelete |
- | |
394 | mov [flp_status],0 |
- | |
395 | jmp file_system_return |
- | |
396 | - | ||
397 | fs_noflpdisk_delete: |
- | |
398 | cmp dword [esp+20],16 ; START APPLICATION |
- | |
399 | jne fs_noflpdisk_start_application |
- | |
400 | - | ||
401 | mov eax,[esp+4] ; fname |
- | |
402 | add eax,2*12+1 |
- | |
403 | - | ||
404 | xor ebx,ebx ; parameters to pass |
- | |
405 | cmp dword [esp+12],ebx;0 |
- | |
406 | je no_flp_start_param |
- | |
407 | mov ebx,[0x3010] |
- | |
408 | mov ebx,[ebx+0x10] |
- | |
409 | add ebx,[esp+12] |
- | |
410 | - | ||
411 | no_flp_start_param: |
- | |
412 | mov edx,[esp+16] ; flags |
- | |
413 | - | ||
414 | call start_application_floppy |
- | |
415 | - | ||
416 | file_system_startapp_return: |
- | |
417 | mov ebx, [esp+24+24] ; do not modify ebx in application |
- | |
418 | jmp file_system_return |
- | |
419 | 340 | ||
420 | fs_noflpdisk_start_application: |
341 | fs_noflpdisk_write: |
Line 421... | Line 342... | ||
421 | 342 | ||
422 | fs_noflpdisk: |
343 | fs_noflpdisk: |
Line 454... | Line 375... | ||
454 | call reserve_hd1 |
375 | call reserve_hd1 |
455 | mov [hdbase],0x170 |
376 | mov [hdbase],0x170 |
456 | mov [hdid],0x10 |
377 | mov [hdid],0x10 |
457 | mov [hdpos],4 |
378 | mov [hdpos],4 |
458 | fs_yesharddisk_partition: |
379 | fs_yesharddisk_partition: |
- | 380 | call reserve_hd_channel |
|
459 | ; call choice_necessity_partition |
381 | ; call choice_necessity_partition |
460 | ; jmp fs_yesharddisk_all |
382 | ; jmp fs_yesharddisk_all |
461 | jmp fs_for_new_semantic |
383 | jmp fs_for_new_semantic |
Line 462... | Line 384... | ||
462 | 384 | ||
Line 509... | Line 431... | ||
509 | fs_for_new_semantic: |
431 | fs_for_new_semantic: |
510 | call choice_necessity_partition |
432 | call choice_necessity_partition |
Line 511... | Line 433... | ||
511 | 433 | ||
512 | fs_yesharddisk_all: |
434 | fs_yesharddisk_all: |
513 | mov eax,1 |
- | |
514 | cmp dword [esp+20], 16 |
- | |
515 | jnz @f |
- | |
516 | neg eax |
435 | mov eax,1 |
517 | @@: mov ebx, [esp+24+24] |
436 | mov ebx, [esp+24+24] |
518 | cmp [hdpos],0 ; is hd base set? |
437 | cmp [hdpos],0 ; is hd base set? |
519 | jz hd_err_return |
438 | jz hd_err_return |
520 | cmp [fat32part],0 ; is partition set? |
439 | cmp [fat32part],0 ; is partition set? |
521 | jnz @f |
440 | jnz @f |
- | 441 | hd_err_return: |
|
522 | hd_err_return: |
442 | call free_hd_channel |
523 | and [hd1_status], 0 |
443 | and [hd1_status], 0 |
524 | jmp file_system_return |
444 | jmp file_system_return |
Line 525... | Line 445... | ||
525 | @@: |
445 | @@: |
Line 542... | Line 462... | ||
542 | call file_read |
462 | call file_read |
Line 543... | Line 463... | ||
543 | 463 | ||
544 | mov edi,[esp+0] |
464 | mov edi,[esp+0] |
Line -... | Line 465... | ||
- | 465 | mov byte [edi],'/' |
|
- | 466 | ||
545 | mov byte [edi],'/' |
467 | call free_hd_channel |
Line 546... | Line 468... | ||
546 | 468 | and [hd1_status], 0 |
|
Line 566... | Line 488... | ||
566 | mov edi,[esp+0] |
488 | mov edi,[esp+0] |
567 | mov byte [edi],'/' |
489 | mov byte [edi],'/' |
Line 568... | Line 490... | ||
568 | 490 | ||
Line -... | Line 491... | ||
- | 491 | ; eax=0 ok - eax=1 not enough free space |
|
- | 492 | ||
569 | ; eax=0 ok - eax=1 not enough free space |
493 | call free_hd_channel |
Line 570... | Line 494... | ||
570 | 494 | and [hd1_status], 0 |
|
Line 571... | Line -... | ||
571 | jmp file_system_return |
- | |
572 | - | ||
Line 573... | Line -... | ||
573 | - | ||
574 | fs_noharddisk_write: |
- | |
575 | - | ||
576 | cmp dword [esp+20],2 ; DELETE |
- | |
577 | jne fs_noharddisk_delete |
- | |
578 | - | ||
579 | mov eax,[esp+0] ; /dirname or /filename |
- | |
580 | mov byte [eax],0 ; path to asciiz |
- | |
581 | inc eax ; filename start |
- | |
582 | mov edx,[esp+4] |
- | |
583 | add edx,12*2 ; path start |
- | |
584 | - | ||
585 | call removedir |
- | |
586 | - | ||
587 | mov edi,[esp+0] |
- | |
588 | mov byte [edi],'/' |
- | |
589 | - | ||
590 | jmp file_system_return |
- | |
591 | - | ||
592 | fs_noharddisk_delete: |
- | |
593 | - | ||
594 | cmp dword [esp+20],4 ; MAKEDIR |
- | |
595 | jne fs_noharddisk_makedir |
- | |
596 | - | ||
597 | mov eax,[esp+0] ; /dirname |
- | |
598 | mov byte [eax],0 ; path to asciiz |
- | |
599 | inc eax ; filename start |
- | |
600 | mov edx,[esp+4] |
- | |
601 | add edx,12*2 ; path start |
- | |
602 | - | ||
603 | call makedir |
- | |
604 | - | ||
605 | mov edi,[esp+0] |
- | |
606 | mov byte [edi],'/' |
- | |
607 | - | ||
608 | jmp file_system_return |
- | |
609 | - | ||
610 | fs_noharddisk_makedir: |
- | |
611 | - | ||
612 | cmp dword [esp+20],5 ; RENAME |
- | |
613 | jne fs_noharddisk_rename |
- | |
614 | - | ||
615 | mov edi,[esp+0] ; start of source file name |
- | |
616 | add edi,12+1 ; continue after name |
- | |
617 | call expand_pathz ; convert destination name |
- | |
618 | - | ||
619 | mov eax,[edi+1] |
- | |
620 | cmp eax,'HD ' |
- | |
621 | je fs_rename_test1 |
- | |
622 | cmp eax,'HARD' |
- | |
623 | jne fs_rename_error |
- | |
624 | - | ||
625 | fs_rename_test1: |
- | |
626 | mov eax,[edi+1+12] |
- | |
627 | cmp eax,'1 ' |
- | |
628 | je fs_rename_start |
- | |
629 | cmp eax,'FIRS' |
- | |
630 | jne fs_rename_error |
- | |
631 | - | ||
632 | fs_rename_start: |
- | |
633 | mov byte [ebx],0 ; path to asciiz |
- | |
634 | inc ebx ; filename start |
- | |
635 | add edi,12*2 ; path start |
- | |
636 | cmp byte [ebx],0 |
- | |
637 | je fs_rename_error |
- | |
638 | cmp byte [ebx],32 |
- | |
639 | je fs_rename_error |
- | |
640 | - | ||
641 | mov eax,[esp+0] ; /filename |
495 | jmp file_system_return |
642 | mov byte [eax],0 ; path to asciiz |
- | |
643 | inc eax ; filename start |
- | |
644 | mov edx,[esp+4] |
- | |
645 | add edx,12*2 ; path start |
- | |
646 | - | ||
647 | call rename |
- | |
648 | - | ||
649 | mov edi,[esp+0] |
- | |
650 | mov byte [edi],'/' |
- | |
651 | - | ||
652 | jmp file_system_return |
- | |
653 | - | ||
654 | fs_rename_error: |
- | |
655 | mov eax,4 ; partition not defined at hd |
- | |
656 | jmp file_system_return |
- | |
657 | - | ||
658 | fs_noharddisk_rename: |
- | |
659 | - | ||
660 | cmp dword [esp+20],16 ; START APPLICATION |
- | |
661 | jne fs_noharddisk_start_application |
- | |
662 | - | ||
663 | mov eax,[esp+4] ; fname |
- | |
664 | add eax,12*2 |
- | |
665 | - | ||
666 | mov ebx,[esp+0] ; length |
- | |
667 | sub ebx,eax |
- | |
668 | add ebx,12 |
- | |
669 | 496 | ||
670 | mov ecx,[esp+4] ; work area |
- | |
671 | add ecx,512 |
- | |
672 | - | ||
673 | xor ebp,ebp ; parameters to pass |
- | |
674 | cmp dword [esp+12],ebp;0 |
- | |
675 | je no_hd_start_param |
- | |
676 | mov ebp, [esp+12] |
- | |
677 | add ebp, std_application_base_address |
- | |
678 | no_hd_start_param: |
- | |
679 | mov edx,[esp+16] ; flags |
- | |
Line 680... | Line 497... | ||
680 | 497 | ||
681 | call start_application_hd |
498 | fs_noharddisk_write: |
682 | 499 | ||
683 | jmp file_system_startapp_return |
500 | |
684 | - | ||
685 | fs_noharddisk_start_application: |
- | |
686 | - | ||
687 | fs_noharddisk: |
501 | call free_hd_channel |
688 | ; \begin{diamond}[18.03.2006] |
502 | and [hd1_status], 0 |
Line 689... | Line 503... | ||
689 | mov eax, 5 ; file not found |
503 | |
Line 690... | Line 504... | ||
690 | ; à ìîæåò áûòü, âîçâðàùàòü äðóãîé êîä îøèáêè? |
504 | fs_noharddisk: |
Line 711... | Line 525... | ||
711 | ; (execute operation returns eax=-10) |
525 | ; (execute operation returns eax=-10) |
712 | cmp dword [esp+20], 0 |
526 | cmp dword [esp+20], 0 |
713 | jz .read |
527 | jz .read |
714 | add esp, 20 |
528 | add esp, 20 |
715 | pop ecx |
529 | pop ecx |
716 | mov eax, 10 |
- | |
717 | cmp ecx, 16 |
- | |
718 | jnz @f |
- | |
719 | neg eax |
- | |
720 | @@: mov [esp+36], eax |
530 | mov dword [esp+36], 10 |
721 | ret |
531 | ret |
722 | .read: |
532 | .read: |
723 | ; \end{diamond}[18.03.2006] |
533 | ; \end{diamond}[18.03.2006] |
724 | mov al,0x10 |
534 | mov al,0x10 |
725 | mov ebx,1 |
535 | mov ebx,1 |
Line 767... | Line 577... | ||
767 | 577 | ||
768 | mov edi,ecx |
578 | mov edi,ecx |
Line 769... | Line 579... | ||
769 | mov esi,eax |
579 | mov esi,eax |
770 | 580 | ||
771 | shl esi,9 |
581 | shl esi,9 |
772 | add esi,0x100000 |
582 | add esi,RAMDISK |
773 | mov ecx,512/4 |
583 | mov ecx,512/4 |
Line 774... | Line 584... | ||
774 | ; cld |
584 | ; cld |