|
11 | 11 | #include <types.h> |
12 | 12 | #include <stdarg.h> |
13 | 13 |
|
14 | | -#define INVALID_HANDLE -1 |
15 | | -#define MAX_PRINTABLE_STRING_LENGTH 100 |
16 | | - |
17 | | -/** Length of an array in bytes */ |
18 | | -#define ARRAY_LENGTH(ar) (sizeof ((ar)) / sizeof ((ar)[0])) |
19 | 14 |
|
20 | 15 | #define HALT() for (;;) |
21 | 16 |
|
22 | | -#if ARCH == x86 |
23 | | - #define outb(p, v) __asm__ volatile("out dx, al;" : : "a"(v), "d"(p)) |
24 | | - #define inb(p, v) __asm__ volatile("in al, dx" : "=a"(v) : "d"(p)) |
25 | | -#endif |
26 | 17 |
|
27 | 18 | INT snprintf (CHAR* dest, size_t size, const CHAR* fmt, ...); |
28 | 19 | INT vsnprintf (CHAR* dest, size_t size, const CHAR* fmt, va_list l); |
29 | 20 |
|
30 | | -/******************************************************************** |
31 | | - * Debug specific. Only available for Debug builds of Mos-libc |
32 | | - *******************************************************************/ |
33 | | -#if defined(DEBUG) && defined(PORT_E9_ENABLED) |
34 | | - typedef enum DebugLogType { |
35 | | - DEBUG_LOG_TYPE_INFO, |
36 | | - DEBUG_LOG_TYPE_FUNC, |
37 | | - DEBUG_LOG_TYPE_ERROR, |
38 | | - DEBUG_LOG_TYPE_WARN, |
39 | | - } DebugLogType; |
40 | | - |
41 | | - void debug_log_ndu (DebugLogType type, const char* func, UINT line, char* fmt, ...); |
42 | | - |
43 | | - #define INFO(...) debug_log_ndu (DEBUG_LOG_TYPE_INFO, __func__, __LINE__, __VA_ARGS__) |
44 | | - #define ERROR(...) debug_log_ndu (DEBUG_LOG_TYPE_ERROR, __func__, __LINE__, __VA_ARGS__) |
45 | | - #define FUNC_ENTRY(...) debug_log_ndu (DEBUG_LOG_TYPE_FUNC, __func__, __LINE__, "" __VA_ARGS__) |
46 | | - #define WARN(...) debug_log_ndu (DEBUG_LOG_TYPE_WARN, __func__, __LINE__, __VA_ARGS__) |
47 | | -#else |
48 | | - #define INFO(...) (void)0 |
49 | | - #define ERROR(...) (void)0 |
50 | | - #define FUNC_ENTRY(...) (void)0 |
51 | | - #define WARN(...) (void)0 |
52 | | -#endif // PORT_E9_ENABLED |
53 | | - |
54 | | -#if defined(DEBUG) |
55 | | - /*************************************************************************************************** |
56 | | - * Magic break point used by bochs emulator |
57 | | - * |
58 | | - * @return Nothing |
59 | | - **************************************************************************************************/ |
60 | | - #define bochs_breakpoint() __asm__ volatile("xchg bx, bx") |
61 | | -#endif // DEBUG |
62 | 21 |
|
63 | 22 | /*************************************************************************************************** |
64 | 23 | * Halts thread for 'ms' miliseconds |
|
0 commit comments