Subversion Repositories Kolibri OS

Rev

Rev 5141 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5141 Rev 5190
1
#ifndef __KOS_32_SYS_H__
1
#ifndef __KOS_32_SYS_H__
2
#define __KOS_32_SYS_H__
2
#define __KOS_32_SYS_H__
3
 
3
 
4
#include 
4
#include 
5
#include 
5
#include 
6
#include 
6
#include 
7
 
7
 
8
#ifdef __cplusplus
8
#ifdef __cplusplus
9
extern "C" {
9
extern "C" {
10
#endif
10
#endif
11
 
11
 
12
//#ifdef CONFIG_DEBUF
12
//#ifdef CONFIG_DEBUF
13
//  #define DBG(format,...) printf(format,##__VA_ARGS__)
13
//  #define DBG(format,...) printf(format,##__VA_ARGS__)
14
//#else
14
//#else
15
//  #define DBG(format,...)
15
//  #define DBG(format,...)
16
//#endif
16
//#endif
17
 
17
 
18
#define TYPE_3_BORDER_WIDTH 5
18
#define TYPE_3_BORDER_WIDTH 5
19
 
19
 
20
typedef  unsigned int color_t;
20
typedef  unsigned int color_t;
21
 
21
 
22
typedef union __attribute__((packed))
22
typedef union __attribute__((packed))
23
{
23
{
24
    uint32_t val;
24
    uint32_t val;
25
    struct
25
    struct
26
    {
26
    {
27
        short  x;
27
        short  x;
28
        short  y;
28
        short  y;
29
    };
29
    };
30
}pos_t;
30
}pos_t;
31
 
31
 
32
typedef union __attribute__((packed))
32
typedef union __attribute__((packed))
33
{
33
{
34
    uint32_t val;
34
    uint32_t val;
35
    struct
35
    struct
36
    {
36
    {
37
        uint8_t   state;
37
        uint8_t   state;
38
        uint8_t   code;
38
        uint8_t   code;
39
        uint16_t  ctrl_key;
39
        uint16_t  ctrl_key;
40
    };
40
    };
41
}oskey_t;
41
}oskey_t;
42
 
42
 
43
typedef struct
43
typedef struct
44
{
44
{
45
  unsigned      handle;
45
  unsigned      handle;
46
  unsigned      io_code;
46
  unsigned      io_code;
47
  void          *input;
47
  void          *input;
48
  int           inp_size;
48
  int           inp_size;
49
  void          *output;
49
  void          *output;
50
  int           out_size;
50
  int           out_size;
51
}ioctl_t;
51
}ioctl_t;
52
 
52
 
53
 
53
 
54
static inline
54
static inline
55
void DefineButton(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color)
55
void DefineButton(uint32_t x_w, uint32_t y_h, uint32_t id, uint32_t color)
56
{
56
{
57
    __asm__ __volatile__(
57
    __asm__ __volatile__(
58
    "int $0x40"
58
    "int $0x40"
59
    ::"a"(8),
59
    ::"a"(8),
60
      "b"(x_w),
60
      "b"(x_w),
61
      "c"(y_h),
61
      "c"(y_h),
62
      "d"(id),
62
      "d"(id),
63
      "S"(color));
63
      "S"(color));
64
 
64
 
65
 
65
 
66
};
66
};
67
 
67
 
68
static inline
68
static inline
69
uint32_t get_skin_height(void)
69
uint32_t get_skin_height(void)
70
{
70
{
71
    uint32_t height;
71
    uint32_t height;
72
 
72
 
73
    __asm__ __volatile__(
73
    __asm__ __volatile__(
74
    "int $0x40 \n\t"
74
    "int $0x40 \n\t"
75
    :"=a"(height)
75
    :"=a"(height)
76
    :"a"(48),"b"(4));
76
    :"a"(48),"b"(4));
77
    return height;
77
    return height;
78
};
78
};
79
static inline uint32_t GetSkinHeight(void) __attribute__ ((alias ("get_skin_height")));
79
static inline uint32_t GetSkinHeight(void) __attribute__ ((alias ("get_skin_height")));
80
 
80
 
81
static inline
81
static inline
82
void BeginDraw(void)
82
void BeginDraw(void)
83
{
83
{
84
    __asm__ __volatile__(
84
    __asm__ __volatile__(
85
    "int $0x40" ::"a"(12),"b"(1));
85
    "int $0x40" ::"a"(12),"b"(1));
86
};
86
};
87
 
87
 
88
static inline
88
static inline
89
void EndDraw(void)
89
void EndDraw(void)
90
{
90
{
91
    __asm__ __volatile__(
91
    __asm__ __volatile__(
92
    "int $0x40" ::"a"(12),"b"(2));
92
    "int $0x40" ::"a"(12),"b"(2));
93
};
93
};
94
 
94
 
95
static inline void DrawWindow(int x, int y, int w, int h, const char *name,
95
static inline void DrawWindow(int x, int y, int w, int h, const char *name,
96
                       color_t workcolor, uint32_t style)
96
                       color_t workcolor, uint32_t style)
97
{
97
{
98
 
98
 
99
    __asm__ __volatile__(
99
    __asm__ __volatile__(
100
    "int $0x40"
100
    "int $0x40"
101
    ::"a"(0),
101
    ::"a"(0),
102
     "b"((x << 16) | ((w-1) & 0xFFFF)),
102
     "b"((x << 16) | ((w-1) & 0xFFFF)),
103
     "c"((y << 16) | ((h-1) & 0xFFFF)),
103
     "c"((y << 16) | ((h-1) & 0xFFFF)),
104
     "d"((style << 24) | (workcolor & 0xFFFFFF)),
104
     "d"((style << 24) | (workcolor & 0xFFFFFF)),
105
     "D"(name),
105
     "D"(name),
106
     "S"(0) : "memory");
106
     "S"(0) : "memory");
107
};
107
};
108
 
108
 
109
#define POS_SCREEN 0
109
#define POS_SCREEN 0
110
#define POS_WINDOW 1
110
#define POS_WINDOW 1
111
 
111
 
112
static inline
112
static inline
113
pos_t get_mouse_pos(int origin)
113
pos_t get_mouse_pos(int origin)
114
{
114
{
115
    pos_t val;
115
    pos_t val;
116
 
116
 
117
    __asm__ __volatile__(
117
    __asm__ __volatile__(
118
    "int $0x40 \n\t"
118
    "int $0x40 \n\t"
119
    "rol $16, %%eax"
119
    "rol $16, %%eax"
120
    :"=a"(val)
120
    :"=a"(val)
121
    :"a"(37),"b"(origin));
121
    :"a"(37),"b"(origin));
122
    return val;
122
    return val;
123
}
123
}
124
static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos")));
124
static inline pos_t GetMousePos(int origin) __attribute__ ((alias ("get_mouse_pos")));
125
 
125
 
126
static inline
126
static inline
127
uint32_t get_mouse_buttons(void)
127
uint32_t get_mouse_buttons(void)
128
{
128
{
129
    uint32_t val;
129
    uint32_t val;
130
 
130
 
131
    __asm__ __volatile__(
131
    __asm__ __volatile__(
132
    "int $0x40"
132
    "int $0x40"
133
    :"=a"(val)
133
    :"=a"(val)
134
    :"a"(37),"b"(2));
134
    :"a"(37),"b"(2));
135
    return val;
135
    return val;
136
};
136
};
137
static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons")));
137
static inline uint32_t GetMouseButtons(void) __attribute__ ((alias ("get_mouse_buttons")));
138
 
138
 
139
static inline
139
static inline
140
uint32_t get_mouse_wheels(void)
140
uint32_t get_mouse_wheels(void)
141
{
141
{
142
    uint32_t val;
142
    uint32_t val;
143
 
143
 
144
    __asm__ __volatile__(
144
    __asm__ __volatile__(
145
    "int $0x40 \n\t"
145
    "int $0x40 \n\t"
146
    :"=a"(val)
146
    :"=a"(val)
147
    :"a"(37),"b"(7));
147
    :"a"(37),"b"(7));
148
    return val;
148
    return val;
149
};
149
};
150
static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels")));
150
static inline uint32_t GetMouseWheels(void) __attribute__ ((alias ("get_mouse_wheels")));
151
 
151
 
152
static inline
152
static inline
153
uint32_t wait_for_event(uint32_t time)
153
uint32_t wait_for_event(uint32_t time)
154
{
154
{
155
    uint32_t val;
155
    uint32_t val;
156
    __asm__ __volatile__(
156
    __asm__ __volatile__(
157
    "int $0x40"
157
    "int $0x40"
158
    :"=a"(val)
158
    :"=a"(val)
159
    :"a"(23), "b"(time));
159
    :"a"(23), "b"(time));
160
    return val;
160
    return val;
161
};
161
};
162
 
162
 
163
static inline uint32_t check_os_event()
163
static inline uint32_t check_os_event()
164
{
164
{
165
    uint32_t val;
165
    uint32_t val;
166
    __asm__ __volatile__(
166
    __asm__ __volatile__(
167
    "int $0x40"
167
    "int $0x40"
168
    :"=a"(val)
168
    :"=a"(val)
169
    :"a"(11));
169
    :"a"(11));
170
    return val;
170
    return val;
171
};
171
};
172
 
172
 
173
static inline uint32_t get_os_event()
173
static inline uint32_t get_os_event()
174
{
174
{
175
    uint32_t val;
175
    uint32_t val;
176
    __asm__ __volatile__(
176
    __asm__ __volatile__(
177
    "int $0x40"
177
    "int $0x40"
178
    :"=a"(val)
178
    :"=a"(val)
179
    :"a"(10));
179
    :"a"(10));
180
    return val;
180
    return val;
181
};
181
};
182
static inline uint32_t GetOsEvent(void) __attribute__ ((alias ("get_os_event")));
182
static inline uint32_t GetOsEvent(void) __attribute__ ((alias ("get_os_event")));
183
 
183
 
184
static inline
184
static inline
185
uint32_t get_tick_count(void)
185
uint32_t get_tick_count(void)
186
{
186
{
187
    uint32_t val;
187
    uint32_t val;
188
    __asm__ __volatile__(
188
    __asm__ __volatile__(
189
    "int $0x40"
189
    "int $0x40"
190
    :"=a"(val)
190
    :"=a"(val)
191
    :"a"(26),"b"(9));
191
    :"a"(26),"b"(9));
192
    return val;
192
    return val;
193
};
193
};
194
 
194
 
195
static inline
195
static inline
196
oskey_t get_key(void)
196
oskey_t get_key(void)
197
{
197
{
198
    oskey_t val;
198
    oskey_t val;
199
    __asm__ __volatile__(
199
    __asm__ __volatile__(
200
    "int $0x40"
200
    "int $0x40"
201
    :"=a"(val)
201
    :"=a"(val)
202
    :"a"(2));
202
    :"a"(2));
203
    return val;
203
    return val;
204
}
204
}
205
 
205
 
206
static inline
206
static inline
207
uint32_t get_os_button()
207
uint32_t get_os_button()
208
{
208
{
209
    uint32_t val;
209
    uint32_t val;
210
    __asm__ __volatile__(
210
    __asm__ __volatile__(
211
    "int $0x40"
211
    "int $0x40"
212
    :"=a"(val)
212
    :"=a"(val)
213
    :"a"(17));
213
    :"a"(17));
214
    return val>>8;
214
    return val>>8;
215
};
215
};
216
 
216
 
217
static inline uint32_t get_service(char *name)
217
static inline uint32_t get_service(char *name)
218
{
218
{
219
    uint32_t retval = 0;
219
    uint32_t retval = 0;
220
    __asm__ __volatile__(
220
    __asm__ __volatile__(
221
    "int $0x40"
221
    "int $0x40"
222
    :"=a"(retval)
222
    :"=a"(retval)
223
    :"a"(68),"b"(16),"c"(name)
223
    :"a"(68),"b"(16),"c"(name)
224
    :"memory");
224
    :"memory");
225
 
225
 
226
    return retval;
226
    return retval;
227
};
227
};
228
 
228
 
229
static inline int call_service(ioctl_t *io)
229
static inline int call_service(ioctl_t *io)
230
{
230
{
231
    int retval;
231
    int retval;
232
 
232
 
233
    __asm__ __volatile__(
233
    __asm__ __volatile__(
234
    "int $0x40"
234
    "int $0x40"
235
    :"=a"(retval)
235
    :"=a"(retval)
236
    :"a"(68),"b"(17),"c"(io)
236
    :"a"(68),"b"(17),"c"(io)
237
    :"memory","cc");
237
    :"memory","cc");
238
 
238
 
239
    return retval;
239
    return retval;
240
};
240
};
241
 
241
 
242
 
242
 
243
static inline
243
static inline
244
void draw_line(int xs, int ys, int xe, int ye, color_t color)
244
void draw_line(int xs, int ys, int xe, int ye, color_t color)
245
{
245
{
246
    __asm__ __volatile__(
246
    __asm__ __volatile__(
247
    "int $0x40"
247
    "int $0x40"
248
    ::"a"(38), "d"(color),
248
    ::"a"(38), "d"(color),
249
      "b"((xs << 16) | xe),
249
      "b"((xs << 16) | xe),
250
      "c"((ys << 16) | ye));
250
      "c"((ys << 16) | ye));
251
}
251
}
252
 
252
 
253
 
253
 
254
 
254
 
255
static inline
255
static inline
256
void draw_bar(int x, int y, int w, int h, color_t color)
256
void draw_bar(int x, int y, int w, int h, color_t color)
257
{
257
{
258
    __asm__ __volatile__(
258
    __asm__ __volatile__(
259
    "int $0x40"
259
    "int $0x40"
260
    ::"a"(13), "d"(color),
260
    ::"a"(13), "d"(color),
261
      "b"((x << 16) | w),
261
      "b"((x << 16) | w),
262
      "c"((y << 16) | h));
262
      "c"((y << 16) | h));
263
}
263
}
264
 
264
 
265
static inline
265
static inline
266
void draw_bitmap(void *bitmap, int x, int y, int w, int h)
266
void draw_bitmap(void *bitmap, int x, int y, int w, int h)
267
{
267
{
268
    __asm__ __volatile__(
268
    __asm__ __volatile__(
269
    "int $0x40"
269
    "int $0x40"
270
    ::"a"(7), "b"(bitmap),
270
    ::"a"(7), "b"(bitmap),
271
      "c"((w << 16) | h),
271
      "c"((w << 16) | h),
272
      "d"((x << 16) | y));
272
      "d"((x << 16) | y));
273
}
273
}
274
 
274
 
275
static inline
275
static inline
276
void draw_text_sys(const char *text, int x, int y, int len, color_t color)
276
void draw_text_sys(const char *text, int x, int y, int len, color_t color)
277
{
277
{
278
    __asm__ __volatile__(
278
    __asm__ __volatile__(
279
    "int $0x40"
279
    "int $0x40"
280
    ::"a"(4),"d"(text),
280
    ::"a"(4),"d"(text),
281
      "b"((x << 16) | y),
281
      "b"((x << 16) | y),
282
      "S"(len),"c"(color)
282
      "S"(len),"c"(color)
283
     :"memory");
283
     :"memory");
284
}
284
}
285
 
285
 
286
static inline void yield(void)
286
static inline void yield(void)
287
{
287
{
288
    __asm__ __volatile__(
288
    __asm__ __volatile__(
289
    "int $0x40"
289
    "int $0x40"
290
    ::"a"(68), "b"(1));
290
    ::"a"(68), "b"(1));
291
};
291
};
292
 
292
 
293
static inline void delay(uint32_t time)
293
static inline void delay(uint32_t time)
294
{
294
{
295
    __asm__ __volatile__(
295
    __asm__ __volatile__(
296
    "int $0x40"
296
    "int $0x40"
297
    ::"a"(5), "b"(time)
297
    ::"a"(5), "b"(time)
298
    :"memory");
298
    :"memory");
299
};
299
};
300
 
300
 
301
static inline
301
static inline
302
void *user_alloc(size_t size)
302
void *user_alloc(size_t size)
303
{
303
{
304
    void  *val;
304
    void  *val;
305
    __asm__ __volatile__(
305
    __asm__ __volatile__(
306
    "int $0x40"
306
    "int $0x40"
307
    :"=a"(val)
307
    :"=a"(val)
308
    :"a"(68),"b"(12),"c"(size));
308
    :"a"(68),"b"(12),"c"(size));
309
    return val;
309
    return val;
310
}
310
}
311
static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc")));
311
static inline void *UserAlloc(size_t size) __attribute__ ((alias ("user_alloc")));
312
 
312
 
313
static inline
313
static inline
314
int user_free(void *mem)
314
int user_free(void *mem)
315
{
315
{
316
    int  val;
316
    int  val;
317
    __asm__ __volatile__(
317
    __asm__ __volatile__(
318
    "int $0x40"
318
    "int $0x40"
319
    :"=a"(val)
319
    :"=a"(val)
320
    :"a"(68),"b"(13),"c"(mem));
320
    :"a"(68),"b"(13),"c"(mem));
321
    return val;
321
    return val;
322
}
322
}
323
static inline int UserFree(void *mem) __attribute__ ((alias ("user_free")));
323
static inline int UserFree(void *mem) __attribute__ ((alias ("user_free")));
324
 
324
 
325
static inline
325
static inline
326
int *user_unmap(void *base, size_t offset, size_t size)
326
int *user_unmap(void *base, size_t offset, size_t size)
327
{
327
{
328
    int  *val;
328
    int  *val;
329
    __asm__ __volatile__(
329
    __asm__ __volatile__(
330
    "int $0x40"
330
    "int $0x40"
331
    :"=a"(val)
331
    :"=a"(val)
332
    :"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size));
332
    :"a"(68),"b"(26),"c"(base),"d"(offset),"S"(size));
333
    return val;
333
    return val;
334
};
334
};
335
static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap")));
335
static inline int *UserUnmap(void *base, size_t offset, size_t size) __attribute__ ((alias ("user_unmap")));
336
 
336
 
337
typedef union
337
typedef union
338
{
338
{
339
    struct
339
    struct
340
    {
340
    {
341
        void   *data;
341
        void   *data;
342
        size_t  size;
342
        size_t  size;
343
    };
343
    };
344
    unsigned long long raw;
344
    unsigned long long raw;
345
}ufile_t;
345
}ufile_t;
346
 
346
 
347
 
347
 
348
static inline ufile_t load_file(const char *path)
348
static inline ufile_t load_file(const char *path)
349
{
349
{
350
    ufile_t uf;
350
    ufile_t uf;
351
 
351
 
352
    __asm__ __volatile__ (
352
    __asm__ __volatile__ (
353
    "int $0x40"
353
    "int $0x40"
354
    :"=A"(uf.raw)
354
    :"=A"(uf.raw)
355
    :"a" (68), "b"(27),"c"(path));
355
    :"a" (68), "b"(27),"c"(path));
356
 
356
 
357
    return uf;
357
    return uf;
358
};
358
};
359
static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file")));
359
static inline ufile_t LoadFile(const char *path) __attribute__ ((alias ("load_file")));
360
 
360
 
361
static inline int GetScreenSize()
361
static inline int GetScreenSize()
362
{
362
{
363
    int retval;
363
    int retval;
364
 
364
 
365
    __asm__ __volatile__(
365
    __asm__ __volatile__(
366
    "int $0x40"
366
    "int $0x40"
367
    :"=a"(retval)
367
    :"=a"(retval)
368
    :"a"(61), "b"(1));
368
    :"a"(61), "b"(1));
369
    return retval;
369
    return retval;
370
}
370
}
371
 
371
 
372
static inline
372
static inline
373
uint32_t  load_cursor(void *path, uint32_t flags)
373
uint32_t  load_cursor(void *path, uint32_t flags)
374
{
374
{
375
    uint32_t  val;
375
    uint32_t  val;
376
    __asm__ __volatile__(
376
    __asm__ __volatile__(
377
    "int $0x40"
377
    "int $0x40"
378
    :"=a"(val)
378
    :"=a"(val)
379
    :"a"(37), "b"(4), "c"(path), "d"(flags));
379
    :"a"(37), "b"(4), "c"(path), "d"(flags));
380
    return val;
380
    return val;
381
}
381
}
382
static inline
382
static inline
383
uint32_t  LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor")));
383
uint32_t  LoadCursor(void *path, uint32_t flags) __attribute__ ((alias ("load_cursor")));
384
 
384
 
385
static inline
385
static inline
386
uint32_t  set_cursor(uint32_t  cursor)
386
uint32_t  set_cursor(uint32_t  cursor)
387
{
387
{
388
    uint32_t  old;
388
    uint32_t  old;
389
    __asm__ __volatile__(
389
    __asm__ __volatile__(
390
    "int $0x40"
390
    "int $0x40"
391
    :"=a"(old)
391
    :"=a"(old)
392
    :"a"(37), "b"(5), "c"(cursor));
392
    :"a"(37), "b"(5), "c"(cursor));
393
    return old;
393
    return old;
394
};
394
};
395
static inline uint32_t SetCursor(uint32_t  cursor) __attribute__ ((alias ("set_cursor")));
395
static inline uint32_t SetCursor(uint32_t  cursor) __attribute__ ((alias ("set_cursor")));
396
 
396
 
397
static inline
397
static inline
398
int destroy_cursor(uint32_t cursor)
398
int destroy_cursor(uint32_t cursor)
399
{
399
{
400
    int ret;
400
    int ret;
401
    __asm__ __volatile__(
401
    __asm__ __volatile__(
402
    "int $0x40"
402
    "int $0x40"
403
    :"=a"(ret)
403
    :"=a"(ret)
404
    :"a"(37), "b"(6), "c"(cursor)
404
    :"a"(37), "b"(6), "c"(cursor)
405
    :"memory");
405
    :"memory");
406
    return ret;
406
    return ret;
407
};
407
};
408
static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor")));
408
static inline int DestroyCursor(uint32_t cursor) __attribute__ ((alias ("destroy_cursor")));
409
 
409
 
410
static inline void get_proc_info(char *info)
410
static inline void get_proc_info(char *info)
411
{
411
{
412
    __asm__ __volatile__(
412
    __asm__ __volatile__(
413
    "int $0x40"
413
    "int $0x40"
414
    :
414
    :
415
    :"a"(9), "b"(info), "c"(-1));
415
    :"a"(9), "b"(info), "c"(-1));
416
};
416
};
417
static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info")));
417
static inline void GetProcInfo(char *info) __attribute__ ((alias ("get_proc_info")));
418
 
418
 
419
static inline
419
static inline
420
void* user_realloc(void *mem, size_t size)
420
void* user_realloc(void *mem, size_t size)
421
{
421
{
422
    void *val;
422
    void *val;
423
    __asm__ __volatile__(
423
    __asm__ __volatile__(
424
    "int $0x40"
424
    "int $0x40"
425
    :"=a"(val)
425
    :"=a"(val)
426
    :"a"(68),"b"(20),"c"(size),"d"(mem)
426
    :"a"(68),"b"(20),"c"(size),"d"(mem)
427
    :"memory");
427
    :"memory");
428
 
428
 
429
    return val;
429
    return val;
430
};
430
};
431
static inline void* UserRrealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc")));
431
static inline void* UserRrealloc(void *mem, size_t size) __attribute__ ((alias ("user_realloc")));
432
 
432
 
433
void *get_resource(void *data, uint32_t id);
433
void *get_resource(void *data, uint32_t id);
434
 
434
 
435
struct blit_call
435
struct blit_call
436
{
436
{
437
    int dstx;
437
    int dstx;
438
    int dsty;
438
    int dsty;
439
    int w;
439
    int w;
440
    int h;
440
    int h;
441
 
441
 
442
    int srcx;
442
    int srcx;
443
    int srcy;
443
    int srcy;
444
    int srcw;
444
    int srcw;
445
    int srch;
445
    int srch;
446
 
446
 
447
    void *bitmap;
447
    void *bitmap;
448
    int   stride;
448
    int   stride;
449
};
449
};
450
 
450
 
451
static inline void Blit(void *bitmap, int dst_x, int dst_y,
451
static inline void Blit(void *bitmap, int dst_x, int dst_y,
452
                        int src_x, int src_y, int w, int h,
452
                        int src_x, int src_y, int w, int h,
453
                        int src_w, int src_h, int stride)
453
                        int src_w, int src_h, int stride)
454
{
454
{
455
    volatile struct blit_call bc;
455
    volatile struct blit_call bc;
456
 
456
 
457
    bc.dstx = dst_x;
457
    bc.dstx = dst_x;
458
    bc.dsty = dst_y;
458
    bc.dsty = dst_y;
459
    bc.w    = w;
459
    bc.w    = w;
460
    bc.h    = h;
460
    bc.h    = h;
461
    bc.srcx = src_x;
461
    bc.srcx = src_x;
462
    bc.srcy = src_y;
462
    bc.srcy = src_y;
463
    bc.srcw = src_w;
463
    bc.srcw = src_w;
464
    bc.srch = src_h;
464
    bc.srch = src_h;
465
    bc.stride = stride;
465
    bc.stride = stride;
466
    bc.bitmap = bitmap;
466
    bc.bitmap = bitmap;
467
 
467
 
468
    __asm__ __volatile__(
468
    __asm__ __volatile__(
469
    "int $0x40"
469
    "int $0x40"
470
    ::"a"(73),"b"(0),"c"(&bc.dstx));
470
    ::"a"(73),"b"(0),"c"(&bc.dstx));
471
};
471
};
-
 
472
 
-
 
473
void* load_library(const char *name);
-
 
474
 
-
 
475
void* get_proc_address(void *handle, const char *proc_name);
-
 
476
 
-
 
477
void enumerate_libraries(int (*callback)(void *handle, const char* name,
-
 
478
                                         uint32_t base, uint32_t size, void *user_data),
-
 
479
                         void *user_data);
472
 
480
 
473
#ifdef __cplusplus
481
#ifdef __cplusplus
474
}
482
}
475
#endif
483
#endif
476
 
484
 
477
 
485
 
478
#endif
486
#endif