Changeset 53f9821 in mainline for arch/amd64


Ignore:
Timestamp:
2006-03-20T20:32:17Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
018d957e
Parents:
9d3e185
Message:

Cleanup of spinlocks, now compiles both ia32 and amd64 with
and without DEBUG_SPINLOCKS. Made spinlocks inline.
Moved syscall_handler to generic (it was identical for ia32,amd64 & mips32).
Made slightly faster syscall for ia32.
Made better interrupt routines for ia32.
Allow not saving non-scratch registers during interrupt on ia32,amd64,mips32.
Aligned interrupt handlers on ia32,amd64, this should prevent problems
with different instruction lengths.

Location:
arch/amd64
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/atomic.h

    r9d3e185 r53f9821  
    3131
    3232#include <arch/types.h>
     33#include <arch/barrier.h>
     34#include <preemption.h>
    3335
    3436typedef struct { volatile __u64 count; } atomic_t;
     
    102104
    103105
    104 extern void spinlock_arch(volatile int *val);
     106/** AMD64 specific fast spinlock */
     107static inline void atomic_lock_arch(atomic_t *val)
     108{
     109        __u64 tmp;
     110
     111        preemption_disable();
     112        __asm__ volatile (
     113                "0:;"
     114#ifdef CONFIG_HT
     115                "pause;" /* Pentium 4's HT love this instruction */
     116#endif
     117                "mov %0, %1;"
     118                "testq %1, %1;"
     119                "jnz 0b;"       /* Leightweight looping on locked spinlock */
     120               
     121                "incq %1;"      /* now use the atomic operation */
     122                "xchgq %0, %1;"
     123                "testq %1, %1;"
     124                "jnz 0b;"
     125                : "=m"(val->count),"=r"(tmp)
     126                );
     127        /*
     128         * Prevent critical section code from bleeding out this way up.
     129         */
     130        CS_ENTER_BARRIER();
     131}
    105132
    106133#endif
  • arch/amd64/include/syscall.h

    r9d3e185 r53f9821  
    3232#include <arch/types.h>
    3333
    34 extern __native syscall_handler(__native a1,__native a2, __native a3,
    35                                 __native a4, __native id);
    3634extern void syscall_setup_cpu(void);
    3735
  • arch/amd64/src/interrupt.c

    r9d3e185 r53f9821  
    5555        printf("ERROR_WORD=%Q\n", istate->error_word);
    5656        printf("%%rcs=%Q, flags=%Q, %%cr0=%Q\n", istate->cs, istate->rflags,read_cr0());
    57         printf("%%rax=%Q, %%rbx=%Q, %%rcx=%Q\n",istate->rax,istate->rbx,istate->rcx);
    58         printf("%%rdx=%Q, %%rsi=%Q, %%rdi=%Q\n",istate->rdx,istate->rsi,istate->rdi);
    59         printf("%%r8 =%Q, %%r9 =%Q, %%r10=%Q\n",istate->r8,istate->r9,istate->r10);
    60         printf("%%r11=%Q, %%r12=%Q, %%r13=%Q\n",istate->r11,istate->r12,istate->r13);
    61         printf("%%r14=%Q, %%r15=%Q, %%rsp=%Q\n",istate->r14,istate->r15,&istate->stack[0]);
    62         printf("%%rbp=%Q\n",istate->rbp);
    63 /*     
    64         printf("stack: %Q, %Q, %Q\n", x[5], x[6], x[7]);
    65         printf("       %Q, %Q, %Q\n", x[8], x[9], x[10]);
    66         printf("       %Q, %Q, %Q\n", x[11], x[12], x[13]);
    67         printf("       %Q, %Q, %Q\n", x[14], x[15], x[16]);
    68 */
     57        printf("%%rax=%Q, %%rcx=%Q, %%rdx=%Q\n",istate->rax,istate->rcx,istate->rdx);
     58        printf("%%rsi=%Q, %%rdi=%Q, %%r8 =%Q\n",istate->rsi,istate->rdi,istate->r8);
     59        printf("%%r9 =%Q, %%r10 =%Q, %%r11=%Q\n",istate->r9,istate->r10,istate->r11);
     60#ifdef CONFIG_DEBUG_ALLREGS     
     61        printf("%%r12=%Q, %%r13=%Q, %%r14=%Q\n",istate->r12,istate->r13,istate->r14);
     62        printf("%%r15=%Q, %%rbx=%Q, %%rbp=%Q\n",istate->r15,istate->rbx,&istate->rbp);
     63#endif
     64        printf("%%rsp=%Q\n",&istate->stack[0]);
    6965}
    7066
  • arch/amd64/src/syscall.c

    r9d3e185 r53f9821  
    6161        write_msr(AMD_MSR_SFMASK, 0x200);
    6262}
    63 
    64 /** Dispatch system call */
    65 __native syscall_handler(__native a1, __native a2, __native a3,
    66                          __native a4, __native id)
    67 {
    68         if (id < SYSCALL_END)
    69                 return syscall_table[id](a1,a2,a3,a4);
    70         else
    71                 panic("Undefined syscall %d", id);
    72 }
Note: See TracChangeset for help on using the changeset viewer.