* \brief Acess2 Kernel API Core
*/
-//! NULL Pointer
-#define NULL ((void*)0)
+#include <stddef.h>
+#include <arch.h>
+
//! Pack a structure
#define PACKED __attribute__((packed))
//! Mark a function as not returning
#define DEPRECATED __attribute__((deprecated))
//! Mark a parameter as unused
#define UNUSED(x) UNUSED_##x __attribute__((unused))
-//! Get the offset of a member in a structure
-#define offsetof(st, m) ((Uint)((char *)&((st *)(0))->m - (char *)0 ))
/**
* \name Boolean constants
* \}
*/
-#include <arch.h>
#include <stdarg.h>
#include "errno.h"
* \}
*/
-// --- Logging ---
-/**
- * \name Logging to kernel ring buffer
- * \{
- */
-extern void Log_KernelPanic(const char *Ident, const char *Message, ...);
-extern void Log_Panic(const char *Ident, const char *Message, ...);
-extern void Log_Error(const char *Ident, const char *Message, ...);
-extern void Log_Warning(const char *Ident, const char *Message, ...);
-extern void Log_Notice(const char *Ident, const char *Message, ...);
-extern void Log_Log(const char *Ident, const char *Message, ...);
-extern void Log_Debug(const char *Ident, const char *Message, ...);
-/**
- * \}
- */
-
-// --- Debug ---
-/**
- * \name Debugging and Errors
- * \{
- */
-extern void Debug_KernelPanic(void); //!< Initiate a kernel panic
-extern void Panic(const char *Msg, ...); //!< Print a panic message (initiates a kernel panic)
-extern void Warning(const char *Msg, ...); //!< Print a warning message
-extern void LogF(const char *Fmt, ...); //!< Print a log message without a trailing newline
-extern void Log(const char *Fmt, ...); //!< Print a log message
-extern void Debug(const char *Fmt, ...); //!< Print a debug message (doesn't go to KTerm)
-extern void LogV(const char *Fmt, va_list Args); //!< va_list Log message
-extern void Debug_Enter(const char *FuncName, const char *ArgTypes, ...);
-extern void Debug_Log(const char *FuncName, const char *Fmt, ...);
-extern void Debug_Leave(const char *FuncName, char RetType, ...);
-extern void Debug_HexDump(const char *Header, const void *Data, Uint Length);
-#define UNIMPLEMENTED() Warning("'%s' unimplemented", __func__)
-#if DEBUG
-# define ENTER(_types...) Debug_Enter((char*)__func__, _types)
-# define LOG(_fmt...) Debug_Log((char*)__func__, _fmt)
-# define LEAVE(_t...) Debug_Leave((char*)__func__, _t)
-# define LEAVE_RET(_t,_v...) do{LEAVE(_t,_v);return _v;}while(0)
-# define LEAVE_RET0() do{LEAVE('-');return;}while(0)
-#else
-# define ENTER(...)
-# define LOG(...)
-# define LEAVE(...)
-# define LEAVE_RET(_t,_v...) return (_v)
-# define LEAVE_RET0() return
-#endif
-#if SANITY
-# define ASSERT(expr) do{if(!(expr))Panic("%s:%i - %s: Assertion '"#expr"' failed",__FILE__,__LINE__,(char*)__func__);}while(0)
-#else
-# define ASSERT(expr)
-#endif
-/**
- * \}
- */
+#include "logdebug.h"
// --- IO ---
#if NO_IO_BUS
* \param VAddr Base address to check
* \return 1 if the memory is all user-accessable, 0 otherwise
*/
-#define MM_IsUser(VAddr) (!(MM_GetFlags((VAddr))&MM_PFLAG_KERNEL))
+#define MM_IsUser(VAddr) (!(MM_GetFlags((tVAddr)(VAddr))&MM_PFLAG_KERNEL))
/**
* \brief Temporarily map a page into the address space
* \param PAddr Physical addres to map
*/
// --- Strings ---
-/**
- * \name Strings
- * \{
- */
-extern int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args);
-extern int snprintf(char *__s, size_t __n, const char *__format, ...);
-extern int sprintf(char *__s, const char *__format, ...);
-extern size_t strlen(const char *Str);
-extern char *strcpy(char *__dest, const char *__src);
-extern char *strncpy(char *__dest, const char *__src, size_t max);
-extern char *strcat(char *__dest, const char *__src);
-extern char *strncat(char *__dest, const char *__src, size_t n);
-extern int strcmp(const char *__str1, const char *__str2);
-extern int strncmp(const char *Str1, const char *Str2, size_t num);
-extern int strucmp(const char *Str1, const char *Str2);
-// strdup macro is defined in heap.h
-extern char *_strdup(const char *File, int Line, const char *Str);
-extern char **str_split(const char *__str, char __ch);
-extern char *strchr(const char *__s, int __c);
-extern char *strrchr(const char *__s, int __c);
-extern int strpos(const char *Str, char Ch);
-extern int strpos8(const char *str, Uint32 search);
-extern void itoa(char *buf, Uint64 num, int base, int minLength, char pad);
-extern int atoi(const char *string);
-extern int ParseInt(const char *string, int *Val);
-extern int ReadUTF8(const Uint8 *str, Uint32 *Val);
-extern int WriteUTF8(Uint8 *str, Uint32 Val);
-extern int ModUtil_SetIdent(char *Dest, const char *Value);
-extern int ModUtil_LookupString(const char **Array, const char *Needle);
-
-extern Uint8 ByteSum(const void *Ptr, int Size);
-extern int Hex(char *Dest, size_t Size, const Uint8 *SourceData);
-extern int UnHex(Uint8 *Dest, size_t DestSize, const char *SourceString);
-/**
- * \}
- */
+#include <acess_string.h>
#include <ctype.h>