Rev 882 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 882 | Rev 1002 | ||
---|---|---|---|
1 | typedef struct |
1 | typedef struct |
2 | { |
2 | { |
3 | unsigned handle; |
3 | unsigned handle; |
4 | unsigned io_code; |
4 | unsigned io_code; |
5 | void *input; |
5 | void *input; |
6 | int inp_size; |
6 | int inp_size; |
7 | void *output; |
7 | void *output; |
8 | int out_size; |
8 | int out_size; |
9 | }ioctl_t; |
9 | }ioctl_t; |
10 | 10 | ||
11 | 11 | ||
12 | #define ERR_OK 0 |
12 | #define ERR_OK 0 |
13 | #define ERR_PARAM -1 |
13 | #define ERR_PARAM -1 |
14 | #define ERR_NOMEM -2 |
14 | #define ERR_NOMEM -2 |
15 | 15 | ||
16 | 16 | ||
17 | /////////////////////////////////////////////////////////////////////////////// |
17 | /////////////////////////////////////////////////////////////////////////////// |
18 | 18 | ||
19 | 19 | #ifdef KOLIBRI_PE |
|
- | 20 | #define LFB_BASE 0xDF000000 |
|
- | 21 | #else |
|
- | 22 | #define LFB_BASE 0xFE000000 |
|
- | 23 | #endif |
|
- | 24 | ||
- | 25 | ||
20 | void usleep(u32_t delay); |
26 | void usleep(u32_t delay); |
21 | 27 | ||
22 | static int __attribute__ ((always_inline)) |
28 | static int __attribute__ ((always_inline)) |
23 | abs (int i) |
29 | abs (int i) |
24 | { |
30 | { |
25 | return i < 0 ? -i : i; |
31 | return i < 0 ? -i : i; |
26 | }; |
32 | }; |
27 | 33 | ||
28 | 34 | ||
29 | extern inline u32_t get_service(char *name) |
35 | extern inline u32_t get_service(char *name) |
30 | { |
36 | { |
31 | u32_t retval; |
37 | u32_t retval; |
32 | asm("int $0x40" |
38 | asm("int $0x40" |
33 | :"=a"(retval) |
39 | :"=a"(retval) |
34 | :"a"(68),"b"(16),"c"(name)); |
40 | :"a"(68),"b"(16),"c"(name)); |
35 | 41 | ||
36 | return retval; |
42 | return retval; |
37 | }; |
43 | }; |
38 | 44 | ||
39 | extern inline u32_t load_service(char *name) |
45 | extern inline u32_t load_service(char *name) |
40 | { |
46 | { |
41 | u32_t retval; |
47 | u32_t retval; |
42 | asm("int $0x40" |
48 | asm("int $0x40" |
43 | :"=a"(retval) |
49 | :"=a"(retval) |
44 | :"a"(68),"b"(21),"c"(name)); |
50 | :"a"(68),"b"(21),"c"(name)); |
45 | 51 | ||
46 | return retval; |
52 | return retval; |
47 | }; |
53 | }; |
48 | 54 | ||
49 | extern inline int call_service(ioctl_t *io) |
55 | extern inline int call_service(ioctl_t *io) |
50 | { |
56 | { |
51 | int retval; |
57 | int retval; |
52 | 58 | ||
53 | asm("int $0x40" |
59 | asm("int $0x40" |
54 | :"=a"(retval) |
60 | :"=a"(retval) |
55 | :"a"(68),"b"(17),"c"(io) |
61 | :"a"(68),"b"(17),"c"(io) |
56 | :"memory"); |
62 | :"memory"); |
57 | 63 | ||
58 | return retval; |
64 | return retval; |
59 | }; |
65 | }; |
60 | 66 | ||
61 | extern inline void* UserAlloc(size_t size) |
67 | extern inline void* UserAlloc(size_t size) |
62 | { |
68 | { |
63 | void *retval; |
69 | void *retval; |
64 | 70 | ||
65 | asm("int $0x40" |
71 | asm("int $0x40" |
66 | :"=a"(retval) |
72 | :"=a"(retval) |
67 | :"a"(68),"b"(12),"c"(size) |
73 | :"a"(68),"b"(12),"c"(size) |
68 | :"memory"); |
74 | :"memory"); |
69 | return retval; |
75 | return retval; |
70 | } |
76 | } |
71 | 77 | ||
72 | extern inline void UserFree(void *mem) |
78 | extern inline void UserFree(void *mem) |
73 | { |
79 | { |
74 | __asm__ __volatile__( |
80 | __asm__ __volatile__( |
75 | "int $0x40" |
81 | "int $0x40" |
76 | ::"a"(68),"b"(13),"c"(mem) |
82 | ::"a"(68),"b"(13),"c"(mem) |
77 | :"memory"); |
83 | :"memory"); |
78 | } |
84 | } |
79 | 85 | ||
80 | extern inline int GetScreenSize() |
86 | extern inline int GetScreenSize() |
81 | { |
87 | { |
82 | int retval; |
88 | int retval; |
83 | 89 | ||
84 | __asm__ __volatile__( |
90 | __asm__ __volatile__( |
85 | "int $0x40" |
91 | "int $0x40" |
86 | :"=a"(retval) |
92 | :"=a"(retval) |
87 | :"a"(61), "b"(1)); |
93 | :"a"(61), "b"(1)); |
88 | return retval; |
94 | return retval; |
89 | } |
95 | } |
90 | 96 | ||
91 | extern inline int GetScreenBpp() |
97 | extern inline int GetScreenBpp() |
92 | { |
98 | { |
93 | int retval; |
99 | int retval; |
94 | 100 | ||
95 | __asm__ __volatile__( |
101 | __asm__ __volatile__( |
96 | "int $0x40" |
102 | "int $0x40" |
97 | :"=a"(retval) |
103 | :"=a"(retval) |
98 | :"a"(61), "b"(2)); |
104 | :"a"(61), "b"(2)); |
99 | return retval; |
105 | return retval; |
100 | } |
106 | } |
101 | 107 | ||
102 | extern inline int GetScreenPitch() |
108 | extern inline int GetScreenPitch() |
103 | { |
109 | { |
104 | int retval; |
110 | int retval; |
105 | 111 | ||
106 | __asm__ __volatile__( |
112 | __asm__ __volatile__( |
107 | "int $0x40" |
113 | "int $0x40" |
108 | :"=a"(retval) |
114 | :"=a"(retval) |
109 | :"a"(61), "b"(3)); |
115 | :"a"(61), "b"(3)); |
110 | return retval; |
116 | return retval; |
111 | } |
117 | } |
112 | 118 | ||
113 | extern inline int test_mmx() |
119 | extern inline int test_mmx() |
114 | { |
120 | { |
115 | int retval; |
121 | int retval; |
116 | 122 | ||
117 | __asm__ __volatile__( |
123 | __asm__ __volatile__( |
118 | "cpuid\n\t" |
124 | "cpuid\n\t" |
119 | "testl $23, %%edx\n\t" |
125 | "testl $23, %%edx\n\t" |
120 | "setnzb %%al\n\t" |
126 | "setnzb %%al\n\t" |
121 | "movzx %%al, %%eax" |
127 | "movzx %%al, %%eax" |
122 | :"=a"(retval) |
128 | :"=a"(retval) |
123 | :"a"(0) |
129 | :"a"(0) |
124 | :"ebx","ecx","edx"); |
130 | :"ebx","ecx","edx"); |
125 | 131 | ||
126 | return retval; |
132 | return retval; |
127 | }> |
133 | }> |