Subversion Repositories Kolibri OS

Rev

Rev 5204 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1.  
  2. #include <sys/types.h>
  3. #include <sys/kos_io.h>
  4.  
  5. int read_file(const char *path, void *buff,
  6.                size_t offset, size_t count, size_t *reads)
  7. {
  8.     int  retval;
  9.     int  d0;
  10.     __asm__ __volatile__(
  11.     "pushl $0 \n\t"
  12.     "pushl $0 \n\t"
  13.     "movl %%eax, 1(%%esp) \n\t"
  14.     "pushl %%ebx \n\t"
  15.     "pushl %%edx \n\t"
  16.     "pushl $0 \n\t"
  17.     "pushl %%ecx \n\t"
  18.     "pushl $0 \n\t"
  19.     "movl %%esp, %%ebx \n\t"
  20.     "mov $70, %%eax \n\t"
  21.     "int $0x40 \n\t"
  22.     "testl %%esi, %%esi \n\t"
  23.     "jz 1f \n\t"
  24.     "movl %%ebx, (%%esi) \n\t"
  25. "1:"
  26.     "addl $28, %%esp \n\t"
  27.     :"=a" (retval)
  28.     :"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(reads));
  29.     return retval;
  30. };
  31.  
  32.