Use llseek syscall instead of lseek.

This commit is contained in:
Ivan Baravy 2018-05-15 09:54:22 +03:00
parent 2c3cd9c7c1
commit cff6d94c58
3 changed files with 22 additions and 9 deletions

2
.gitignore vendored
View File

@ -7,4 +7,6 @@ kofuse
mkdirrange
*.img
*.img.xz
*.img.gz
*.img.lz4
*.img.info

View File

@ -68,12 +68,17 @@ proc disk_read stdcall, userdata, buffer, startsector:qword, numsectors
pushad
mov eax, dword[startsector + 0] ; sector lo
mov edx, dword[startsector + 4] ; sector hi
imul ecx, eax, 512
xor ecx, ecx
imul edx, eax, 512
;DEBUGF 1, "lseek to: %x\n", ecx
mov eax, [userdata]
mov ebx, [eax + FILE_DISK.fd]
mov edx, SEEK_SET
mov eax, SYS_LSEEK
sub esp, 8
mov esi, esp
mov edi, SEEK_SET
mov eax, SYS_LLSEEK
int 0x80
add esp, 8
;DEBUGF 1, "lseek: %x\n",eax
popad
@ -98,12 +103,17 @@ proc disk_write stdcall, userdata, buffer, startsector:qword, numsectors
pushad
mov eax, dword[startsector + 0] ; sector lo
mov edx, dword[startsector + 4] ; sector hi
imul ecx, eax, 512
xor ecx, ecx
imul edx, eax, 512
;DEBUGF 1, "lseek to: %x\n", ecx
mov eax, [userdata]
mov ebx, [eax + FILE_DISK.fd]
mov edx, SEEK_SET
mov eax, SYS_LSEEK
sub esp, 8
mov esi, esp
mov edi, SEEK_SET
mov eax, SYS_LLSEEK
int 0x80
add esp, 8
;DEBUGF 1, "lseek: %x\n",eax
popad

View File

@ -3,7 +3,8 @@ SYS_READ = 3
SYS_WRITE = 4
SYS_OPEN = 5
SYS_CLOSE = 6
SYS_LSEEK = 19
;SYS_LSEEK = 19
SYS_LLSEEK = 140
SEEK_SET = 0
SEEK_CUR = 1