Rev 5204 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5204 | 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 | */ |
|
Line 1... | Line 5... | ||
1 | #include |
5 | |
2 | #include |
6 | #include |
Line 3... | Line 7... | ||
3 | 7 | #include |
|
4 | int read_file(const char *path, void *buff, |
8 | |
5 | size_t offset, size_t count, size_t *reads) |
9 | int read_file(const char *path, void *buff, |
6 | { |
- | |
7 | int retval; |
- | |
8 | int d0; |
- | |
9 | __asm__ __volatile__( |
- | |
10 | "pushl $0 \n\t" |
- | |
11 | "pushl $0 \n\t" |
- | |
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 $0 \n\t" |
- | |
18 | "movl %%esp, %%ebx \n\t" |
- | |
19 | "mov $70, %%eax \n\t" |
- | |
20 | "int $0x40 \n\t" |
10 | size_t offset, size_t count, size_t *reads) |
21 | "testl %%esi, %%esi \n\t" |
- | |
22 | "jz 1f \n\t" |
- | |
23 | "movl %%ebx, (%%esi) \n\t" |
- | |
24 | "1:" |
11 | { |
25 | "addl $28, %%esp \n\t" |
- | |
26 | :"=a" (retval) |
- | |
27 | :"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(reads)); |
12 | ksys_file_status_t st = _ksys_file_read(path, offset, count, buff); |
28 | return retval == 6 ? 0 : retval; |
13 | *reads = st.rw_bytes; |
29 | }; |
- |