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
More work on x86_64 port of usermode
[tpg/acess2.git]
/
Kernel
/
arch
/
x86_64
/
lib.c
diff --git
a/Kernel/arch/x86_64/lib.c
b/Kernel/arch/x86_64/lib.c
index
f20753b
..
da9955c
100644
(file)
--- a/
Kernel/arch/x86_64/lib.c
+++ b/
Kernel/arch/x86_64/lib.c
@@
-5,6
+5,7
@@
// === IMPORTS ===
extern int GetCPUNum(void);
// === IMPORTS ===
extern int GetCPUNum(void);
+extern void *Proc_GetCurThread(void);
// === CODE ===
/**
// === CODE ===
/**
@@
-58,7
+59,7
@@
void SHORTLOCK(struct sShortSpinlock *Lock)
#if LOCK_DISABLE_INTS
// Save interrupt state and clear interrupts
#if LOCK_DISABLE_INTS
// Save interrupt state and clear interrupts
- __ASM__ ("pushf;\n\tpop %
%rax\n\tcli" : "=a
"(IF));
+ __ASM__ ("pushf;\n\tpop %
0" : "=r
"(IF));
IF &= 0x200; // AND out all but the interrupt flag
#endif
IF &= 0x200; // AND out all but the interrupt flag
#endif
@@
-85,16
+86,21
@@
void SHORTLOCK(struct sShortSpinlock *Lock)
: "a"(0), "r"(cpu), "r"(&Lock->Lock)
);
#elif STACKED_LOCKS == 2
: "a"(0), "r"(cpu), "r"(&Lock->Lock)
);
#elif STACKED_LOCKS == 2
- __ASM__("lock cmpxchg
l
%2, (%3)"
+ __ASM__("lock cmpxchg
q
%2, (%3)"
: "=a"(v)
: "a"(0), "r"(thread), "r"(&Lock->Lock)
);
#else
__ASM__("xchgl %0, (%2)":"=a"(v):"a"(1),"D"(&Lock->Lock));
#endif
: "=a"(v)
: "a"(0), "r"(thread), "r"(&Lock->Lock)
);
#else
__ASM__("xchgl %0, (%2)":"=a"(v):"a"(1),"D"(&Lock->Lock));
#endif
+
+ #if LOCK_DISABLE_INTS
+ if( v ) __ASM__("sti"); // Re-enable interrupts
+ #endif
}
#if LOCK_DISABLE_INTS
}
#if LOCK_DISABLE_INTS
+ __ASM__("cli");
Lock->IF = IF;
#endif
}
Lock->IF = IF;
#endif
}
UCC
git Repository :: git.ucc.asn.au