[BACK]Return to vector.S CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / amd64 / amd64

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/arch/amd64/amd64/vector.S between version 1.37 and 1.37.2.1

version 1.37, 2011/03/18 15:18:16 version 1.37.2.1, 2011/06/23 14:18:56
Line 476  IDTVEC(resume_lapic_ltimer)
Line 476  IDTVEC(resume_lapic_ltimer)
   
 #ifndef XEN  #ifndef XEN
 /*  /*
  * Multicast TLB shootdown handler for !kernel_pmap.   * TLB shootdown handler.
  */   */
 IDTVEC(intr_lapic_tlb_mcast)  IDTVEC(intr_lapic_tlb)
         /*          pushq   $0
          * Save state, ack interrupt and count it.  Count locally          pushq   $T_ASTFLT
          * so other CPUs don't have to touch the counter's line.          INTRENTRY
          */  
         testq   $SEL_UPL,8(%rsp)  
         jz      0f  
         swapgs  
 0:  
         pushq   %rax  
         pushq   %rbx  
         pushq   %rdi  
         pushq   %rsi  
         pushq   %rdx  
         pushq   %rcx  
         pushq   %r8  
         pushq   %r9  
         incq    CPUVAR(TLB_EVCNT)+EV_COUNT  
         /* Find out what needs to be invalidated and unlock the mailbox. */  
         movq    CPUVAR(PMAP_CPU),%rcx  
         movq    MB_ADDR1(%rcx), %rax  
         movq    MB_ADDR2(%rcx), %rdx  
         xorq    %rbx, %rbx  
         xchgq   MB_POINTER(%rcx), %rbx  
         movl    $0, _C_LABEL(local_apic)+LAPIC_EOI  
         cmpq    $-1, %rax  
         je      5f  
 1:  
         /* Invalidate a single page or a range of pages. */  
         invlpg  (%rax)  
         addq    $PAGE_SIZE, %rax  
         cmpq    %rdx, %rax  
         jb      1b  
 2:  
         /* Ack the request. */  
         lock  
         incq    (%rbx)  
         /*  
          * Check the current TLB state.  If we don't want further  
          * invalidations for this pmap, then take the CPU out of  
          * the pmap's bitmask.  
          */  
         cmpl    $TLBSTATE_LAZY, CPUVAR(TLBSTATE)  
         jne     3f  
         movq    CPUVAR(PMAP), %rdx  
         movl    CPUVAR(CPUMASK), %ecx  
         notl    %ecx  
         lock  
         andl    %ecx, PM_CPUS(%rdx)  
         movl    $TLBSTATE_STALE, CPUVAR(TLBSTATE)  
 3:  
         /* Restore state and return. */  
         popq    %r9  
         popq    %r8  
         popq    %rcx  
         popq    %rdx  
         popq    %rsi  
         popq    %rdi  
         popq    %rbx  
         popq    %rax  
         testq   $SEL_UPL, 8(%rsp)  
         jz      4f  
         swapgs  
 4:  
         iretq  
 5:  
         /*  
          * Get the emap generation number.  Invalidate user TLB entries.  
          * Perform emap update, pass the generation number.  Note that  
          * caller-save registers might be modified (all saved in the  
          * beginning).  Only %rbx value is used by 2b context.  
          */  
         callq   _C_LABEL(uvm_emap_gen_return)  
         movq    %rax, %rdi  
         movq    %cr3, %rax  
         movq    %rax, %cr3  
         callq   _C_LABEL(uvm_emap_update)  
         jmp     2b  
   
 /*  
  * Broadcast TLB shootdown handler for kernel_pmap.  
  */  
 IDTVEC(intr_lapic_tlb_bcast)  
         testq   $SEL_UPL,8(%rsp)  
         jz      0f  
         swapgs  
 0:  
         /* Save state. */  
         pushq   %rax  
         pushq   %rdi  
         pushq   %rsi  
         pushq   %rdx  
         pushq   %rcx  
         pushq   %r8  
         pushq   %r9  
         /* Find out what needs to be invalidated. */  
         movq    _C_LABEL(pmap_mbox)+MB_ADDR1, %rax  
         movq    _C_LABEL(pmap_mbox)+MB_ADDR2, %rdx  
         movq    _C_LABEL(pmap_mbox)+MB_GLOBAL, %rdi  
         movl    $0, _C_LABEL(local_apic)+LAPIC_EOI          movl    $0, _C_LABEL(local_apic)+LAPIC_EOI
         cmpq    $-1, %rax          callq   _C_LABEL(pmap_tlb_intr)
         je      3f          INTRFASTEXIT
 1:  
         /* Invalidate a single page or a range of pages. */  
         invlpg  (%rax)  
         addq    $PAGE_SIZE, %rax  
         cmpq    %rdx, %rax  
         jb      1b  
 2:  
         /* Notify waiter of completion, restore state & return */  
         lock  
         incq    _C_LABEL(pmap_mbox)+MB_TAIL  
         popq    %r9  
         popq    %r8  
         popq    %rcx  
         popq    %rdx  
         popq    %rsi  
         popq    %rdi  
         popq    %rax  
         testq   $SEL_UPL, 8(%rsp)  
         jz      5f  
         swapgs  
 5:  
         iretq  
 3:  
         testq   %rdi, %rdi  
         jz      4f  
         /*  
          * If we have been asked to invalidate the entire TLB we arrive here.  
          * Get the emap generation before flush, and use it after for update.  
          * Note that caller-save registers might be modified, though no  
          * registers need to be preserved for 2b context.  
          */  
         callq   _C_LABEL(uvm_emap_gen_return)  
         movq    %rax, %rdi  
         movq    %cr4, %rax  
         movq    %rax, %rdx  
         andq    $~CR4_PGE, %rdx  
         movq    %rdx, %cr4  
         movq    %rax, %cr4  
         callq   _C_LABEL(uvm_emap_update)  
         jmp     2b  
 4:  
         /*  
          * Get the emap generation number.  Invalidate user TLB entries.  
          * Perform emap update, pass the generation number.  Note that  
          * caller-save registers might be modified, though no registers  
          * need to be preserved for 2b context.  
          */  
         callq   _C_LABEL(uvm_emap_gen_return)  
         movq    %rax, %rdi  
         movq    %cr3, %rax  
         movq    %rax, %cr3  
         callq   _C_LABEL(uvm_emap_update)  
         jmp     2b  
   
 #endif /* !XEN */  #endif /* !XEN */
   

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.37.2.1

CVSweb <webmaster@jp.NetBSD.org>