/drivers/ddk/io/create.c |
---|
0,0 → 1,22 |
int create_file(const char *path) |
{ |
int retval; |
__asm__ __volatile__ ( |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"movl %0, 1(%%esp) \n\t" |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"pushl $2 \n\t" |
"movl %%esp, %%ebx \n\t" |
"movl $70, %%eax \n\t" |
"int $0x40 \n\t" |
"addl $28, %%esp \n\t" |
:"=a" (retval) |
:"r" (path) |
:"ebx"); |
return retval; |
}; |
/drivers/ddk/io/finfo.c |
---|
0,0 → 1,81 |
#pragma pack(push, 1) |
typedef struct |
{ |
char sec; |
char min; |
char hour; |
char rsv; |
}detime_t; |
typedef struct |
{ |
char day; |
char month; |
short year; |
}dedate_t; |
typedef struct |
{ |
unsigned attr; |
unsigned flags; |
union |
{ |
detime_t ctime; |
unsigned cr_time; |
}; |
union |
{ |
dedate_t cdate; |
unsigned cr_date; |
}; |
union |
{ |
detime_t atime; |
unsigned acc_time; |
}; |
union |
{ |
dedate_t adate; |
unsigned acc_date; |
}; |
union |
{ |
detime_t mtime; |
unsigned mod_time; |
}; |
union |
{ |
dedate_t mdate; |
unsigned mod_date; |
}; |
unsigned size; |
unsigned size_high; |
} FILEINFO; |
#pragma pack(pop) |
int get_fileinfo(const char *path,FILEINFO *info) |
{ |
int retval; |
asm __volatile__ |
( |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"movl %0, 1(%%esp) \n\t" |
"pushl %%ebx \n\t" |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"pushl $5 \n\t" |
"movl %%esp, %%ebx \n\t" |
"movl $70, %%eax \n\t" |
"int $0x40 \n\t" |
"addl $28, %%esp \n\t" |
:"=a" (retval) |
:"r" (path), "b" (info) |
); |
return retval; |
}; |
/drivers/ddk/io/ssize.c |
---|
0,0 → 1,21 |
int set_file_size(const char *path, unsigned size) |
{ |
int retval; |
__asm__ __volatile__( |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"movl %0, 1(%%esp) \n\t" |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"pushl %%ebx \n\t" |
"push $4 \n\t" |
"movl %%esp, %%ebx \n\t" |
"movl $70, %%eax \n\t" |
"int $0x40 \n\t" |
"addl $28, %%esp \n\t" |
:"=a" (retval) |
:"a" (path), "b" (size)); |
return retval; |
}; |
/drivers/ddk/io/write.c |
---|
0,0 → 1,26 |
int write_file(const char *path,const void *buff, |
unsigned offset,unsigned count,unsigned *writes) |
{ |
int retval; |
__asm__ __volatile__( |
"pushl $0 \n\t" |
"pushl $0 \n\t" |
"movl %%eax, 1(%%esp) \n\t" |
"pushl %%ebx \n\t" |
"pushl %%edx \n\t" |
"pushl $0 \n\t" |
"pushl %%ecx \n\t" |
"pushl $3 \n\t" |
"movl %%esp, %%ebx \n\t" |
"mov $70, %%eax \n\t" |
"int $0x40 \n\t" |
"testl %%esi, %%esi \n\t" |
"jz 1f \n\t" |
"movl %%ebx, (%%esi) \n\t" |
"1:" |
"addl $28, %%esp \n\t" |
:"=a" (retval) |
:"a"(path),"b"(buff),"c"(offset),"d"(count),"S"(writes)); |
return retval; |
}; |