Subversion Repositories Kolibri OS

Rev

Rev 9827 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9827 Rev 9833
Line 1... Line 1...
1
#ifndef __SYSCALL_H__
1
#ifndef __SYSCALL_H__
2
#define __SYSCALL_H__
2
#define __SYSCALL_H__
Line 3... Line 3...
3
 
3
 
Line -... Line 4...
-
 
4
#include 
-
 
5
 
-
 
6
#define ASSERT_CONCAT_(a, b) a##b
-
 
7
#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
4
#include 
8
#define STATIC_ASSERT(e) enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(e)) }
5
 
9
 
Line 6... Line 10...
6
typedef u32 addr_t;
10
typedef u32 addr_t;
Line 7... Line 11...
7
typedef u32 count_t;
11
typedef u32 count_t;
8
 
-
 
9
#pragma pack(push, 1)
12
 
10
 
13
#pragma pack(push, 1)
11
typedef struct
14
 
12
{
15
typedef struct {
13
  int width;
16
    int width;
Line 14... Line 17...
14
  int height;
17
    int height;
15
  int bpp;
-
 
16
  int freq;
18
    int bpp;
17
}videomode_t;
19
    int freq;
18
 
20
} videomode_t;
19
struct kos32_pdev
21
 
20
{
22
struct kos32_pdev {
21
    struct kos32_pdev *prev;
23
    struct kos32_pdev *prev;
22
    struct kos32_pdev *next;
24
    struct kos32_pdev *next;
23
    u32 devid;
25
    u32 devid;
24
    u32 class;
26
    u32 class;
Line -... Line 27...
-
 
27
    u8  devfn;
-
 
28
    u8  bus;
-
 
29
    u8  reserved[2];
-
 
30
    u32 owner;
-
 
31
};
-
 
32
 
-
 
33
// struct BOX in const.inc
-
 
34
struct kos_wnd_box {
-
 
35
    u32 left;
-
 
36
    u32 top;
-
 
37
    u32 width;
-
 
38
    u32 height;
-
 
39
};
-
 
40
 
-
 
41
// struct DBG_REGS in const.inc
-
 
42
struct kos_dbg_regs {
-
 
43
    u32 dr0;
-
 
44
    u32 dr1;
-
 
45
    u32 dr2;
-
 
46
    u32 dr3;
-
 
47
    u32 dr7;
-
 
48
};
-
 
49
 
-
 
50
struct kos_lhead {
-
 
51
  struct kos_lhead *prev;
-
 
52
  struct kos_lhead *next;
-
 
53
};
-
 
54
 
-
 
55
enum KOS_SLOT_STATES {
-
 
56
    KOS_SLOT_STATE_RUNNING = 0,
-
 
57
    KOS_SLOT_STATE_SUSPENDED = 1,
-
 
58
    KOS_SLOT_STATE_SUSPENDED_WAIT_EVENT = 2,
-
 
59
    KOS_SLOT_STATE_NORMAL_TERM = 3,
-
 
60
    KOS_SLOT_STATE_EXCEPT_TERM = 4,
-
 
61
    KOS_SLOT_STATE_WAIT_EVENT = 5,
-
 
62
    KOS_SLOT_STATE_FREE = 9
-
 
63
};
-
 
64
 
-
 
65
struct kos_appdata {
-
 
66
    char app_name[16];
-
 
67
    struct kos_lhead list;
-
 
68
    u32 process;
-
 
69
    u32 fpu_state;
-
 
70
    u32 exc_handler;
-
 
71
    u32 except_mask;
-
 
72
    u32 pl0_stack;
-
 
73
    u32 cursor;
-
 
74
    u32 fd_ev;
-
 
75
    u32 bk_ev;
-
 
76
    u32 fd_obj;
-
 
77
    u32 bk_obj;
-
 
78
    u32 saved_esp;
-
 
79
    u32 io_map[2];
-
 
80
    u32 dbg_state;
-
 
81
    char* cur_dir;
-
 
82
    u32 wait_timeout;
-
 
83
    u32 saved_esp0;
-
 
84
    u32 wait_begin;
-
 
85
    u32 wait_test;
-
 
86
    u32 wait_param;
-
 
87
    u32 tls_base;
-
 
88
    u32 event_mask;
-
 
89
    u32 tid;
-
 
90
    u32 draw_bgr_x;
-
 
91
    u32 draw_bgr_y;
-
 
92
    u8  state;
-
 
93
    u8  wnd_number;
-
 
94
    u16 __reserved1;
-
 
95
    u32 wnd_shape;
-
 
96
    u32 wnd_shape_scale;
-
 
97
    u32 __reserved2;
-
 
98
    u32 counter_sum;
-
 
99
    struct kos_wnd_box saved_box;
-
 
100
    u32 ipc_start;
-
 
101
    u32 ipc_size;
-
 
102
    u32 occurred_events;
-
 
103
    u32 debugger_slot;
-
 
104
    u32 terminate_protection;
-
 
105
    u8  keyboard_mode;
-
 
106
    u8  captionEncoding;
-
 
107
    u8  __reserved3[2];
-
 
108
    char* exec_params;
-
 
109
    u32 dbg_event_mem;
-
 
110
    struct kos_dbg_regs dbg_regs;
-
 
111
    char* wnd_caption;
-
 
112
    struct kos_wnd_box wnd_clientbox;
-
 
113
    u32 priority;
-
 
114
    struct kos_lhead in_schedule;
-
 
115
    u32 counter_add;
-
 
116
    u32 cpu_usage;
25
    u8  devfn;
117
    u32 __reserved4;
26
    u8  bus;
118
};
27
    u8  reserved[2];
119
 
28
    u32 owner;
120
#define KOS_APPDATA_SIZE 256
29
};
121
STATIC_ASSERT(sizeof(struct kos_appdata) == KOS_APPDATA_SIZE);
Line 131... Line 223...
131
 
