Subversion Repositories Kolibri OS

Rev

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

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