Rev 6330 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6330 | Rev 9952 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | /* |
|
- | 2 | * Copyright (C) KolibriOS team 2004-2024. All rights reserved. |
|
- | 3 | * Distributed under terms of the GNU General Public License |
|
- | 4 | */ |
|
- | 5 | ||
1 | #include |
6 | #include |
2 | #include |
7 | #include |
3 | #include |
8 | #include |
Line 4... | Line 9... | ||
4 | 9 | ||
5 | int write_file(const char *path,const void *buff, |
10 | int write_file(const char *path, const void *buff, |
6 | size_t offset, size_t count, size_t *writes) |
11 | size_t offset, size_t count, size_t *writes) |
7 | { |
- | |
8 | int retval; |
- | |
9 | __asm__ __volatile__( |
- | |
10 | "pushl $0 \n\t" |
- | |
11 | "pushl $0 \n\t" |
12 | { |
12 | "movl %%eax, 1(%%esp) \n\t" |
- | |
13 | "pushl %%ebx \n\t" |
- | |
14 | "pushl %%edx \n\t" |
- | |
15 | "pushl $0 \n\t" |
- | |
16 | "pushl %%ecx \n\t" |
- | |
17 | "pushl $3 \n\t" |
- | |
18 | "movl %%esp, %%ebx \n\t" |
- | |
19 | "mov $70, %%eax \n\t" |
- | |
20 | "int $0x40 \n\t" |
13 | ksys_file_status_t st = _ksys_file_write(path, offset, count, buff); |
21 | "testl %%esi, %%esi \n\t" |
- | |
22 | "jz 1f \n\t" |
- | |
23 | "movl %%ebx, (%%esi) \n\t" |
- | |
24 | "1:" |
- | |
25 | "addl $28, %%esp \n\t" |
- | |
26 | :"=a" (retval) |
- | |
27 | :"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(writes)); |
14 | *writes = st.rw_bytes; |
28 | if(retval == 0) |
15 | if(!st.status) |
29 | return 0; |
16 | return 0; |
30 | else if (retval == 8) |
17 | else if (st.status == KSYS_FS_ERR_8) |
31 | return ENOSPC; |
18 | return ENOSPC; |
32 | return -1; |
19 | return -1; |