* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: replay.s
* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* For the avoidance of doubt, and except that if any non-GPL license
* choice is available it will apply instead, Sun elects to use only
* the General Public License version 2 (GPLv2) at this time for any
* software where a choice of GPL license versions is made
* available with the language indicating that GPLv2 or any later version
* may be used, or where a choice of which version of the GPL is applied is
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* ========== Copyright Header End ============================================
/*{{{ dump memory (rdaddr,wraddr, tempreg, tempreg1, count)*/
#define dump_memory(rdaddr,wraddr, tempreg, tempreg1, count) \
ldda [rdaddr]0xf0, %f0 ;\
stda %f0, [wraddr]0xe0 ;\
add rdaddr, 0x40, rdaddr ;\
subcc count, 0x40, count ;\
add wraddr, 0x40, wraddr ;\
/*{{{ dump pages (rdaddr,wraddr, temppage, tempreg, tempreg1, tempreg2, asi_num, stride, count)*/
#define PA_MASK 0x7ffffffe000
#define dump_pages(rdaddr,wraddr, temppage, tempreg, tempreg1, tempreg2, asi_num, stride, count) \
ldxa [%g0]0x45, tempreg1 ;\
sllx tempreg2, 48, tempreg2 ;\
xor tempreg1, tempreg2, tempreg1 ;\
xor tempreg1, 8, tempreg1 ;\
stxa tempreg1, [%g0]0x45 ;\
ldxa [rdaddr]asi_num, tempreg ;\
setx PA_MASK, tempreg2, tempreg1 ;\
srlx tempreg, 61, tempreg2 ;\
and tempreg, tempreg1, tempreg ;\
subcc tempreg2, 0x4, %g0 ;\
subcc tempreg2, 0x5, %g0 ;\
subcc tempreg2, 0x6, %g0 ;\
subcc tempreg2, 0x7, %g0 ;\
sllx tempreg1, 13, tempreg1 ;\
sllx tempreg1, 16, tempreg1 ;\
sllx tempreg1, 19, tempreg1 ;\
sllx tempreg1, 22, tempreg1 ;\
srlx tempreg, 40, tempreg2 ;\
andcc tempreg2, 7, tempreg2 ;\
stxa tempreg, [temppage]0x14 ;\
setx 0x4000e602100, tempreg, tempreg2 ;\
ldxa [temppage]0x14, tempreg ; \
stxa tempreg, [tempreg2]0x15 ; \
sllx tempreg1, 28, tempreg1 ;\
sllx tempreg, 28, tempreg ;\
ldda [tempreg]0xf0, %f0 ;\
stda %f0, [wraddr]0xe0 ;\
add tempreg, 0x40, tempreg ;\
subcc tempreg1, 0x40, tempreg1 ;\
add wraddr, 0x40, wraddr ;\
add rdaddr, stride, rdaddr ;\
ldxa [%g0]0x45, tempreg1 ;\
sllx tempreg2, 48, tempreg2 ;\
xor tempreg1, 8, tempreg1 ;\
xor tempreg1, tempreg2, tempreg1 ;\
stxa tempreg1, [%g0]0x45 ;\
!stxa wraddr, [tempreg2]0x15 ; \
!ldxa [tempreg]0x14, %f0 ;\
/*{{{ 64bit asi x8 dump (rdaddr,wraddr, tempaddr, tempreg, asi, stride, count)*/
#define asi_dump(rdaddr,wraddr, tempaddr, tempreg, asi_num, stride, count) \
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr] ;\
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr+0x8] ;\
ldd [tempaddr+0x8], %f2 ;\
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr+0x10] ;\
ldd [tempaddr+0x10], %f4 ;\
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr+0x18] ;\
ldd [tempaddr+0x18], %f6 ;\
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr+0x20] ;\
ldd [tempaddr+0x20], %f8 ;\
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr+0x28] ;\
ldd [tempaddr+0x28], %f10 ;\
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr+0x30] ;\
ldd [tempaddr+0x30], %f12 ;\
ldxa [rdaddr]asi_num, tempreg ;\
add rdaddr, stride, rdaddr ;\
stx tempreg,[tempaddr+0x38] ;\
ldd [tempaddr+0x38], %f14 ;\
stda %f0, [wraddr]0xf0 ;\
add wraddr, 0x40, wraddr ;\
!copy data out to memory ;\
! ldda [tempaddr]0xf0,%f0 ;\
#define dmmu_off(tempreg1, tempreg2) \
sllx tempreg2, 48, tempreg2 ;\
ldxa [%g0]0x45, tempreg1 ;\
or tempreg1, tempreg2, tempreg1 ;\
andn tempreg1, 8, tempreg1 ;\
stxa tempreg1, [%g0]0x45 ;\
#define dmmu_on(tempreg1, tempreg2) \
sllx tempreg2, 48, tempreg2 ;\
ldxa [%g0]0x45, tempreg1 ;\
andn tempreg1, tempreg2, tempreg1 ;\
or tempreg1, 8, tempreg1 ;\
stxa tempreg1, [%g0]0x45 ;\
setx DUMP_BASE_ADDR, %g3, %g1
ldxa [%g0]ASI_INTR_ID, %g3
!xxx fprs should be part of checkpoint
/*{{{ dump sparc registers*/
!get gl correct here, and copy %g5 into correct gl level
ldxa [%g0]ASI_INTR_ID, %g1
!blow away TLB contents in case they upset new stuff
setx 0x00ffffffffffe000, %g1, %g7
!don't write entry into TLB if not valid (might evict an earlier valid entry with same VA/ctx)
/*{{{ load itlb again - only entries with used bit*/
setx 0x00ffffffffffe000, %g1, %g7
!don't write entry into TLB if not valid (might evict an earlier valid entry with same VA/ctx)
!don't write entry a second time if we don't want to set used bit
setx 0x00ffffffffffe000, %g1, %g7
!don't write entry into TLB if not valid (might evict an earlier valid entry with same VA/ctx)
/*{{{ load dtlb again - only entries with used bit*/
setx 0x00ffffffffffe000, %g1, %g7
!don't write entry into TLB if not valid (might evict an earlier valid entry with same VA/ctx)
!don't write entry a second time if we don't want to set used bit
setx DUMP_BASE_ADDR, %g3, %g1
!sync up all the stick regs
!setx 0x80000010, %g1, %g3
setx DUMP_BASE_ADDR, %g3, %g1
ldxa [%g0]ASI_INTR_ID, %g3
/*{{{ spin waiting for all threads to arrive...*/
#define NUM_THREADS THREAD_COUNT
!wait for all threads to set sync byte
subcc %g2, (NUM_THREADS-1), %g0
subcc %g5, NUM_THREADS, %g0
!wait for all threads to set sync byte
subcc %g2, (NUM_THREADS-1), %g0
subcc %g5, NUM_THREADS, %g0
!wait for all threads to clear sync byte
subcc %g2, (NUM_THREADS-1), %g0
!wait for all threads to clear sync byte
subcc %g2, (NUM_THREADS-1), %g0
!sync up all the stick regs
!setx 0x80000010, %g1, %g3
!poke interrupt units to deliver anything pending
ldxa [%g0]ASI_INTR_ID, %g3
!cpuids: 0x2 0x5 0x8 0x9 0xa 0xb 0xd 0xf 0x11 0x14 0x15 0x18 0x1a 0x1b 0x1d 0x1e 0x1f
!cpuids: 0x2 0x5 0x8 0x9 0xa 0xb 0xd 0xf 0x11 0x14 0x15 0x18 0x1a 0x1b 0x1d 0x1e 0x1f