Rev 1434 | Rev 1616 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1434 | Rev 1613 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | #define OS_BASE 0x80000000 |
5 | #define OS_BASE 0x80000000 |
Line 6... | Line 6... | ||
6 | 6 | ||
7 | typedef struct |
7 | typedef struct |
- | 8 | { |
|
- | 9 | u32_t code; |
|
- | 10 | u32_t data[5]; |
|
- | 11 | }kevent_t; |
|
- | 12 | ||
- | 13 | typedef struct |
|
8 | { |
14 | { |
9 | u32_t handle; |
15 | u32_t handle; |
10 | u32_t io_code; |
16 | u32_t io_code; |
11 | void *input; |
17 | void *input; |
12 | int inp_size; |
18 | int inp_size; |
Line 49... | Line 55... | ||
49 | void* STDCALL KernelFree(void *mem)__asm__("KernelFree"); |
55 | void* STDCALL KernelFree(void *mem)__asm__("KernelFree"); |
50 | void* STDCALL UserAlloc(size_t size)__asm__("UserAlloc"); |
56 | void* STDCALL UserAlloc(size_t size)__asm__("UserAlloc"); |
51 | int STDCALL UserFree(void *mem)__asm__("UserFree"); |
57 | int STDCALL UserFree(void *mem)__asm__("UserFree"); |
52 | 58 | ||
Line 53... | Line 59... | ||
53 | void* STDCALL GetDisplay()__asm__("GetDisplay"); |
59 | void* STDCALL GetDisplay(void)__asm__("GetDisplay"); |
Line 54... | Line 60... | ||
54 | 60 | ||
55 | 61 | ||
Line 56... | Line 62... | ||
56 | addr_t STDCALL AllocPage()__asm__("AllocPage"); |
62 | addr_t STDCALL AllocPage(void)__asm__("AllocPage"); |
Line 57... | Line 63... | ||
57 | addr_t STDCALL AllocPages(count_t count)__asm__("AllocPages"); |
63 | addr_t STDCALL AllocPages(count_t count)__asm__("AllocPages"); |
Line 106... | Line 112... | ||
106 | int dbgprintf(const char* format, ...); |
112 | int dbgprintf(const char* format, ...); |
107 | 113 | ||
Line 108... | Line 114... | ||
108 | /////////////////////////////////////////////////////////////////////////////// |
114 | /////////////////////////////////////////////////////////////////////////////// |
Line -... | Line 115... | ||
- | 115 | ||
- | 116 | ||
- | 117 | static inline u32_t CreateEvent(kevent_t *ev, u32_t flags, u32_t *uid) |
|
- | 118 | { |
|
- | 119 | u32_t handle; |
|
- | 120 | u32_t euid; |
|
- | 121 | ||
- | 122 | __asm__ __volatile__ ( |
|
- | 123 | "call *__imp__CreateEvent" |
|
- | 124 | :"=a"(handle),"=d"(euid) |
|
- | 125 | :"S" (ev), "c"(flags)); |
|
- | 126 | __asm__ __volatile__ ("":::"ebx","ecx", "esi", "edi"); |
|
- | 127 | ||
- | 128 | if(uid) *uid = euid; |
|
- | 129 | ||
- | 130 | return handle; |
|
- | 131 | }; |
|
109 | 132 | ||
110 | static inline int GetScreenSize() |
133 | static inline int GetScreenSize(void) |
111 | { |
134 | { |
Line 112... | Line 135... | ||
112 | int retval; |
135 | int retval; |
113 | 136 | ||
114 | asm("int $0x40" |
137 | asm("int $0x40" |
115 | :"=a"(retval) |
138 | :"=a"(retval) |
116 | :"a"(61), "b"(1)); |
139 | :"a"(61), "b"(1)); |
Line 117... | Line 140... | ||
117 | return retval; |
140 | return retval; |
118 | } |
141 | } |
119 | 142 | ||
Line 120... | Line 143... | ||
120 | static inline int GetScreenBpp() |
143 | static inline int GetScreenBpp(void) |
121 | { |
144 | { |
122 | int retval; |
145 | int retval; |
123 | 146 | ||
124 | asm("int $0x40" |
147 | asm("int $0x40" |
Line 125... | Line 148... | ||
125 | :"=a"(retval) |
148 | :"=a"(retval) |
126 | :"a"(61), "b"(2)); |
149 | :"a"(61), "b"(2)); |
127 | return retval; |
150 | return retval; |
Line 128... | Line 151... | ||
128 | } |
151 | } |
129 | 152 | ||
Line 243... | Line 266... | ||
243 | "" |
266 | "" |
244 | :::"eax","ebx","ecx","edx","esi","edi","cc","memory"); |
267 | :::"eax","ebx","ecx","edx","esi","edi","cc","memory"); |
245 | } |
268 | } |
246 | 269 | ||
Line 247... | Line -... | ||
247 | - | ||
248 | /* |
- | |
249 | u32 __RegService(char *name, srv_proc_t proc) |
- | |
250 | { |
- | |
251 | u32 retval; |
- | |
252 | - | ||
253 | asm __volatile__ |
- | |
254 | ( |
- | |
255 | "pushl %%eax \n\t" |
- | |
256 | "pushl %%ebx \n\t" |
- | |
257 | "call *__imp__RegService \n\t" |
- | |
258 | :"=eax" (retval) |
- | |
259 | :"a" (proc), "b" (name) |
- | |
260 | :"memory" |
- | |
261 | ); |
- | |
262 | return retval; |
- | |
263 | }; |
- | |
264 | */ |
- | |
265 | - | ||
266 | - | ||
267 | static inline u32_t GetService(const char *name) |
270 | static inline u32_t GetService(const char *name) |
268 | { |
271 | { |
269 | u32_t handle; |
272 | u32_t handle; |
Line 270... | Line 273... | ||
270 | 273 | ||
Line 298... | Line 301... | ||
298 | : : "r" (ifl) |
301 | : : "r" (ifl) |
299 | ); |
302 | ); |
300 | } |
303 | } |
301 | 304 | ||
Line -... | Line 305... | ||
- | 305 | static inline u32_t get_eflags(void) |
|
- | 306 | { |
|
- | 307 | u32_t val; |
|
- | 308 | asm volatile ( |
|
- | 309 | "pushfl\n\t" |
|
- | 310 | "popl %0\n" |
|
- | 311 | : "=r" (val)); |
|
- | 312 | return val; |
|
- | 313 | } |
|
- | 314 | ||
302 | static inline void __clear (void * dst, unsigned len) |
315 | static inline void __clear (void * dst, unsigned len) |
303 | { |
316 | { |
304 | u32_t tmp; |
317 | u32_t tmp; |
305 | __asm__ __volatile__ ( |
318 | __asm__ __volatile__ ( |
306 | // "xorl %%eax, %%eax \n\t" |
319 | // "xorl %%eax, %%eax \n\t" |
Line 362... | Line 375... | ||
362 | "":::"ebx"); |
375 | "":::"ebx"); |
363 | 376 | ||
Line 364... | Line 377... | ||
364 | } |
377 | } |
Line 365... | Line 378... | ||
365 | 378 | ||
366 | static inline void change_task() |
379 | static inline void change_task(void) |
367 | { |
380 | { |
368 | __asm__ __volatile__ ( |
381 | __asm__ __volatile__ ( |
369 | "call *__imp__ChangeTask"); |
382 | "call *__imp__ChangeTask"); |
Line 370... | Line 383... | ||
370 | } |
383 | } |
371 | 384 | ||
372 | static inline sysSetScreen(int width, int height, int pitch) |
385 | static inline void sysSetScreen(int width, int height, int pitch) |
373 | { |
386 | { |
374 | __asm__ __volatile__ |
387 | __asm__ __volatile__ |
375 | ( |
388 | ( |