Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / diag / assembly / isa3 / isa3_pa_watchpoint.s
CommitLineData
86530b38
AT
1/*
2* ========== Copyright Header Begin ==========================================
3*
4* OpenSPARC T2 Processor File: isa3_pa_watchpoint.s
5* Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
6* 4150 Network Circle, Santa Clara, California 95054, U.S.A.
7*
8* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9*
10* This program is free software; you can redistribute it and/or modify
11* it under the terms of the GNU General Public License as published by
12* the Free Software Foundation; version 2 of the License.
13*
14* This program is distributed in the hope that it will be useful,
15* but WITHOUT ANY WARRANTY; without even the implied warranty of
16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17* GNU General Public License for more details.
18*
19* You should have received a copy of the GNU General Public License
20* along with this program; if not, write to the Free Software
21* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*
23* For the avoidance of doubt, and except that if any non-GPL license
24* choice is available it will apply instead, Sun elects to use only
25* the General Public License version 2 (GPLv2) at this time for any
26* software where a choice of GPL license versions is made
27* available with the language indicating that GPLv2 or any later version
28* may be used, or where a choice of which version of the GPL is applied is
29* otherwise unspecified.
30*
31* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
32* CA 95054 USA or visit www.sun.com if you need additional information or
33* have any questions.
34*
35*
36* ========== Copyright Header End ============================================
37*/
38#define MAIN_PAGE_HV_ALSO
39#define MAIN_PAGE_NUCLEUS_ALSO
40
41!# Set up PA trap
42#define H_HT0_PA_Watchpoint_0x61
43#define My_H_HT0_PA_Watchpoint_0x61 \
44 add %l7, 0x1, %l7; \
45 done; \
46 nop
47
48
49#include "hboot.s"
50
51/************************************************************************
52 Test case code start
53 ************************************************************************/
54
55.text
56.global main
57
58main: /* test begin */
59 ta T_CHANGE_HPRIV
60 mov 0x0, %l7 ! set watchpoint trap counter
61
62 setx user_data_start, %i0, %l0
63 add %l0, 0x3, %l0
64
65 /* Set data watchpoint */
66st_asi: wr %g0, ASI_DMMU_PA_WATCHPOINT, %asi
67 stxa %l0, [ASI_DMMU_PA_WATCHPOINT_VAL] %asi
68
69 /* Read data watchpoint */
70 ldxa [ASI_DMMU_PA_WATCHPOINT_VAL] %asi, %i0
71
72 /* Enable load PA watchpoint */
73 /* VM=0x55, PR=PW=1, VR=VW=0 */
74en_pa:
75 /* Mask = 0x55 */
76 set 0x55, %l1
77 sll %l1, 25, %l1
78
79 /* Read/write enable */
80 set 0x3, %l2
81 sll %l2, 23, %l2
82 or %l1, %l2, %l1
83
84 /* Mode = Data PA */
85 set 0x2, %l2
86 sllx %l2, 33, %l2
87 or %l1, %l2, %l1
88
89 /* Enable caches */
90 or %l1, 0x3, %l1
91
92 stxa %l1, [%g0] ASI_LSU_CONTROL
93
94 ta T_CHANGE_PRIV
95
96 /* Load data from watchpoint address */
97 setx user_data_start, %i0, %l0
98 ldx [%l0], %l1
99 ldsb [%l0+0x1], %l1 /* This one shouldn't cause a watchpoint trap */
100
101 /* Read ASI_LSU_CTL_REG */
102 ldxa [%g0] ASI_LSU_CONTROL, %i0
103
104 ! Check how many traps we've taken (should be one)
105 cmp %l7,0x1
106 bne bad_exit
107 nop
108 EXIT_GOOD
109bad_exit: EXIT_BAD
110
111/************************************************************************
112 Test case data start
113 ************************************************************************/
114.data
115
116user_data_start:
117.xword 0x0001020304050607
118.xword 0x08090a0b0c0d0e0f
119.xword 0x1011121314151617
120.xword 0x18191a1b1c1d1e1f
121.xword 0x2021222324252627
122.xword 0x28292a2b2c2d2e2f
123.xword 0x3031323334353637
124.xword 0x38393a3b3c3d3e3f
125.xword 0x4041424344454647
126.xword 0x48494a4b4c4d4e4f
127.xword 0x5051525354555657
128.xword 0x58595a5b5c5d5e5f
129.xword 0x6061626364656667
130.xword 0x68696a6b6c6d6e6f
131.xword 0x7071727374757677
132.xword 0x78797a7b7c7d7e7f
133.xword 0x8081828384858687
134.xword 0x88898a8b8c8d8e8f
135.xword 0x9091929394959697
136.xword 0x98999a9b9c9d9e9f
137.xword 0xa0a1a2a3a4a5a6a7
138.xword 0xa8a9aaabacadaeaf
139.xword 0xb0b1b2b3b4b5b6b7
140.xword 0xb8b9babbbcbdbebf
141.xword 0xc0c1c2c3c4c5c6c7
142.xword 0xc8c9cacbcccdcecf
143.xword 0xd0d1d2d3d4d5d6d7
144.xword 0xd8d9dadbdcdddedf
145.xword 0xe0e1e2e3e4e5e6e7
146.xword 0xe8e9eaebecedeeef
147.xword 0xf0f1f2f3f4f5f6f7
148.xword 0xf8f9fafbfcfdfeff
149.end