/* clear_page.S: UltraSparc optimized clear page.1*2* Copyright (C) 1996, 1998, 1999, 2000, 2004 David S. Miller ([email protected])3* Copyright (C) 1997 Jakub Jelinek ([email protected])4*/56#include <asm/visasm.h>7#include <asm/thread_info.h>8#include <asm/page.h>9#include <asm/pgtable.h>10#include <asm/spitfire.h>11#include <asm/head.h>1213/* What we used to do was lock a TLB entry into a specific14* TLB slot, clear the page with interrupts disabled, then15* restore the original TLB entry. This was great for16* disturbing the TLB as little as possible, but it meant17* we had to keep interrupts disabled for a long time.18*19* Now, we simply use the normal TLB loading mechanism,20* and this makes the cpu choose a slot all by itself.21* Then we do a normal TLB flush on exit. We need only22* disable preemption during the clear.23*/2425.text2627.globl _clear_page28_clear_page: /* %o0=dest */29ba,pt %xcc, clear_page_common30clr %o43132/* This thing is pretty important, it shows up33* on the profiles via do_anonymous_page().34*/35.align 3236.globl clear_user_page37clear_user_page: /* %o0=dest, %o1=vaddr */38lduw [%g6 + TI_PRE_COUNT], %o239sethi %uhi(PAGE_OFFSET), %g240sethi %hi(PAGE_SIZE), %o44142sllx %g2, 32, %g243sethi %hi(PAGE_KERNEL_LOCKED), %g34445ldx [%g3 + %lo(PAGE_KERNEL_LOCKED)], %g346sub %o0, %g2, %g1 ! paddr4748and %o1, %o4, %o0 ! vaddr D-cache alias bit4950or %g1, %g3, %g1 ! TTE data51sethi %hi(TLBTEMP_BASE), %o35253add %o2, 1, %o454add %o0, %o3, %o0 ! TTE vaddr5556/* Disable preemption. */57mov TLB_TAG_ACCESS, %g358stw %o4, [%g6 + TI_PRE_COUNT]5960/* Load TLB entry. */61rdpr %pstate, %o462wrpr %o4, PSTATE_IE, %pstate63stxa %o0, [%g3] ASI_DMMU64stxa %g1, [%g0] ASI_DTLB_DATA_IN65sethi %hi(KERNBASE), %g166flush %g167wrpr %o4, 0x0, %pstate6869mov 1, %o47071clear_page_common:72VISEntryHalf73membar #StoreLoad | #StoreStore | #LoadStore74fzero %f075sethi %hi(PAGE_SIZE/64), %o176mov %o0, %g1 ! remember vaddr for tlbflush77fzero %f278or %o1, %lo(PAGE_SIZE/64), %o179faddd %f0, %f2, %f480fmuld %f0, %f2, %f681faddd %f0, %f2, %f882fmuld %f0, %f2, %f108384faddd %f0, %f2, %f1285fmuld %f0, %f2, %f14861: stda %f0, [%o0 + %g0] ASI_BLK_P87subcc %o1, 1, %o188bne,pt %icc, 1b89add %o0, 0x40, %o090membar #Sync91VISExitHalf9293brz,pn %o4, out94nop9596stxa %g0, [%g1] ASI_DMMU_DEMAP97membar #Sync98stw %o2, [%g6 + TI_PRE_COUNT]99100out: retl101nop102103104105