Rev 3555 | Rev 3725 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3555 | Rev 3626 | ||
---|---|---|---|
Line 333... | Line 333... | ||
333 | ; The handle is the pointer to the internal structure DISK. |
333 | ; The handle is the pointer to the internal structure DISK. |
334 | disk_add: |
334 | disk_add: |
335 | push ebx esi ; save used registers to be stdcall |
335 | push ebx esi ; save used registers to be stdcall |
336 | ; 1. Allocate the DISK structure. |
336 | ; 1. Allocate the DISK structure. |
337 | ; 1a. Call the heap manager. |
337 | ; 1a. Call the heap manager. |
338 | push sizeof.DISK |
338 | movi eax, sizeof.DISK |
339 | pop eax |
- | |
340 | call malloc |
339 | call malloc |
341 | ; 1b. Check the result. If allocation failed, return (go to 9) with eax = 0. |
340 | ; 1b. Check the result. If allocation failed, return (go to 9) with eax = 0. |
342 | test eax, eax |
341 | test eax, eax |
343 | jz .nothing |
342 | jz .nothing |
344 | ; 2. Copy the disk name to the DISK structure. |
343 | ; 2. Copy the disk name to the DISK structure. |
Line 606... | Line 605... | ||
606 | ; 5. Driver does not implement the required function; use default implementation. |
605 | ; 5. Driver does not implement the required function; use default implementation. |
607 | jmp dword [disk_default_callbacks+eax-4] |
606 | jmp dword [disk_default_callbacks+eax-4] |
Line 608... | Line 607... | ||
608 | 607 | ||
609 | ; The default implementation of DISKFUNC.querymedia. |
608 | ; The default implementation of DISKFUNC.querymedia. |
610 | disk_default_querymedia: |
609 | disk_default_querymedia: |
611 | push DISK_STATUS_INVALID_CALL |
- | |
612 | pop eax |
610 | movi eax, DISK_STATUS_INVALID_CALL |
Line 613... | Line 611... | ||
613 | ret 8 |
611 | ret 8 |
614 | 612 | ||
615 | ; The default implementation of DISKFUNC.read and DISKFUNC.write. |
613 | ; The default implementation of DISKFUNC.read and DISKFUNC.write. |
616 | disk_default_read: |
614 | disk_default_read: |
617 | disk_default_write: |
- | |
618 | push DISK_STATUS_INVALID_CALL |
615 | disk_default_write: |
Line 619... | Line 616... | ||
619 | pop eax |
616 | movi eax, DISK_STATUS_INVALID_CALL |
620 | ret 20 |
617 | ret 20 |
621 | 618 | ||
Line 1000... | Line 997... | ||
1000 | call fat_create_partition |
997 | call fat_create_partition |
1001 | test eax, eax |
998 | test eax, eax |
1002 | jnz .success |
999 | jnz .success |
1003 | ; 3. No file system has recognized the volume, so just allocate the PARTITION |
1000 | ; 3. No file system has recognized the volume, so just allocate the PARTITION |
1004 | ; structure without extra fields. |
1001 | ; structure without extra fields. |
1005 | push sizeof.PARTITION |
1002 | movi eax, sizeof.PARTITION |
1006 | pop eax |
- | |
1007 | call malloc |
1003 | call malloc |
1008 | test eax, eax |
1004 | test eax, eax |
1009 | jz .nothing |
1005 | jz .nothing |
1010 | mov edx, dword [.start] |
1006 | mov edx, dword [.start] |
1011 | mov dword [eax+PARTITION.FirstSector], edx |
1007 | mov dword [eax+PARTITION.FirstSector], edx |