223
 
132
u32 STDCALL PciWrite8 (u32 bus, u32 devfn, u32 reg,u8 val) __asm__("PciWrite8");
224
u32 STDCALL PciWrite8 (u32 bus, u32 devfn, u32 reg,u8 val) __asm__("PciWrite8");
133
u32 STDCALL PciWrite16(u32 bus, u32 devfn, u32 reg,u16 val)__asm__("PciWrite16");
225
u32 STDCALL PciWrite16(u32 bus, u32 devfn, u32 reg,u16 val)__asm__("PciWrite16");
Line -... Line 226...
-
 
226
u32 STDCALL PciWrite32(u32 bus, u32 devfn, u32 reg,u32 val)__asm__("PciWrite32");
-
 
227
 
134
u32 STDCALL PciWrite32(u32 bus, u32 devfn, u32 reg,u32 val)__asm__("PciWrite32");
228
struct kos_appdata* IMPORT GetCurrSlot(void) __asm__("GetCurrSlot");
135
 
229
 
Line 136... Line 230...
136
#define pciReadByte(tag, reg) \
230
#define pciReadByte(tag, reg) \
137
        PciRead8(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg))
231
        PciRead8(PCI_BUS_FROM_TAG(tag),PCI_DFN_FROM_TAG(tag),(reg))
Line 532... Line 626...
532
   return mem;
626
   return mem;
533
};
627
};
Line 534... Line 628...
534
 
628
 
Line 535... Line 629...
535
static inline int power_supply_is_system_supplied(void) { return -1; };
629
static inline int power_supply_is_system_supplied(void) { return -1; };
-
 
630
 
536
 
631
static inline int FS_Service(ksys70_t *k, int* err)
537
static inline int FS_Service(ksys70_t *k, int* err){
632
{
538
    int status;
633
    int status;
539
    __asm__ __volatile__(
634
    __asm__ __volatile__(
540
     "call *__imp__FS_Service"
635
     "call *__imp__FS_Service"