| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /* include/kernel/kernel.h
- *
- * This file is part of evx.
- *
- * evx is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * evx is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with evx. If not, see <https://www.gnu.org/licenses/>
- */
- #ifndef __KERNEL_H
- #define __KERNEL_H
- #ifndef __ASSEMBLER__
- #include <sys/types.h>
- #include <stdarg.h>
- /* some useful function declares and macros, as what we did in linux :-) */
- #ifndef NULL
- #define NULL ((void *) 0)
- #endif
- #ifndef ARRAYSIZE
- #define ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0]))
- #endif
- int printk(char *, ...);
- int vsprintf(char *buf, const char *fmt, va_list);
- #define to_bool(cond) !!(cond)
- #define likely(c) __builtin_expect(to_bool(c), 1)
- #define unlikely(c) __builtin_expect(to_bool(c), 0)
- #define isdigit(c) ((c) >= '0' && (c) <= '9')
- #define isnrx(c) (isdigit(c) || ((c) >= 'a' && (c) <= 'f'))
- #define isnrX(c) (isdigit(c) || ((c) >= 'A' && (c) <= 'F'))
- #define atoi(c) ((c) - '0')
- #endif
- #endif
|