- cosmetic changes

- use inline functions instead of macros


git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@158 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
stefan 2010-09-11 11:29:30 +00:00
parent 17c61b4a23
commit c4ed163f9d
2 changed files with 24 additions and 15 deletions

View file

@ -33,29 +33,38 @@
extern "C" {
#endif
static inline uint64_t rdtsc(void)
inline static uint64_t rdtsc(void)
{
uint64_t x;
asm volatile ("rdtsc" : "=A" (x));
return x;
}
#define flush_cache() asm volatile ("wbinvd" : : : "memory")
#define invalid_cache() asm volatile ("invd")
inline static void flush_cache(void) {
asm volatile ("wbinvd" : : : "memory");
}
inline static void invalid_cache(void) {
asm volatile ("invd");
}
inline static int get_return_value(void) {
int ret;
asm volatile ("movl %%eax, %0" : "=r"(ret));
return ret;
}
/* Force strict CPU ordering */
#ifdef CONFIG_ROCKCREEK
#define mb() asm volatile ("lock; addl $0,0(%%esp)" ::: "memory")
#define rmb() asm volatile ("lock; addl $0,0(%%esp)" ::: "memory")
#define wmb() asm volatile ("lock; addl $0,0(%%esp)" ::: "memory")
inline static void mb(void) { asm volatile ("lock; addl $0,0(%%esp)" ::: "memory"); }
inline static void rmb(void) { asm volatile ("lock; addl $0,0(%%esp)" ::: "memory"); }
inline static void wmb(void) { asm volatile ("lock; addl $0,0(%%esp)" ::: "memory"); }
#else
#define mb() asm volatile("mfence" ::: "memory")
#define rmb() asm volatile("lfence" ::: "memory")
#define wmb() asm volatile("sfence" ::: "memory")
inline static void mb(void) { asm volatile("mfence" ::: "memory"); }
inline static void rmb(void) { asm volatile("lfence" ::: "memory"); }
inline static void wmb(void) { asm volatile("sfence" ::: "memory"); }
#endif
#define get_return_value(ret) asm volatile ("movl %%eax, %0" : "=r"(ret))
#define NOP1 asm volatile ("nop")
#define NOP2 asm volatile ("nop;nop")
#define NOP4 asm volatile ("nop;nop;nop;nop")

View file

@ -84,16 +84,16 @@ static void NORETURN do_exit(int arg) {
}
void NORETURN leave_kernel_task(void) {
int result = 0;
int result;
get_return_value(result);
result = get_return_value();
do_exit(result);
}
void NORETURN leave_user_task(void) {
int result = 0;
int result;
get_return_value(result);
result = get_return_value();
SYSCALL1(__NR_exit, result);
kprintf("Kernel panic! Task %d comes back from syscall \"exit\"\n", current_task->id);