3 * - Acess kernel emulation on another OS using SDL and UDP
15 void LogF(const char *Fmt, ...)
23 void Log(const char *Fmt, ...)
33 void Warning(const char *Fmt, ...)
43 void Panic(const char *Format, ...)
47 va_start(args, Format);
48 vprintf(Format, args);
54 void Debug_SetKTerminal(const char *Path)
56 // Ignored, kernel debug goes to stdout instead of a virtual terminal
60 void KernelPanic_SetMode(void)
64 void KernelPanic_PutChar(char ch)
66 fprintf(stderr, "%c", ch);
68 void Debug_PutCharDebug(char ch)
74 void Debug_PutStringDebug(const char *String)
77 if( strchr(String, '\n') )
81 void *Heap_Allocate(const char *File, int Line, int ByteCount)
83 return malloc(ByteCount);
86 void *Heap_AllocateZero(const char *File, int Line, int ByteCount)
88 return calloc(ByteCount, 1);
91 void *Heap_Reallocate(const char *File, int Line, void *Ptr, int Bytes)
93 return realloc(Ptr, Bytes);
96 void Heap_Deallocate(void *Ptr)
101 char *Heap_StringDup(const char *File, int Line, const char *Str)
110 tPAddr MM_GetPhysAddr(tVAddr VAddr)
112 return VAddr; // HACK!
115 int MM_IsValidBuffer(tVAddr Base, int Size)
120 Uint MM_GetFlags(tVAddr VAddr)
125 int Modules_InitialiseBuiltin(const char *Name)
134 gettimeofday(&tv, &tz);
135 return tv.tv_sec * 1000 + tv.tv_usec/1000;
138 void IPStack_SendDebugText(const char *str)
143 int strpos(const char *str, char ch)
145 const char *retptr = strchr(str, ch);
146 int rv = retptr ? retptr - str : -1;
150 int CheckString(const char *string)
152 if( (intptr_t)string < 0x1000 )
157 int CheckMem(const void *buf, size_t len)
159 if( (intptr_t)buf < 0x1000 )
164 void itoa(char *buf, Uint64 num, int base, int minLength, char pad)
166 static const char cUCDIGITS[] = "0123456789ABCDEF";
175 if(base > 16 || base < 2) {
181 while(num > base-1) {
183 num = num / base; // Shift `num` and get remainder
184 tmpBuf[pos] = cUCDIGITS[ rem ];
187 tmpBuf[pos++] = cUCDIGITS[ num ]; // Last digit of `num`
192 while(minLength-- > 0)
195 buf[i++] = tmpBuf[pos]; // Reverse the order of characters