Added ubsan

This commit is contained in:
Alex
2022-11-17 03:33:18 +02:00
parent 11641b1ff3
commit 2571c4f539
15 changed files with 410 additions and 26 deletions

View File

@ -11,7 +11,8 @@ enum DebugLevel
DebugLevelInfo = 3,
DebugLevelDebug = 4,
DebugLevelTrace = 5,
DebugLevelFixme = 6
DebugLevelFixme = 6,
DebugLevelUbsan = 7
};
#ifdef __cplusplus
@ -28,6 +29,7 @@ namespace SysDbg
#define debug(Format, ...) SysDbg::WriteLine(DebugLevelDebug, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#define trace(Format, ...) SysDbg::WriteLine(DebugLevelTrace, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#define fixme(Format, ...) SysDbg::WriteLine(DebugLevelFixme, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#define ubsan(Format, ...) SysDbg::WriteLine(DebugLevelUbsan, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#else
@ -40,6 +42,7 @@ void SysDbgWriteLine(enum DebugLevel Level, const char *File, int Line, const ch
#define debug(Format, ...) SysDbgWriteLine(DebugLevelDebug, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#define trace(Format, ...) SysDbgWriteLine(DebugLevelTrace, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#define fixme(Format, ...) SysDbgWriteLine(DebugLevelFixme, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#define ubsan(Format, ...) SysDbgWriteLine(DebugLevelUbsan, __FILE__, __LINE__, __FUNCTION__, Format, ##__VA_ARGS__)
#endif // __cplusplus

View File

@ -108,19 +108,24 @@ namespace Video
}
uint64_t Size = this->framebuffer.Pitch * Height;
if (this->Buffers[Index]->Checksum != 0xDEAD5C9EE7)
if (!this->Buffers[Index])
{
ScreenBuffer *buffer = new ScreenBuffer;
buffer->Buffer = KernelAllocator.RequestPages(TO_PAGES(Size));
buffer->Width = Width;
buffer->Height = Height;
buffer->Size = Size;
buffer->Color = 0xFFFFFF;
buffer->CursorX = 0;
buffer->CursorY = 0;
this->Buffers[Index] = buffer;
memset(this->Buffers[Index]->Buffer, 0, Size);
this->Buffers[Index]->Checksum = 0xDEAD5C9EE7;
if (this->Buffers[Index]->Checksum != 0xDEAD5C9EE7)
{
ScreenBuffer *buffer = new ScreenBuffer;
buffer->Buffer = KernelAllocator.RequestPages(TO_PAGES(Size));
buffer->Width = Width;
buffer->Height = Height;
buffer->Size = Size;
buffer->Color = 0xFFFFFF;
buffer->CursorX = 0;
buffer->CursorY = 0;
this->Buffers[Index] = buffer;
memset(this->Buffers[Index]->Buffer, 0, Size);
this->Buffers[Index]->Checksum = 0xDEAD5C9EE7;
}
else
warn("Buffer %d already exists, skipping creation", Index);
}
else
warn("Buffer %d already exists, skipping creation", Index);

View File

@ -101,6 +101,11 @@ namespace Tasking
void Rename(const char *name)
{
if (!Name[0])
{
warn("Tried to rename thread %d to NULL", ID);
return;
}
trace("Renaming thread %s to %s", Name, name);
for (int i = 0; i < 256; i++)
{
@ -201,6 +206,12 @@ namespace Tasking
bool StopScheduler = false;
public:
void InitIPC()
{
static int once = 0;
if (!once++)
this->IPCManager = new InterProcessCommunication::IPC();
}
Vector<PCB *> GetProcessList() { return ListProcess; }
void Panic() { StopScheduler = true; }
void Schedule();

View File

@ -252,5 +252,12 @@ typedef __SIZE_TYPE__ size_t;
#define __nonnull_all __attribute__((nonnull))
#define __warn_unused_result __attribute__((warn_unused_result))
#define __no_stack_protector __attribute__((no_stack_protector))
// sanitizer
#define __no_sanitize_address __attribute__((no_sanitize_address))
#define __no_sanitize_undefined __attribute__((no_sanitize_undefined))
#define __no_address_safety_analysis __attribute__((no_address_safety_analysis))
#define __no_sanitize_thread __attribute__((no_sanitize_thread))
#define __no_sanitize_memory __attribute__((no_sanitize_memory))
#define __no_sanitize_hwaddress __attribute__((no_sanitize_hwaddress))
#endif // !__FENNIX_KERNEL_TYPES_H__