Rev 1408 | Rev 9057 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1408 | Rev 6591 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | int write_file(const char *path,const void *buff, |
1 | int write_file(const char *path,const void *buff, |
2 | unsigned offset,unsigned count,unsigned *writes) |
2 | unsigned offset,unsigned count,unsigned *writes) |
3 | { |
3 | { |
4 | int retval; |
4 | int retval; |
- | 5 | unsigned cnt; |
|
5 | __asm__ __volatile__( |
6 | __asm__ __volatile__( |
6 | "pushl $0 \n\t" |
7 | "pushl $0 \n\t" |
7 | "pushl $0 \n\t" |
8 | "pushl $0 \n\t" |
8 | "movl %%eax, 1(%%esp) \n\t" |
9 | "movl %%eax, 1(%%esp) \n\t" |
9 | "pushl %%ebx \n\t" |
10 | "pushl %%ebx \n\t" |
Line 13... | Line 14... | ||
13 | "pushl $3 \n\t" |
14 | "pushl $3 \n\t" |
14 | "movl %%esp, %%ebx \n\t" |
15 | "movl %%esp, %%ebx \n\t" |
15 | "mov $70, %%eax \n\t" |
16 | "mov $70, %%eax \n\t" |
16 | "int $0x40 \n\t" |
17 | "int $0x40 \n\t" |
17 | "testl %%esi, %%esi \n\t" |
18 | "addl $28, %%esp \n\t" |
18 | "jz 1f \n\t" |
- | |
19 | "movl %%ebx, (%%esi) \n\t" |
- | |
20 | "1:" |
- | |
21 | "addl $28, %%esp \n\t" |
- | |
22 | :"=a" (retval) |
19 | :"=a" (retval), "=b"(cnt) |
23 | :"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(writes)); |
20 | :"a"(path),"b"(buff),"c"(offset),"d"(count)); |
24 | return retval; |
21 | if(writes) |
- | 22 | *writes = cnt; |
|
- | 23 | return retval; |
|
25 | }; |
24 | }; |
26 | 25 |