extern char __buildnum[];
#define BUILD_NUM ((int)(Uint)&__buildnum)
extern const char gsGitHash[];
+extern const char gsBuildInfo[];
#define BITS 32
#define NULL ((void*)0)
typedef uint32_t tTID;
// NOTE: Since this is single-threaded (for now) mutexes can be implimented as simple locks
-typedef char tMutex;
typedef char tShortSpinlock;
typedef int64_t tTime;
extern tTime now(void);
extern int64_t timestamp(int sec, int min, int hr, int day, int month, int year);
+extern void format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, int *sec, int *ms);
#define PACKED __attribute__((packed))
#define DEPRECATED
// Kinda hacky way of not colliding with native errno
#define errno (*(Threads_GetErrno()))
+/**
+ * \name Endianness Swapping
+ * \{
+ */
+#ifdef __BIG_ENDIAN__
+#define LittleEndian16(_val) SwapEndian16(_val)
+#define LittleEndian32(_val) SwapEndian32(_val)
+#define LittleEndian64(_val) SwapEndian32(_val)
+#define BigEndian16(_val) (_val)
+#define BigEndian32(_val) (_val)
+#define BigEndian64(_val) (_val)
+#else
+#define LittleEndian16(_val) (_val)
+#define LittleEndian32(_val) (_val)
+#define LittleEndian64(_val) (_val)
+#define BigEndian16(_val) SwapEndian16(_val)
+#define BigEndian32(_val) SwapEndian32(_val)
+#define BigEndian64(_val) SwapEndian64(_val)
+#endif
+extern Uint16 SwapEndian16(Uint16 Val);
+extern Uint32 SwapEndian32(Uint32 Val);
+extern Uint64 SwapEndian64(Uint64 Val);
+/**
+ * \}
+ */
+
+
#include <string.h>
extern int strucmp(const char *s1, const char *s2);
extern int strpos(const char *Str, char Ch);
extern int WriteUTF8(Uint8 *str, Uint32 Val);
#define CheckString(str) (1)
#define CheckMem(mem,sz) (1)
+#include <ctype.h>
// TODO: Move out?
extern int DivUp(int value, int divisor);
extern uint64_t DivMod64U(uint64_t Num, uint64_t Den, uint64_t *Rem);
-#if DEBUG
-# define ENTER(str, v...) Log("%s:%i: ENTER "str, __func__, __LINE__)
-# define LOG(fmt, v...) Log("%s:%i: "fmt, __func__, __LINE__, ##v)
-# define LEAVE(...) do{}while(0)
-# define LEAVE_RET(t,v) return v;
-#else
-# define ENTER(...) do{}while(0)
-# define LOG(...) do{}while(0)
-# define LEAVE(...) do{}while(0)
-# define LEAVE_RET(t,v) return v;
-#endif
-
-static inline int Mutex_Acquire(tMutex *m) {
- if(*m) Log_KernelPanic("---", "Double mutex lock");
- *m = 1;
- return 0;
-}
-static inline void Mutex_Release(tMutex *m) { *m = 0; }
-
static inline void SHORTLOCK(tShortSpinlock *Lock) {
if(*Lock) Log_KernelPanic("---", "Double short lock");
*Lock = 1;
}
static inline void SHORTREL(tShortSpinlock *m) { *m = 0; }
+static inline intptr_t MM_GetPhysAddr(void *Ptr) { return 1; }
+
#endif