Put 'void' in all function parameters for functions which take no parameters:
[comos.git] / include / general.h
blobe71b972a32f803381f6fef9e50d3de8eeb1bdc84
1 #ifndef GENERAL_H
2 #define GENERAL_H
4 //#include "stdarg.h"
6 #define va_list __builtin_va_list
8 #define va_rounded_size(type) \
9 (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
11 #define va_start(v,l) __builtin_va_start(v,l)
12 #define va_end(v) __builtin_va_end(v)
13 #define va_arg(v,l) __builtin_va_arg(v,l)
15 #define NULL ((void *) 0)
16 #define asm __asm__
17 typedef unsigned char uint8_t;
18 typedef unsigned short uint16_t;
19 typedef unsigned int uint32_t;
20 typedef unsigned short wchar_t;
21 typedef unsigned long size_t;
23 // these are defined in libc-asm.asm
24 void *memcpy(void *dest, void *src, size_t count);
25 void *memmove(void *dest, void *src, size_t count);
26 void *memset(void *dest, int val, size_t count);
27 int memcmp(const void *src1, const void *src2, size_t count);
28 wchar_t *wmemset(wchar_t *dest, wchar_t val, size_t count);
29 size_t strlen(const char *str);
31 // these are defined in general.c
32 int strcmp(const char *str1, const char *str2);
33 void panic_internal(const char *file, int line, const char *fmt, ...);
34 #define panic(...) panic_internal(__FILE__, __LINE__, __VA_ARGS__)
36 // these are defined in sprintf.c
37 int vsnprintf(char *buffer, size_t n, const char *fmt, va_list ap);
38 int snprintf(char *str, size_t n, const char *fmt, ...);
39 int vsprintf(char *str, const char *fmt, va_list ap);
40 int sprintf(char *str, const char *fmt, ...);
42 // these are defined in math.c
43 void init_sse(void);
44 void init_fpu(void);
46 // these are defined in mp_tables.c
47 void parse_mp_tables(void);
49 static inline void outb(int port, uint8_t value)
51 asm volatile ("outb %%al,%%dx" :: "a" (value), "d" (port));
54 static inline void outw(int port, uint16_t value)
56 asm volatile ("outw %%ax,%%dx" :: "a" (value), "d" (port));
59 static inline void outl(int port, uint32_t value)
61 asm volatile ("outl %%eax,%%dx" :: "a" (value), "d" (port));
64 static inline uint8_t inb(int port)
66 uint8_t value;
67 asm volatile ("inb %%dx,%%al" : "=a" (value) : "d" (port));
68 return value;
71 static inline uint16_t inw(int port)
73 uint16_t value;
74 asm volatile ("inw %%dx,%%ax" : "=a" (value) : "d" (port));
75 return value;
78 static inline uint32_t inl(int port)
80 uint32_t value;
81 asm volatile ("inl %%dx,%%eax" : "=a" (value) : "d" (port));
82 return value;
85 static inline void cli(void)
87 asm volatile ("cli");
90 static inline void sti(void)
92 asm volatile ("sti");
95 static inline void hlt(void)
97 asm volatile ("hlt");
101 #endif