From 82adac267bc089391397b36413bba210a8e7c68f Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 24 Mar 2011 16:05:28 +0800 Subject: [PATCH] Compile fixes for clang --- Kernel/drvutil.c | 31 +++++++++++++------------------ Kernel/threads.c | 10 +++++----- Makefile.host.cfg | 2 ++ Makefile.x86.cfg | 2 ++ Makefile.x86_64.cfg | 2 ++ Modules/IPStack/interface.c | 26 +++++++++++++------------- Modules/IPStack/routing.c | 14 +++++++------- 7 files changed, 44 insertions(+), 43 deletions(-) create mode 100644 Makefile.x86.cfg diff --git a/Kernel/drvutil.c b/Kernel/drvutil.c index 7e5b9b18..bac78948 100644 --- a/Kernel/drvutil.c +++ b/Kernel/drvutil.c @@ -12,13 +12,14 @@ Uint64 DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, tDrvUtil_Video_2DHandlers *Handlers, int SizeofHandlers) { - Uint8 *stream = Buffer; + void *stream = Buffer; int rem = Length; int op; while( rem ) { rem --; - op = *stream++; + op = *(Uint8*)stream; + stream = (void*)((tVAddr)stream + 1); if(op > NUM_VIDEO_2DOPS) { Log_Warning("DrvUtil", "DrvUtil_Video_2DStream: Unknown" @@ -46,17 +47,17 @@ Uint64 DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, Handlers->Fill( Ent, - *(Uint16*)(&stream[0]), *(Uint16*)(&stream[2]), - *(Uint16*)(&stream[4]), *(Uint16*)(&stream[6]), - *(Uint32*)(&stream[8]) + ((Uint16*)stream)[0], ((Uint16*)stream)[1], + ((Uint16*)stream)[2], ((Uint16*)stream)[3], + ((Uint32*)stream)[4] ); rem -= 12; - stream += 12; + stream = (void*)((tVAddr)stream + 12); break; case VIDEO_2DOP_BLIT: - if(rem < 12) return Length-rem; + if(rem < 16) return Length-rem; if(!Handlers->Blit) { Log_Warning("DrvUtil", "DrvUtil_Video_2DStream: Driver" @@ -64,21 +65,15 @@ Uint64 DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length, return Length-rem; } - //Log("Handlers->Blit{%}}(%p, %i,%i, %i,%i, %i,%i)", - // Handlers->Blit, Ent, - // *(Uint16*)(&stream[0]), *(Uint16*)(&stream[2]), - // *(Uint16*)(&stream[4]), *(Uint16*)(&stream[6]), - // *(Uint16*)(&stream[8]), *(Uint16*)(&stream[10]) - // ); Handlers->Blit( Ent, - *(Uint16*)(&stream[0]), *(Uint16*)(&stream[2]), - *(Uint16*)(&stream[4]), *(Uint16*)(&stream[6]), - *(Uint16*)(&stream[8]), *(Uint16*)(&stream[10]) + ((Uint16*)stream)[0], ((Uint16*)stream)[1], + ((Uint16*)stream)[2], ((Uint16*)stream)[3], + ((Uint16*)stream)[4], ((Uint16*)stream)[5] ); - rem -= 12; - stream += 12; + rem -= 16; + stream = (void*)((tVAddr)stream + 16); break; } diff --git a/Kernel/threads.c b/Kernel/threads.c index 62bb7e04..d24af082 100644 --- a/Kernel/threads.c +++ b/Kernel/threads.c @@ -81,11 +81,11 @@ void Mutex_Release(tMutex *Mutex); // -- Core Thread -- // Only used for the core kernel tThread gThreadZero = { - Status: THREAD_STAT_ACTIVE, // Status - ThreadName: (char*)"ThreadZero", // Name - Quantum: DEFAULT_QUANTUM, // Default Quantum - Remaining: DEFAULT_QUANTUM, // Current Quantum - Priority: DEFAULT_PRIORITY // Number of tickets + .Status = THREAD_STAT_ACTIVE, // Status + .ThreadName = (char*)"ThreadZero", // Name + .Quantum = DEFAULT_QUANTUM, // Default Quantum + .Remaining = DEFAULT_QUANTUM, // Current Quantum + .Priority = DEFAULT_PRIORITY // Number of tickets }; // -- Processes -- // --- Locks --- diff --git a/Makefile.host.cfg b/Makefile.host.cfg index 0879ad74..dee50dec 100644 --- a/Makefile.host.cfg +++ b/Makefile.host.cfg @@ -8,6 +8,8 @@ SAVED_LD_ := $(LD) include $(ACESSDIR)/Makefile.x86_64.cfg +OBJDUMP := objdump -S + CC := $(SAVED_CC_) LD := $(SAVED_LD_) diff --git a/Makefile.x86.cfg b/Makefile.x86.cfg new file mode 100644 index 00000000..705fe8a6 --- /dev/null +++ b/Makefile.x86.cfg @@ -0,0 +1,2 @@ + +ASFLAGS = -felf diff --git a/Makefile.x86_64.cfg b/Makefile.x86_64.cfg index 024ef135..f5985c2c 100644 --- a/Makefile.x86_64.cfg +++ b/Makefile.x86_64.cfg @@ -8,3 +8,5 @@ DYNMOD_CFLAGS := -mcmodel=small -fPIC -mno-red-zone ARCHDIR = x86_64 +ASFLAGS = -felf64 + diff --git a/Modules/IPStack/interface.c b/Modules/IPStack/interface.c index fc7db903..65380783 100644 --- a/Modules/IPStack/interface.c +++ b/Modules/IPStack/interface.c @@ -34,18 +34,18 @@ tVFS_Node *IPStack_Iface_FindDir(tVFS_Node *Node, const char *Name); // === GLOBALS === //! Loopback (127.0.0.0/8, ::1) Pseudo-Interface tInterface gIP_LoopInterface = { - Node: { - ImplPtr: &gIP_LoopInterface, - Flags: VFS_FFLAG_DIRECTORY, - Size: -1, - NumACLs: 1, - ACLs: &gVFS_ACL_EveryoneRX, - ReadDir: IPStack_Iface_ReadDir, - FindDir: IPStack_Iface_FindDir, - IOCtl: IPStack_Iface_IOCtl + .Node = { + .ImplPtr = &gIP_LoopInterface, + .Flags = VFS_FFLAG_DIRECTORY, + .Size = -1, + .NumACLs = 1, + .ACLs = &gVFS_ACL_EveryoneRX, + .ReadDir = IPStack_Iface_ReadDir, + .FindDir = IPStack_Iface_FindDir, + .IOCtl = IPStack_Iface_IOCtl }, - Adapter: NULL, - Type: 0 + .Adapter = NULL, + .Type = 0 }; tShortSpinlock glIP_Interfaces; tInterface *gIP_Interfaces = NULL; @@ -54,8 +54,8 @@ tInterface *gIP_Interfaces_Last = NULL; tSocketFile *gIP_FileTemplates; tAdapter gIP_LoopAdapter = { - DeviceLen: 8, - Device: "LOOPBACK" + .DeviceLen = 8, + .Device = "LOOPBACK" }; tMutex glIP_Adapters; tAdapter *gIP_Adapters = NULL; diff --git a/Modules/IPStack/routing.c b/Modules/IPStack/routing.c index 957f1e11..c37e7441 100644 --- a/Modules/IPStack/routing.c +++ b/Modules/IPStack/routing.c @@ -32,13 +32,13 @@ tRoute *IPStack_FindRoute(int AddressType, tInterface *Interface, void *Address) tRoute *gIP_Routes; tRoute *gIP_RoutesEnd; tVFS_Node gIP_RouteNode = { - Flags: VFS_FFLAG_DIRECTORY, - Size: -1, - NumACLs: 1, - ACLs: &gVFS_ACL_EveryoneRX, - ReadDir: IPStack_RouteDir_ReadDir, - FindDir: IPStack_RouteDir_FindDir, - IOCtl: IPStack_RouteDir_IOCtl + .Flags = VFS_FFLAG_DIRECTORY, + .Size = -1, + .NumACLs = 1, + .ACLs = &gVFS_ACL_EveryoneRX, + .ReadDir = IPStack_RouteDir_ReadDir, + .FindDir = IPStack_RouteDir_FindDir, + .IOCtl = IPStack_RouteDir_IOCtl }; // === CODE === -- 2.20.1