git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/x86 - Fixed SMP bug, #if'd out some dead code
[tpg/acess2.git]
/
Kernel
/
messages.c
diff --git
a/Kernel/messages.c
b/Kernel/messages.c
index
ce23d6b
..
1391d99
100644
(file)
--- a/
Kernel/messages.c
+++ b/
Kernel/messages.c
@@
-1,16
+1,16
@@
/*
/*
- * AcessOS Microkernel Version
+ * Acess2 Kernel
+ * - By John Hodge (thePowersGang)
+ *
* messages.c
* messages.c
+ * - IPC Messages
*/
*/
-#define DEBUG
1
+#define DEBUG
0
#include <acess.h>
#include <threads.h>
#include <threads_int.h>
#include <errno.h>
#include <acess.h>
#include <threads.h>
#include <threads_int.h>
#include <errno.h>
-// === IMPORTS ===
-extern tShortSpinlock glThreadListLock;
-
// === CODE ===
/**
* \fn int Proc_SendMessage(Uint *Err, Uint Dest, int Length, void *Data)
// === CODE ===
/**
* \fn int Proc_SendMessage(Uint *Err, Uint Dest, int Length, void *Data)
@@
-65,9
+65,8
@@
int Proc_SendMessage(Uint *Err, Uint Dest, int Length, void *Data)
SHORTREL(&thread->IsLocked);
SHORTREL(&thread->IsLocked);
-
SHORTLOCK(&glThreadListLock
);
+
LOG("Waking %p (%i %s)", thread, thread->TID, thread->ThreadName
);
Threads_Wake( thread );
Threads_Wake( thread );
- SHORTREL(&glThreadListLock);
LEAVE_RET('i', 0);
}
LEAVE_RET('i', 0);
}
@@
-84,21
+83,27
@@
int Proc_GetMessage(Uint *Err, Uint *Source, void *Buffer)
int ret;
void *tmp;
tThread *cur = Proc_GetCurThread();
int ret;
void *tmp;
tThread *cur = Proc_GetCurThread();
+
+ ENTER("pSource pBuffer", Source, Buffer);
// Check if queue has any items
if(!cur->Messages) {
// Check if queue has any items
if(!cur->Messages) {
+ LEAVE('i', 0);
return 0;
}
SHORTLOCK( &cur->IsLocked );
return 0;
}
SHORTLOCK( &cur->IsLocked );
- if(Source)
+ if(Source)
{
*Source = cur->Messages->Source;
*Source = cur->Messages->Source;
+ LOG("*Source = %i", *Source);
+ }
// Get message length
if( !Buffer ) {
ret = cur->Messages->Length;
SHORTREL( &cur->IsLocked );
// Get message length
if( !Buffer ) {
ret = cur->Messages->Length;
SHORTREL( &cur->IsLocked );
+ LEAVE('i', ret);
return ret;
}
return ret;
}
@@
-107,10
+112,13
@@
int Proc_GetMessage(Uint *Err, Uint *Source, void *Buffer)
{
if( !CheckMem( Buffer, cur->Messages->Length ) )
{
{
if( !CheckMem( Buffer, cur->Messages->Length ) )
{
+ LOG("Invalid buffer");
*Err = -EINVAL;
SHORTREL( &cur->IsLocked );
*Err = -EINVAL;
SHORTREL( &cur->IsLocked );
+ LEAVE('i', -1);
return -1;
}
return -1;
}
+ LOG("Copied to buffer");
memcpy(Buffer, cur->Messages->Data, cur->Messages->Length);
}
ret = cur->Messages->Length;
memcpy(Buffer, cur->Messages->Data, cur->Messages->Length);
}
ret = cur->Messages->Length;
@@
-118,10
+126,12
@@
int Proc_GetMessage(Uint *Err, Uint *Source, void *Buffer)
// Remove from list
tmp = cur->Messages;
cur->Messages = cur->Messages->Next;
// Remove from list
tmp = cur->Messages;
cur->Messages = cur->Messages->Next;
+ if(cur->Messages == NULL) cur->LastMessage = NULL;
SHORTREL( &cur->IsLocked );
free(tmp); // Free outside of lock
SHORTREL( &cur->IsLocked );
free(tmp); // Free outside of lock
-
+
+ LEAVE('i', ret);
return ret;
}
return ret;
}
UCC
git Repository :: git.ucc.asn.au