kolibri-libc:

- [KSYS]  added functions for working with drivers.
- [SAMPLES] added an example of working with the tmpdisk.sys driver
- Misc: fixed Makefiles


git-svn-id: svn://kolibrios.org@8699 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat
2021-04-28 00:18:12 +00:00
parent 819b3e8259
commit 35ba6d8562
4 changed files with 103 additions and 13 deletions
@@ -48,15 +48,6 @@ typedef union ksys_oskey_t{
};
}ksys_oskey_t;
typedef struct{
unsigned handle;
unsigned io_code;
unsigned *input;
int inp_size;
void *output;
int out_size;
}ksys_ioctl_t;
typedef struct{
void *data;
size_t size;
@@ -152,6 +143,17 @@ typedef struct {
void* func_ptr;
}ksys_coff_etable_t;
typedef void* ksys_drv_hand_t;
typedef struct{
ksys_drv_hand_t handler;
unsigned func_num;
void* in_data_ptr;
unsigned in_data_size;
void* out_data_ptr;
unsigned out_data_size;
}ksys_drv_ctl_t;
#pragma pack(pop)
enum KSYS_EVENTS {
@@ -999,6 +1001,33 @@ void _ksys_shm_close(char *shm_name)
);
}
/* Driver functions */
static inline
ksys_drv_hand_t _ksys_load_driver(char *driver_name)
{
ksys_drv_hand_t driver_h;
asm_inline(
"int $0x40"
:"=a"(driver_h)
:"a"(68), "b"(16), "c"(driver_name)
);
return driver_h;
}
static inline
unsigned _ksys_work_driver(ksys_drv_ctl_t *ioctl)
{
unsigned status;
asm_inline(
"int $0x40"
:"=a"(status)
:"a"(68), "b"(17), "c"(ioctl)
:"memory"
);
return status;
}
#ifdef __cplusplus
}
#endif