Fix compiler warnings

This commit is contained in:
Alex 2023-04-23 07:02:24 +03:00
parent a73a49094c
commit fcbb298077
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
50 changed files with 232 additions and 192 deletions

View File

@ -827,11 +827,15 @@ namespace CrashHandler
if (Frame->cs != GDT_USER_CODE && Frame->cs != GDT_USER_DATA)
{
if (PageFaultAddress)
{
debug("Exception in kernel mode (ip: %#lx cr2: %#lx (%s))",
Frame->rip, PageFaultAddress, KernelSymbolTable ? KernelSymbolTable->GetSymbolFromAddress(Frame->rip) : "No symbol");
}
else
{
debug("Exception in kernel mode (ip: %#lx (%s))",
Frame->rip, KernelSymbolTable ? KernelSymbolTable->GetSymbolFromAddress(Frame->rip) : "No symbol");
}
CPUData *data = GetCurrentCPU();
if (data)
@ -854,11 +858,15 @@ namespace CrashHandler
else
{
if (PageFaultAddress)
{
debug("Exception in user mode (ip: %#lx cr2: %#lx (%s))",
Frame->rip, PageFaultAddress, KernelSymbolTable ? KernelSymbolTable->GetSymbolFromAddress(Frame->rip) : "No symbol");
}
else
{
debug("Exception in user mode (ip: %#lx (%s))",
Frame->rip, KernelSymbolTable ? KernelSymbolTable->GetSymbolFromAddress(Frame->rip) : "No symbol");
}
CPUData *data = GetCurrentCPU();
if (!data)
{

View File

@ -33,6 +33,7 @@ namespace Driver
{
DriverCode Driver::DriverLoadBindInterrupt(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf)
{
UNUSED(DrvExtHdr);
UNUSED(IsElf);
Memory::MemMgr *mem = new Memory::MemMgr(nullptr, TaskManager->GetCurrentProcess()->memDirectory);
Fex *fex = (Fex *)mem->RequestPages(TO_PAGES(Size + 1));

View File

@ -48,11 +48,13 @@ namespace Driver
BAR[4] = ((PCI::PCIHeader0 *)PCIDevice)->BAR4;
BAR[5] = ((PCI::PCIHeader0 *)PCIDevice)->BAR5;
#ifdef DEBUG
uintptr_t BAR_Type = BAR[0] & 1;
uintptr_t BAR_IOBase = BAR[1] & (~3);
uintptr_t BAR_MemoryBase = BAR[0] & (~15);
debug("Type: %d; IOBase: %#lx; MemoryBase: %#lx", BAR_Type, BAR_IOBase, BAR_MemoryBase);
#endif
/* BARs Size */
for (short i = 0; i < 6; i++)

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindInputAudio(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindInputDisplay(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindInputFileSystem(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindInputGeneric(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindInputNetwork(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindInputStorage(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,7 @@ namespace Driver
{
DriverCode Driver::BindPCIDisplay(Memory::MemMgr *mem, void *fex, PCI::PCIDeviceHeader *PCIDevice)
{
UNUSED(PCIDevice);
FexExtended *fexExtended = (FexExtended *)((uintptr_t)fex + EXTENDED_SECTION_ADDRESS);
if (fexExtended->Driver.OverrideOnConflict)

View File

@ -33,6 +33,7 @@ namespace Driver
{
DriverCode Driver::BindPCIFileSystem(Memory::MemMgr *mem, void *fex, PCI::PCIDeviceHeader *PCIDevice)
{
UNUSED(PCIDevice);
FexExtended *fexExtended = (FexExtended *)((uintptr_t)fex + EXTENDED_SECTION_ADDRESS);
if (fexExtended->Driver.OverrideOnConflict)

View File

@ -33,6 +33,7 @@ namespace Driver
{
DriverCode Driver::BindPCIGeneric(Memory::MemMgr *mem, void *fex, PCI::PCIDeviceHeader *PCIDevice)
{
UNUSED(PCIDevice);
FexExtended *fexExtended = (FexExtended *)((uintptr_t)fex + EXTENDED_SECTION_ADDRESS);
if (fexExtended->Driver.OverrideOnConflict)

View File

@ -33,6 +33,7 @@ namespace Driver
{
DriverCode Driver::BindPCIInput(Memory::MemMgr *mem, void *fex, PCI::PCIDeviceHeader *PCIDevice)
{
UNUSED(PCIDevice);
FexExtended *fexExtended = (FexExtended *)((uintptr_t)fex + EXTENDED_SECTION_ADDRESS);
if (fexExtended->Driver.OverrideOnConflict)

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindProcessAudio(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindProcessDisplay(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindProcessFileSystem(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindProcessGeneric(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindProcessInput(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindProcessNetwork(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -33,6 +33,8 @@ namespace Driver
{
DriverCode Driver::BindProcessStorage(Memory::MemMgr *mem, void *fex)
{
UNUSED(mem);
UNUSED(fex);
return DriverCode::NOT_IMPLEMENTED;
}
}

View File

@ -89,6 +89,7 @@ namespace Xalloc
{
void *ptr = Xalloc_REQUEST_PAGES(XStoP(sizeof(Block)));
return ptr;
(void)(Size);
}
/**

View File

@ -445,115 +445,153 @@ void __ubsan_handle_type_mismatch_v1(struct type_mismatch_v1_data *type_mismatch
if (pointer == 0)
{
if (UBSANMsg(location->file, location->line, location->column))
{
ubsan("Null pointer access.");
}
}
else if (type_mismatch->alignment != 0 && is_aligned(pointer, type_mismatch->alignment))
{
if (UBSANMsg(location->file, location->line, location->column))
{
ubsan("Unaligned memory access %#llx.", pointer);
}
}
else
{
if (UBSANMsg(location->file, location->line, location->column))
{
ubsan("%s address %#llx with insufficient space for object of type %s",
Type_Check_Kinds[type_mismatch->type_check_kind], (void *)pointer, type_mismatch->type->name);
}
}
}
void __ubsan_handle_add_overflow(struct overflow_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Addition overflow.");
}
}
void __ubsan_handle_sub_overflow(struct overflow_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Subtraction overflow.");
}
}
void __ubsan_handle_mul_overflow(struct overflow_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Multiplication overflow.");
}
}
void __ubsan_handle_divrem_overflow(struct overflow_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Division overflow.");
}
}
void __ubsan_handle_negate_overflow(struct overflow_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Negation overflow.");
}
}
void __ubsan_handle_pointer_overflow(struct overflow_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Pointer overflow.");
}
}
void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Shift out of bounds.");
}
}
void __ubsan_handle_load_invalid_value(struct invalid_value_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Invalid load value.");
}
}
void __ubsan_handle_out_of_bounds(struct array_out_of_bounds_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Array out of bounds.");
}
}
void __ubsan_handle_vla_bound_not_positive(struct negative_vla_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Variable-length argument is negative.");
}
}
void __ubsan_handle_nonnull_return(struct nonnull_return_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Non-null return is null.");
}
}
void __ubsan_handle_nonnull_return_v1(struct nonnull_return_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Non-null return is null.");
}
}
void __ubsan_handle_nonnull_arg(struct nonnull_arg_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Non-null argument is null.");
}
}
void __ubsan_handle_builtin_unreachable(struct unreachable_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Unreachable code reached.");
}
}
void __ubsan_handle_invalid_builtin(struct invalid_builtin_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Invalid builtin.");
}
}
void __ubsan_handle_missing_return(struct unreachable_data *data)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Missing return.");
}
}
void __ubsan_vptr_type_cache(uintptr_t *cache, uintptr_t ptr)
@ -565,6 +603,8 @@ void __ubsan_vptr_type_cache(uintptr_t *cache, uintptr_t ptr)
void __ubsan_handle_dynamic_type_cache_miss(struct dynamic_type_cache_miss_data *data, uintptr_t ptr)
{
if (UBSANMsg(data->location.file, data->location.line, data->location.column))
{
ubsan("Dynamic type cache miss.");
}
UNUSED(ptr);
}

View File

@ -418,9 +418,11 @@ namespace Video
if (LoadDefaultFont)
{
this->CurrentFont = new Font(&_binary_Files_tamsyn_font_1_11_Tamsyn7x14r_psf_start, &_binary_Files_tamsyn_font_1_11_Tamsyn7x14r_psf_end, FontType::PCScreenFont2);
#ifdef DEBUG
FontInfo Info = this->CurrentFont->GetInfo();
debug("Font loaded: %dx%d %s",
Info.Width, Info.Height, Info.Type == FontType::PCScreenFont1 ? "PSF1" : "PSF2");
#endif
}
this->CreateBuffer(Info.Width, Info.Height, 0);
}

View File

@ -59,10 +59,15 @@ namespace Execute
debug("Searching for IPC with token %s", UniqueToken);
Handle = Process->IPC->SearchByToken(UniqueToken);
if (Handle == nullptr)
{
debug("Failed");
}
TaskManager->Sleep(200);
if (Handle == nullptr)
{
debug("Retrying...");
}
}
debug("IPC found, sending data...");
InterpreterIPCData *TmpBuffer = new InterpreterIPCData;
@ -95,7 +100,6 @@ namespace Execute
}
#endif
int NotFoundRetry = 0;
RetryIPCWrite:
InterProcessCommunication::IPCErrorCode ret = Process->IPC->Write(Handle->ID, TmpBuffer, sizeof(InterpreterIPCData));
debug("Write returned %d", ret);

View File

@ -35,6 +35,9 @@ namespace Execute
VirtualFileSystem::File &ExFile,
Tasking::PCB *Process)
{
UNUSED(BaseImage);
UNUSED(ExFile);
UNUSED(Process);
fixme("Not implemented");
return {};
}

View File

@ -166,6 +166,7 @@ namespace Execute
void *MemoryImage = nullptr;
Elf64_Ehdr *ELFHeader = (Elf64_Ehdr *)ElfFile;
bool IsPIC = ELFHeader->e_type == ET_DYN;
UNUSED(IsPIC);
debug("Elf %s PIC", IsPIC ? "is" : "is not");
/* TODO: Not sure what I am supposed to do with this.

View File

@ -30,6 +30,7 @@ namespace Execute
VirtualFileSystem::File &ExFile,
Tasking::PCB *Process)
{
UNUSED(ExFile);
debug("Relocatable");
/* TODO: I have to fully implement this, but for now I will leave it as it is now. */
warn("Relocatable ELF is not fully supported yet");

View File

@ -62,7 +62,9 @@ namespace Execute
fixme("Removed library %s because of timeout", Lib.Identifier);
}
else
{
debug("Timeout for %s is %ld", Lib.Identifier, Lib.Timeout);
}
}
debug("Waiting 10 seconds...");
}
@ -214,7 +216,9 @@ namespace Execute
}
}
else
{
debug("GOT section not found");
}
}
}
@ -230,6 +234,7 @@ namespace Execute
void SearchLibrary(char *Identifier)
{
UNUSED(Identifier);
SmartLock(ExecuteServiceLock);
}

View File

@ -44,7 +44,9 @@ namespace Execute
return BinaryType::BinTypeFex;
}
else if (FexHdr->Type == FexFormatType::FexFormatType_Driver)
{
debug("Fex Driver is not supposed to be executed.");
}
}
/* Check ELF magic. */
else if (ELFHeader->e_ident[EI_MAG0] == ELFMAG0 &&

View File

@ -145,12 +145,17 @@ namespace GraphicalUserInterface
void PutBorderWithShadow(ScreenBitmap *Bitmap, Rect rect, uint32_t Color)
{
UNUSED(Bitmap);
UNUSED(rect);
UNUSED(Color);
}
#define SHADOW_SIZE 12
void DrawShadow(ScreenBitmap *Bitmap, Rect rect)
{
UNUSED(Bitmap);
UNUSED(rect);
}
#pragma GCC diagnostic push
@ -161,7 +166,7 @@ namespace GraphicalUserInterface
{
case Video::FontType::PCScreenFont1:
{
uint32_t *PixelPtr = (uint32_t *)Bitmap->Data;
// uint32_t *PixelPtr = (uint32_t *)Bitmap->Data;
char *FontPtr = (char *)font->GetInfo().PSF1Font->GlyphBuffer + (c * font->GetInfo().PSF1Font->Header->charsize);
for (int64_t Y = *CharCursorY; Y < *CharCursorY + 16; Y++)
{
@ -205,5 +210,9 @@ namespace GraphicalUserInterface
void DrawString(ScreenBitmap *Bitmap, Rect rect, const char *Text, uint32_t Color)
{
UNUSED(Bitmap);
UNUSED(rect);
UNUSED(Text);
UNUSED(Color);
}
}

View File

@ -30,10 +30,12 @@ namespace GraphicalUserInterface
{
void WidgetCollection::OnPaintBackground(Event *e)
{
UNUSED(e);
}
void WidgetCollection::OnPaintForeground(Event *e)
{
UNUSED(e);
foreach (auto Panel in this->Panels)
{
PutRect(this->Buffer, Panel->rect, Panel->Color);

View File

@ -48,21 +48,25 @@ namespace GraphicalUserInterface
void Window::OnMinimize(Event *e)
{
UNUSED(e);
fixme("Window::OnMinimize() not implemented");
}
void Window::OnMaximize(Event *e)
{
UNUSED(e);
fixme("Window::OnMaximize() not implemented");
}
void Window::OnClose(Event *e)
{
UNUSED(e);
fixme("Window::OnClose() not implemented");
}
void Window::OnPaintBackground(Event *e)
{
UNUSED(e);
Rect PaintPosition = this->Position;
PaintPosition.Left = 0;
PaintPosition.Top = 0;

View File

@ -157,10 +157,10 @@ LockClass mExtTrkLock;
* https://en.wikipedia.org/wiki/Control_register
* https://web.archive.org/web/20160312223150/http://ncsi.com/nsatc11/presentations/wednesday/emerging_technologies/fischer.pdf
* https://en.wikipedia.org/wiki/Supervisor_Mode_Access_Prevention
*
*
* - Atomic operations:
* https://en.cppreference.com/w/cpp/atomic/atomic
*
*
*/
#ifdef a64
@ -185,7 +185,6 @@ NewLock(KernelLock);
#include <intrin.hpp>
using namespace SSE2;
using VirtualFileSystem::File;
using VirtualFileSystem::FileStatus;
using VirtualFileSystem::Node;
@ -501,6 +500,7 @@ EXTERNC __no_stack_protector NIF void Entry(BootInfo *Info)
EXTERNC __no_stack_protector void BeforeShutdown(bool Reboot)
{
UNUSED(Reboot);
/* TODO: Announce shutdown */
trace("\n\n\n#################### SYSTEM SHUTTING DOWN ####################\n\n");

View File

@ -190,6 +190,7 @@ namespace NetworkARP
bool ARP::OnEthernetPacketReceived(uint8_t *Data, uint64_t Length)
{
UNUSED(Length);
netdbg("Received packet");
ARPHeader *Header = (ARPHeader *)Data;

View File

@ -155,6 +155,8 @@ namespace NetworkDHCP
void DHCP::OnUDPPacketReceived(NetworkUDP::Socket *Socket, uint8_t *Data, uint64_t Length)
{
UNUSED(Socket);
UNUSED(Length);
DHCPHeader *Packet = (DHCPHeader *)Data;
uint8_t *MessageType = (uint8_t *)GetOption(Packet, DHCP_OPTION_MESSAGE_TYPE);

View File

@ -62,6 +62,16 @@ namespace NetworkICMPv6
ICMPv6::ICMPv6(NetworkInterfaceManager::DeviceInterface *Interface) { this->Interface = Interface; }
ICMPv6::~ICMPv6() {}
void ICMPv6::Send(uint8_t *Data, uint64_t Length) { fixme("Unimplemented"); }
void ICMPv6::Receive(uint8_t *Data) { fixme("Unimplemented"); }
void ICMPv6::Send(uint8_t *Data, uint64_t Length)
{
UNUSED(Data);
UNUSED(Length);
fixme("Unimplemented");
}
void ICMPv6::Receive(uint8_t *Data)
{
UNUSED(Data);
fixme("Unimplemented");
}
}

View File

@ -144,8 +144,8 @@ namespace NetworkInterfaceManager
- 0.ro.pool.ntp.org ( {86, 127, 71, 168} )
- time-a-g.nist.gov ( {129, 6, 15, 28} )
*/
InternetProtocol ip = {.v4 = {.Address = {129, 6, 15, 28}},
.v6 = {.Address = {}}};
// InternetProtocol ip = {.v4 = {.Address = {129, 6, 15, 28}},
// .v6 = {.Address = {}}};
// NetworkUDP::Socket *NTP_Socket = udp->Connect(ip, 123);
// NetworkNTP::NTP *ntp = new NetworkNTP::NTP(NTP_Socket);
// udp->Bind(NTP_Socket, ntp);
@ -170,12 +170,20 @@ namespace NetworkInterfaceManager
ReadFSFunction(NetRead)
{
UNUSED(node);
UNUSED(Offset);
UNUSED(Size);
UNUSED(Buffer);
fixme("Not implemented.");
return Size;
}
WriteFSFunction(NetWrite)
{
UNUSED(node);
UNUSED(Offset);
UNUSED(Size);
UNUSED(Buffer);
fixme("Not implemented.");
return Size;
}
@ -224,7 +232,11 @@ namespace NetworkInterfaceManager
re->OnInterfaceReceived(Interface, Data, Length);
}
Events::Events(DeviceInterface *Interface) { RegisteredEvents.push_back(this); }
Events::Events(DeviceInterface *Interface)
{
UNUSED(Interface);
RegisteredEvents.push_back(this);
}
Events::~Events()
{

View File

@ -24,6 +24,8 @@ namespace NetworkNTP
{
void NTP::OnUDPPacketReceived(NetworkUDP::Socket *Socket, uint8_t *Data, uint64_t Length)
{
UNUSED(Socket);
UNUSED(Length);
this->NTPPacket = *(NTPHeader *)Data;
this->TimeReceived = true;
netdbg("Received UDP packet for NTP.");

View File

@ -65,12 +65,14 @@ namespace NetworkUDP
Socket *UDP::Listen(uint16_t Port)
{
UNUSED(Port);
fixme("Not implemented.");
return nullptr;
}
void UDP::Disconnect(Socket *Socket)
{
UNUSED(Socket);
fixme("Not implemented.");
}

View File

@ -87,6 +87,7 @@ namespace Recovery
callback.AudioCallback.Send.Length = pcm.node->Length;
debug("Playing audio...");
int status = DriverManager->IOCB(AudioDrv.DriverUID, &callback);
UNUSED(status);
debug("Audio played! %d", status);
KernelAllocator.FreePages((void *)PCMRaw, TO_PAGES(pcm.node->Length + 1));
vfs->Close(pcm);
@ -119,6 +120,7 @@ namespace Recovery
callback.AudioCallback.Adjust._SampleRate = true;
callback.AudioCallback.Adjust.SampleRate = SR;
int status = DriverManager->IOCB(AudioDrv.DriverUID, &callback);
UNUSED(status);
debug("Sample rate changed! %d", status);
}
@ -156,6 +158,7 @@ namespace Recovery
callback.AudioCallback.Adjust._Volume = true;
callback.AudioCallback.Adjust.Volume = percentage;
int status = DriverManager->IOCB(AudioDrv.DriverUID, &callback);
UNUSED(status);
debug("Volume changed! %d", status);
}
@ -200,11 +203,13 @@ namespace Recovery
wdgDbgWin->CreateLabel({5, 40, 0, 0}, "Memory Usage");
GraphicalUserInterface::Handle MemLblHnd = wdgDbgWin->CreateLabel({5, 55, 0, 0}, "0MB / 0GB (0MB reserved) 0% (0000000000000000 bytes allocated)");
#ifdef DEBUG
wdgDbgWin->CreateLabel({5, 95, 0, 0}, "GUI Info");
wdgDbgWin->CreateLabel({5, 110, 0, 0}, " Fetch Inputs / Paint Desktop / Paint Widgets");
GraphicalUserInterface::Handle GUI1LblHnd = wdgDbgWin->CreateLabel({5, 125, 0, 0}, "0000000000000000 / 0000000000000000 / 0000000000000000");
wdgDbgWin->CreateLabel({5, 140, 0, 0}, " Paint Windows / Paint Cursor / Memset & Update");
GraphicalUserInterface::Handle GUI2LblHnd = wdgDbgWin->CreateLabel({5, 155, 0, 0}, "0000000000000000 / 0000000000000000 / 0000000000000000");
#endif
wdgDbgWin->CreateLabel({5, 195, 0, 0}, "Audio");
wdgDbgWin->CreateButton({5, 210, 85, 15}, "Play Audio", (uintptr_t)PlayAudioWrapper);

View File

@ -186,7 +186,9 @@ static uintptr_t sys_kernelctl(SyscallsFrame *Frame, enum KCtl Command, uint64_t
Execute::SharedLibraries lib = Execute::GetLibrary(Identifier);
if (!lib.Address)
{
debug("Failed to get library address %#lx", (uintptr_t)lib.Address);
}
debug("Returning library address %#lx (%s)", (uintptr_t)lib.Address, Identifier);
return (uintptr_t)lib.Address;
@ -200,7 +202,9 @@ static uintptr_t sys_kernelctl(SyscallsFrame *Frame, enum KCtl Command, uint64_t
Execute::SharedLibraries lib = Execute::GetLibrary(Identifier);
if (!lib.MemoryImage)
{
debug("Failed to get library memory image %#lx", (uintptr_t)lib.MemoryImage);
}
debug("Returning memory image %#lx (%s)", (uintptr_t)lib.MemoryImage, Identifier);
return (uintptr_t)lib.MemoryImage;
@ -252,6 +256,8 @@ static uint64_t sys_file_open(SyscallsFrame *Frame, const char *Path, uint64_t F
*KernelPrivate = KPObj;
debug("Opened file %s (%d)", KPObj.Name, KPObj.Status);
return (uint64_t)KernelPrivate;
UNUSED(Frame);
UNUSED(Flags);
}
static int sys_file_close(SyscallsFrame *Frame, void *KernelPrivate)
@ -266,18 +272,21 @@ static int sys_file_close(SyscallsFrame *Frame, void *KernelPrivate)
return SYSCALL_OK;
}
return SYSCALL_INVALID_ARGUMENT;
UNUSED(Frame);
}
static uint64_t sys_file_read(SyscallsFrame *Frame, void *KernelPrivate, uint64_t Offset, uint8_t *Buffer, uint64_t Size)
{
debug("(KernelPrivate: %#lx, Offset: %#lx, Buffer: %#lx, Size: %#lx)", KernelPrivate, Offset, Buffer, Size);
return vfs->Read(*(VirtualFileSystem::File *)KernelPrivate, Offset, Buffer, Size);
UNUSED(Frame);
}
static uint64_t sys_file_write(SyscallsFrame *Frame, void *KernelPrivate, uint64_t Offset, uint8_t *Buffer, uint64_t Size)
{
debug("(KernelPrivate: %#lx, Offset: %#lx, Buffer: %#lx, Size: %#lx)", KernelPrivate, Offset, Buffer, Size);
return vfs->Write(*(VirtualFileSystem::File *)KernelPrivate, Offset, Buffer, Size);
UNUSED(Frame);
}
static int sys_file_seek(SyscallsFrame *Frame)
@ -294,6 +303,7 @@ static int sys_file_status(SyscallsFrame *Frame)
static int sys_sleep(SyscallsFrame *Frame, uint64_t Milliseconds)
{
UNUSED(Frame);
if (!CheckTrust(TrustedByKernel | Trusted | Untrusted))
return SYSCALL_ACCESS_DENIED;
TaskManager->Sleep(Milliseconds);

View File

@ -360,9 +360,8 @@ namespace Tasking
}
}
SafeFunction NIF void Task::WakeUpThreads(void *CPUDataPointer)
SafeFunction NIF void Task::WakeUpThreads()
{
CPUData *CurrentCPU = (CPUData *)CPUDataPointer;
foreach (auto process in ProcessList)
{
if (InvalidPCB(process))
@ -532,7 +531,7 @@ namespace Tasking
this->UpdateProcessStatus();
schedbg("Passed UpdateProcessStatus");
this->WakeUpThreads(CurrentCPU);
this->WakeUpThreads();
schedbg("Passed WakeUpThreads");
if (this->GetNextAvailableThread(CurrentCPU))

View File

@ -767,7 +767,9 @@ namespace Tasking
Process->ELFSymbolTable = new SymbolResolver::Symbols((uintptr_t)Image);
}
else
{
debug("No image provided for process \"%s\"(%d)", Process->Name, Process->ID);
}
if (Parent)
Parent->Children.push_back(Process);

View File

@ -15,36 +15,12 @@
along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __FENNIX_KERNEL_SIMD_H__
#define __FENNIX_KERNEL_SIMD_H__
#ifndef __FENNIX_KERNEL_INTRIN_H__
#define __FENNIX_KERNEL_INTRIN_H__
#include <types.h>
#include <debug.h>
#if defined(a86)
#define MMX_FN_ATTR __always_inline __target("mmx")
#define SSE_FN_ATTR __always_inline __target("sse")
#define SSE2_FN_ATTR __always_inline __target("sse2")
#define SSE3_FN_ATTR __always_inline __target("sse3")
#define SSSE3_FN_ATTR __always_inline __target("ssse3")
#define SSE4_1_FN_ATTR __always_inline __target("sse4.1")
#define SSE4_2_FN_ATTR __always_inline __target("sse4.2")
#define AVX_FN_ATTR __always_inline __target("avx")
#define AVX2_FN_ATTR __always_inline __target("avx2")
#elif defined(aa64)
#define MMX_FN_ATTR __always_inline
#define SSE_FN_ATTR __always_inline
#define SSE2_FN_ATTR __always_inline
#define SSE3_FN_ATTR __always_inline
#define SSSE3_FN_ATTR __always_inline
#define SSE4_1_FN_ATTR __always_inline
#define SSE4_2_FN_ATTR __always_inline
#define AVX_FN_ATTR __always_inline
#define AVX2_FN_ATTR __always_inline
#endif
#define ST_IN static inline
namespace FXSR
{
void _fxsave(void *mem_addr)
@ -101,148 +77,4 @@ namespace SMAP
}
}
namespace MMX
{
#if defined(a86)
typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8)));
typedef long long __v1di __attribute__((__vector_size__(8)));
typedef int __v2si __attribute__((__vector_size__(8)));
typedef short __v4hi __attribute__((__vector_size__(8)));
typedef char __v8qi __attribute__((__vector_size__(8)));
ST_IN MMX_FN_ATTR void _mm_empty(void)
{
__builtin_ia32_emms();
}
#endif // a64 || a32
}
namespace SSE
{
#if defined(a86)
typedef int __v4si __attribute__((__vector_size__(16)));
typedef unsigned int __v4su __attribute__((__vector_size__(16)));
typedef float __v4sf __attribute__((__vector_size__(16)));
typedef float __m128 __attribute__((__vector_size__(16), __aligned__(16)));
typedef float __m128_u __attribute__((__vector_size__(16), __aligned__(1)));
ST_IN SSE_FN_ATTR __m128 _mm_add_ss(__m128 a, __m128 b)
{
// return __builtin_ia32_addss(a, b);
a[0] += b[0];
return a;
}
ST_IN SSE_FN_ATTR __m128 _mm_add_ps(__m128 a, __m128 b)
{
return (__m128)((__v4sf)a + (__v4sf)b);
}
#endif // a64 || a32
}
namespace SSE2
{
#if defined(a86)
typedef double __v2df __attribute__((__vector_size__(16)));
typedef long long __v2di __attribute__((__vector_size__(16)));
typedef short __v8hi __attribute__((__vector_size__(16)));
typedef char __v16qi __attribute__((__vector_size__(16)));
typedef signed char __v16qs __attribute__((__vector_size__(16)));
typedef unsigned long long __v2du __attribute__((__vector_size__(16)));
typedef unsigned short __v8hu __attribute__((__vector_size__(16)));
typedef unsigned char __v16qu __attribute__((__vector_size__(16)));
typedef double __m128d __attribute__((__vector_size__(16), __aligned__(16)));
typedef double __m128d_u __attribute__((__vector_size__(16), __aligned__(1)));
typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16)));
typedef long long __m128i_u __attribute__((__vector_size__(16), __aligned__(1)));
ST_IN SSE2_FN_ATTR __m128i _mm_mul_epu32(__m128i a, __m128i b)
{
__m128i result;
__asm__("pmuludq %1, %2 \n\t"
"movdqu %2, %0 \n\t"
: "=x"(result)
: "x"(a), "x"(b));
return result;
}
ST_IN SSE2_FN_ATTR __m128i _mm_set_epi32(int e3, int e2, int e1, int e0)
{
__m128i result;
__asm__("movd %[e0], %[result]\n\t"
"pinsrd $1, %[e1], %[result]\n\t"
"pinsrd $2, %[e2], %[result]\n\t"
"pinsrd $3, %[e3], %[result]\n\t"
: [result] "=x"(result)
: [e0] "r"(e0), [e1] "r"(e1), [e2] "r"(e2), [e3] "r"(e3));
return result;
}
ST_IN SSE2_FN_ATTR __m128i _mm_set1_epi32(int a)
{
__m128i result;
__asm__("movd %1, %%xmm0\n\t"
"pshufd $0, %%xmm0, %0\n\t"
: "=x"(result)
: "r"(a)
: "%xmm0");
return result;
}
ST_IN SSE2_FN_ATTR void _mm_storeu_si128(__m128i *mem_addr, __m128i a)
{
asm volatile("movdqu %1, %0"
: "=m"(*mem_addr)
: "x"(a));
}
#endif // a64 || a32
}
namespace SSE3
{
#if defined(a86)
#endif // a64 || a32
}
namespace SSSE3
{
#if defined(a86)
#endif // a64 || a32
}
namespace SSE4_1
{
#if defined(a86)
typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16)));
ST_IN SSE4_1_FN_ATTR __m128i _mm_cvtepu8_epi32(__m128i a);
ST_IN SSE4_1_FN_ATTR __m128i _mm_mullo_epi32(__m128i a, __m128i b);
ST_IN SSE4_1_FN_ATTR __m128i _mm_srli_epi32(__m128i a, int imm8);
ST_IN SSE4_1_FN_ATTR int _mm_cvtsi128_si32(__m128i a);
#endif // a64 || a32
}
namespace SSE4_2
{
#if defined(a86)
#endif // a64 || a32
}
namespace AVX
{
#if defined(a86)
#endif // a64 || a32
}
namespace AVX2
{
#if defined(a86)
#endif // a64 || a32
}
#endif // !__FENNIX_KERNEL_SIMD_H__
#endif // !__FENNIX_KERNEL_INTRIN_H__

View File

@ -55,9 +55,16 @@ namespace NetworkEthernet
public:
FrameType GetFrameType() { return FType; }
virtual void OnEthernetPacketSent(EthernetPacket *Packet) { netdbg("Event not handled. [%p]", Packet); }
virtual void OnEthernetPacketSent(EthernetPacket *Packet)
{
UNUSED(Packet);
netdbg("Event not handled. [%p]", Packet);
}
virtual bool OnEthernetPacketReceived(uint8_t *Data, uint64_t Length)
{
UNUSED(Data);
UNUSED(Length);
netdbg("Event not handled. [%p, %d]", Data, Length);
return false;
}

View File

@ -124,6 +124,10 @@ namespace NetworkIPv4
virtual bool OnIPv4PacketReceived(InternetProtocol SourceIP, InternetProtocol DestinationIP, uint8_t *Data, uint64_t Length)
{
UNUSED(SourceIP);
UNUSED(DestinationIP);
UNUSED(Data);
UNUSED(Length);
warn("Not implemented.");
return false;
}

View File

@ -52,11 +52,39 @@ namespace NetworkInterfaceManager
~Events();
public:
virtual void OnInterfaceAdded(DeviceInterface *Interface) { netdbg("Event for %s not handled.", Interface->Name); }
virtual void OnInterfaceRemoved(DeviceInterface *Interface) { netdbg("Event for %s not handled.", Interface->Name); }
virtual void OnInterfaceChanged(DeviceInterface *Interface) { netdbg("Event for %s not handled.", Interface->Name); }
virtual void OnInterfaceReceived(DeviceInterface *Interface, uint8_t *Data, uint64_t Length) { netdbg("Event for %s not handled.", Interface->Name); }
virtual void OnInterfaceSent(DeviceInterface *Interface, uint8_t *Data, uint64_t Length) { netdbg("Event for %s not handled.", Interface->Name); }
virtual void OnInterfaceAdded(DeviceInterface *Interface)
{
UNUSED(Interface);
netdbg("Event for %s not handled.", Interface->Name);
}
virtual void OnInterfaceRemoved(DeviceInterface *Interface)
{
UNUSED(Interface);
netdbg("Event for %s not handled.", Interface->Name);
}
virtual void OnInterfaceChanged(DeviceInterface *Interface)
{
UNUSED(Interface);
netdbg("Event for %s not handled.", Interface->Name);
}
virtual void OnInterfaceReceived(DeviceInterface *Interface, uint8_t *Data, uint64_t Length)
{
UNUSED(Interface);
UNUSED(Data);
UNUSED(Length);
netdbg("Event for %s not handled.", Interface->Name);
}
virtual void OnInterfaceSent(DeviceInterface *Interface, uint8_t *Data, uint64_t Length)
{
UNUSED(Interface);
UNUSED(Data);
UNUSED(Length);
netdbg("Event for %s not handled.", Interface->Name);
}
};
class NetworkInterface

View File

@ -30,7 +30,13 @@ void DbgDumpData(const char *Description, void *Address, unsigned long Length);
#else
#define netdbg(m, ...)
static inline void DbgNetwork() { return; }
static inline void DbgDumpData(const char *Description, void *Address, unsigned long Length) { return; }
static inline void DbgDumpData(const char *Description, void *Address, unsigned long Length)
{
UNUSED(Description);
UNUSED(Address);
UNUSED(Length);
return;
}
#endif
enum Endianness

View File

@ -50,6 +50,9 @@ namespace NetworkUDP
public:
virtual void OnUDPPacketReceived(Socket *Socket, uint8_t *Data, uint64_t Length)
{
UNUSED(Socket);
UNUSED(Data);
UNUSED(Length);
warn("Not implemented.");
}
};

View File

@ -261,7 +261,7 @@ namespace Tasking
bool GetNextAvailableProcess(void *CPUDataPointer);
bool SchedulerSearchProcessThread(void *CPUDataPointer);
void UpdateProcessStatus();
void WakeUpThreads(void *CPUDataPointer);
void WakeUpThreads();
#if defined(a64)
void Schedule(CPU::x64::TrapFrame *Frame);