From cff6d94c58fb21c1ade8b239075eb423a4d6d4f0 Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Tue, 15 May 2018 09:54:22 +0300 Subject: [PATCH] Use llseek syscall instead of lseek. --- .gitignore | 2 ++ kolibri.asm | 26 ++++++++++++++++++-------- system.inc | 3 ++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 4f24396..3782d05 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ kofuse mkdirrange *.img *.img.xz +*.img.gz +*.img.lz4 *.img.info diff --git a/kolibri.asm b/kolibri.asm index f318763..6312958 100644 --- a/kolibri.asm +++ b/kolibri.asm @@ -68,13 +68,18 @@ 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 -;DEBUGF 1, "lseek: %x\n", eax + add esp, 8 +;DEBUGF 1, "lseek: %x\n",eax popad pushad @@ -98,13 +103,18 @@ 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 -;DEBUGF 1, "lseek: %x\n", eax + add esp, 8 +;DEBUGF 1, "lseek: %x\n",eax popad pushad diff --git a/system.inc b/system.inc index 501479a..4d39bd4 100644 --- a/system.inc +++ b/system.inc @@ -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