From d3e724b9087207fd6c24a1fcd4775d914d8cfc73 Mon Sep 17 00:00:00 2001 From: turbocat Date: Tue, 26 Apr 2022 07:57:42 +0000 Subject: [PATCH] ksys.h: - Added SF 68.1 and SF 68.14 wrappers - Added SLOT_STATE enum. git-svn-id: svn://kolibrios.org@9788 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../sources/newlib/libc/include/sys/ksys.h | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/contrib/sdk/sources/newlib/libc/include/sys/ksys.h b/contrib/sdk/sources/newlib/libc/include/sys/ksys.h index 0601b19ce6..c39a9d9f6c 100644 --- a/contrib/sdk/sources/newlib/libc/include/sys/ksys.h +++ b/contrib/sdk/sources/newlib/libc/include/sys/ksys.h @@ -1,3 +1,6 @@ +#ifndef _KSYS_H_ +#define _KSYS_H_ + /* Copyright (C) KolibriOS team 2004-2021. All rights reserved. */ /* Distributed under terms of the GNU General Public License */ @@ -16,9 +19,6 @@ * They are for compatibility... Better not to use them. */ -#ifndef _KSYS_H_ -#define _KSYS_H_ - #include #include @@ -193,6 +193,14 @@ typedef struct { char path[64]; } ksys_dir_key_t; +typedef union { + uint8_t raw_data[24]; + struct { + uint32_t id; + uint8_t data[20]; + }; +} ksys_signal_info_t; + #pragma pack(pop) typedef rgb_t ksys_bitmap_t; @@ -354,6 +362,18 @@ KOSAPI void _ksys_delete_button(uint32_t id) /*============ Function 9 - information on execution thread. ===========*/ +#define KSYS_THIS_SLOT -1 + +enum KSYS_SLOT_STATES { + KSYS_SLOT_STATE_RUNNING = 0, + KSYS_SLOT_STATE_SUSPENDED = 1, + KSYS_SLOT_STATE_SUSPENDED_WAIT_EVENT = 2, + KSYS_SLOT_STATE_NORMAL_TERM = 3, + KSYS_SLOT_STATE_EXCEPT_TERM = 4, + KSYS_SLOT_STATE_WAIT_EVENT = 5, + KSYS_SLOT_STATE_FREE = 6 +}; + KOSAPI int _ksys_thread_info(ksys_thread_t* table, int slot) { int val; @@ -1080,6 +1100,13 @@ KOSAPI void _ksys_change_window(int new_x, int new_y, int new_w, int new_h) "int $0x40" ::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w), "S"(new_h)); } +/*===== Function 68, subfunction 1 - switch to the next thread of execution ====*/ + +KOSAPI void _ksys_thread_yield(void) +{ + asm_inline("int $0x40" :: "a"(68),"b"(1)); +} + /*======== Function 68, subfunction 12 - allocate memory block. ========*/ KOSAPI void* _ksys_alloc(size_t size) @@ -1104,6 +1131,13 @@ KOSAPI int _ksys_free(void* mem) return val; } +/*====== Function 68, subfunction 14 - Wait signal from other applications/drivers. =====*/ + +KOSAPI void _ksys_wait_signal(ksys_signal_info_t* signal) +{ + asm_inline("int $0x40" :: "a"(68),"b"(14),"c"(signal) : "memory"); +} + /*============= Function 68, subfunction 16 - load driver. =============*/ KOSAPI ksys_drv_hand_t _ksys_load_driver(char* driver_name)