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
KernelLand - Better node chaching code
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
arch
/
x86
/
lib.c
diff --git
a/KernelLand/Kernel/arch/x86/lib.c
b/KernelLand/Kernel/arch/x86/lib.c
index
6b3d722
..
f862afd
100644
(file)
--- a/
KernelLand/Kernel/arch/x86/lib.c
+++ b/
KernelLand/Kernel/arch/x86/lib.c
@@
-85,6
+85,12
@@
void SHORTLOCK(struct sShortSpinlock *Lock)
__ASM__ ("pushf;\n\tpop %0" : "=r"(IF));
IF &= 0x200; // AND out all but the interrupt flag
__ASM__ ("pushf;\n\tpop %0" : "=r"(IF));
IF &= 0x200; // AND out all but the interrupt flag
+ if( CPU_HAS_LOCK(Lock) )
+ {
+ Panic("Double lock of %p, %p req, %p has", Lock, __builtin_return_address(0), Lock->LockedBy);
+ for(;;);
+ }
+
#if TRACE_LOCKS
if( TRACE_LOCK_COND )
{
#if TRACE_LOCKS
if( TRACE_LOCK_COND )
{
@@
-98,6
+104,7
@@
void SHORTLOCK(struct sShortSpinlock *Lock)
// Wait for another CPU to release
__AtomicTestSetLoop( (Uint*)&Lock->Lock, cpu );
Lock->IF = IF;
// Wait for another CPU to release
__AtomicTestSetLoop( (Uint*)&Lock->Lock, cpu );
Lock->IF = IF;
+ Lock->LockedBy = __builtin_return_address(0);
#if TRACE_LOCKS
if( TRACE_LOCK_COND )
#if TRACE_LOCKS
if( TRACE_LOCK_COND )
@@
-344,6
+351,10
@@
DEF_DIVMOD(64);
Uint64 DivMod64U(Uint64 Num, Uint64 Div, Uint64 *Rem)
{
Uint64 DivMod64U(Uint64 Num, Uint64 Div, Uint64 *Rem)
{
+ if( Div == 16 ) {
+ if(Rem) *Rem = Num & 15;
+ return Num >> 4;
+ }
if( Div < 0x100000000ULL && Num < 0xFFFFFFFF * Div ) {
Uint32 rem, ret_32;
__asm__ __volatile__(
if( Div < 0x100000000ULL && Num < 0xFFFFFFFF * Div ) {
Uint32 rem, ret_32;
__asm__ __volatile__(
UCC
git Repository :: git.ucc.asn.au