//kernel/trunk/arch/amd64/include/syscall.h |
---|
31,8 → 31,6 |
#include <arch/types.h> |
extern __native syscall_handler(__native a1,__native a2, __native a3, |
__native a4, __native id); |
extern void syscall_setup_cpu(void); |
#endif |
//kernel/trunk/arch/amd64/include/atomic.h |
---|
30,6 → 30,8 |
#define __amd64_ATOMIC_H__ |
#include <arch/types.h> |
#include <arch/barrier.h> |
#include <preemption.h> |
typedef struct { volatile __u64 count; } atomic_t; |
101,6 → 103,31 |
} |
extern void spinlock_arch(volatile int *val); |
/** AMD64 specific fast spinlock */ |
static inline void atomic_lock_arch(atomic_t *val) |
{ |
__u64 tmp; |
preemption_disable(); |
__asm__ volatile ( |
"0:;" |
#ifdef CONFIG_HT |
"pause;" /* Pentium 4's HT love this instruction */ |
#endif |
"mov %0, %1;" |
"testq %1, %1;" |
"jnz 0b;" /* Leightweight looping on locked spinlock */ |
"incq %1;" /* now use the atomic operation */ |
"xchgq %0, %1;" |
"testq %1, %1;" |
"jnz 0b;" |
: "=m"(val->count),"=r"(tmp) |
); |
/* |
* Prevent critical section code from bleeding out this way up. |
*/ |
CS_ENTER_BARRIER(); |
} |
#endif |
//kernel/trunk/arch/amd64/src/syscall.c |
---|
60,13 → 60,3 |
*/ |
write_msr(AMD_MSR_SFMASK, 0x200); |
} |
/** Dispatch system call */ |
__native syscall_handler(__native a1, __native a2, __native a3, |
__native a4, __native id) |
{ |
if (id < SYSCALL_END) |
return syscall_table[id](a1,a2,a3,a4); |
else |
panic("Undefined syscall %d", id); |
} |
//kernel/trunk/arch/amd64/src/interrupt.c |
---|
54,18 → 54,14 |
printf("%%rip: %Q (%s)\n",istate->rip, symbol); |
printf("ERROR_WORD=%Q\n", istate->error_word); |
printf("%%rcs=%Q, flags=%Q, %%cr0=%Q\n", istate->cs, istate->rflags,read_cr0()); |
printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",istate->rax,istate->rbx,istate->rcx); |
printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",istate->rdx,istate->rsi,istate->rdi); |
printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",istate->r8,istate->r9,istate->r10); |
printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",istate->r11,istate->r12,istate->r13); |
printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",istate->r14,istate->r15,&istate->stack[0]); |
printf("%%rbp=%Q\n",istate->rbp); |
/* |
printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]); |
printf(" %Q, %Q, %Q\n", x[8], x[9], x[10]); |
printf(" %Q, %Q, %Q\n", x[11], x[12], x[13]); |
printf(" %Q, %Q, %Q\n", x[14], x[15], x[16]); |
*/ |
printf("%%rax=%Q, %%rcx=%Q, %%rdx=%Q\n",istate->rax,istate->rcx,istate->rdx); |
printf("%%rsi=%Q, %%rdi=%Q, %%r8 =%Q\n",istate->rsi,istate->rdi,istate->r8); |
printf("%%r9 =%Q, %%r10 =%Q, %%r11=%Q\n",istate->r9,istate->r10,istate->r11); |
#ifdef CONFIG_DEBUG_ALLREGS |
printf("%%r12=%Q, %%r13=%Q, %%r14=%Q\n",istate->r12,istate->r13,istate->r14); |
printf("%%r15=%Q, %%rbx=%Q, %%rbp=%Q\n",istate->r15,istate->rbx,&istate->rbp); |
#endif |
printf("%%rsp=%Q\n",&istate->stack[0]); |
} |
/* |