Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / arch / sun4v / diagprint.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: diagprint.fth
4\
5\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6\
7\ - Do no alter or remove copyright notices
8\
9\ - Redistribution and use of this software in source and binary forms, with
10\ or without modification, are permitted provided that the following
11\ conditions are met:
12\
13\ - Redistribution of source code must retain the above copyright notice,
14\ this list of conditions and the following disclaimer.
15\
16\ - Redistribution in binary form must reproduce the above copyright notice,
17\ this list of conditions and the following disclaimer in the
18\ documentation and/or other materials provided with the distribution.
19\
20\ Neither the name of Sun Microsystems, Inc. or the names of contributors
21\ may be used to endorse or promote products derived from this software
22\ without specific prior written permission.
23\
24\ This software is provided "AS IS," without a warranty of any kind.
25\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36\
37\ You acknowledge that this software is not designed, licensed or
38\ intended for use in the design, construction, operation or maintenance of
39\ any nuclear facility.
40\
41\ ========== Copyright Header End ============================================
42id: @(#)diagprint.fth 1.1 06/02/22
43purpose:
44copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
45copyright: Use is subject to license terms.
46
47hex
48
49\ %o6 = Count
50\ %o3 = String address
51\ %o2 = Scratch
52label puts
53 %o7 %o3 move \ Return Address
54 %o3 8 %o3 add \ Addr. of the first char.
55 %o3 %g0 %o6 ldub \ Count
56[ifdef] VERBOSE-RESET
57 begin
58 %o6 %g0 %g0 subcc
59 0> while
60 %o3 1 %o3 add \ (delay)
61 %o3 %g0 %o2 ldub
62 %o4 %o1 move
63 %o2 %o0 move
64 %g0 h# 61 %o5 add
65 %g0 h# 80 always htrapif
66 repeat
67 %o6 1 %o6 sub
68 %o3 4 %o3 add
69[else]
70 %o3 %o6 %o3 add \ end of string
71 %o3 5 %o3 add
72[then]
73 %o3 3 %o3 andn
74 %o3 %g0 %g0 jmpl
75 nop
76end-code
77alias diag-puts puts
78
79\ %o0 = number
80\
81\ %o4 = Return Address
82\ %o6 = Shift count
83\ %o3 = number
84\ %o2 = Scratch
85label puthex
86 %o7 %o4 move \ Return adr.
87[ifdef] VERBOSE-RESET
88 h# 3c %o6 set \ Shift count
89 %o0 %o3 move \ Number
90
91 begin
92 %o3 %o6 %o2 srlx
93 %o2 h# 0f %o2 and
94 %o2 h# 0a %g0 subcc
95 %o2 ascii 0 %o0 add
96 < if annul
97 %o2 ascii a h# 0a - %o0 add
98 then
99 %g0 h# 61 %o5 add
100 %g0 h# 80 always htrapif
101
102 %o6 h# 0f %g0 andcc
103 0= if %o6 %g0 %g0 subcc
104 0<> if
105 ascii . %o0 move
106 %g0 h# 61 %o5 add
107 %g0 h# 80 always htrapif
108 then
109 then
110 %o6 4 %o6 subcc
111 < until
112 nop
113 h# 20 %o0 move
114 %g0 h# 61 %o5 add
115 %g0 h# 80 always htrapif
116[then]
117 %o4 8 %g0 jmpl
118 nop
119end-code
120
121headers
122transient
123also assembler definitions
124
125: $print ( str$ -- )
126 puts call nop ", align
127;
128
129: print" ( -- ) \ string"
130 puts call nop ," align
131;
132
133: print-cr ( -- ) " "r"n" $print ;
134
135: print-reg ( reg -- )
136 puthex call %o0 move
137;
138
139: $diag-print ( str$ -- )
140 puts call nop ", align
141;
142
143: diag-print" ( -- ) \ string"
144 puts call nop ," align
145;
146
147: diag-print-cr ( -- ) " "r"n" $diag-print ;
148
149: diag-print-reg ( reg -- )
150 puthex call %o0 move
151;
152
153resident
154previous definitions