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 mkdirrange
*.img *.img
*.img.xz *.img.xz
*.img.gz
*.img.lz4
*.img.info *.img.info

View File

@ -68,13 +68,18 @@ proc disk_read stdcall, userdata, buffer, startsector:qword, numsectors
pushad pushad
mov eax, dword[startsector + 0] ; sector lo mov eax, dword[startsector + 0] ; sector lo
mov edx, dword[startsector + 4] ; sector hi 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 eax, [userdata]
mov ebx, [eax + FILE_DISK.fd] mov ebx, [eax + FILE_DISK.fd]
mov edx, SEEK_SET sub esp, 8
mov eax, SYS_LSEEK mov esi, esp
mov edi, SEEK_SET
mov eax, SYS_LLSEEK
int 0x80 int 0x80
;DEBUGF 1, "lseek: %x\n", eax add esp, 8
;DEBUGF 1, "lseek: %x\n",eax
popad popad
pushad pushad
@ -98,13 +103,18 @@ proc disk_write stdcall, userdata, buffer, startsector:qword, numsectors
pushad pushad
mov eax, dword[startsector + 0] ; sector lo mov eax, dword[startsector + 0] ; sector lo
mov edx, dword[startsector + 4] ; sector hi 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 eax, [userdata]
mov ebx, [eax + FILE_DISK.fd] mov ebx, [eax + FILE_DISK.fd]
mov edx, SEEK_SET sub esp, 8
mov eax, SYS_LSEEK mov esi, esp
mov edi, SEEK_SET
mov eax, SYS_LLSEEK
int 0x80 int 0x80
;DEBUGF 1, "lseek: %x\n", eax add esp, 8
;DEBUGF 1, "lseek: %x\n",eax
popad popad
pushad pushad

View File

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