Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: arcbpsup.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 ============================================ | |
42 | id: @(#)arcbpsup.fth 1.16 06/02/16 | |
43 | purpose: | |
44 | copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | \ System-architecture-dependent definitions for breakpoints. | |
48 | ||
49 | headerless | |
50 | h# 17f constant breakpoint-trap# | |
51 | ||
52 | 0 value bp-vadr | |
53 | pagesize 2* constant bp-va-size | |
54 | bp-va-size 1- constant bp-va-mask | |
55 | ||
56 | h# 8000.0000 \ Class 2 | |
57 | h# 1000.0000 + \ condition always | |
58 | h# 1d0.0000 + \ Trap on Integer Condition Codes | |
59 | h# 2000 + \ Immediate | |
60 | breakpoint-trap# h# ff and + constant sun4u-bp-opcode | |
61 | ||
62 | : arch-bp-trap? ( -- flag ) last-trap# breakpoint-trap# = ; | |
63 | ||
64 | : page-valid? ( vadr -- flag ) | |
65 | \ This used to contain prom-virt? unfortunately that allows | |
66 | \ addresses that are in the VPT to be considered as valid stack | |
67 | \ pointers, so now we crop the range down to just OBP. BUGID: 4262883 | |
68 | dup ROMbase RAMtop between if pgmap@ valid-tte? exit then | |
69 | 0 find-client-tte if ( tte vadr ) | |
70 | 2drop true ( flag ) | |
71 | else ( ) | |
72 | false ( flag ) | |
73 | then ( flag ) | |
74 | ; | |
75 | ||
76 | ' page-valid? is accessible? | |
77 | ||
78 | : sun4u-op@ ( adr -- op|0 ) | |
79 | dup accessible? if l@ else drop 0 then | |
80 | ; | |
81 | : va>pa ( vadr -- pa.lo pa.hi true -or- false ) | |
82 | dup 0 find-client-tte if ( vadr tte vadr' ) | |
83 | drop tuck tte>size 1- and ( tte offset ) | |
84 | swap tte> >r or r> true ( pa.lo pa.hi true ) | |
85 | else ( vadr ) | |
86 | drop false ( false ) | |
87 | then | |
88 | ; | |
89 | : sun4u-op! ( op adr -- ) | |
90 | dup accessible? 0= if 2drop exit then ( op adr ) | |
91 | ||
92 | \ prom addresses cannot be breakpointed | |
93 | dup prom-virt? if 2drop exit then ( op adr ) | |
94 | ||
95 | dup va>pa if ( op vadr pa.lo pa.hi ) | |
96 | rot bp-va-mask and ( op pa.lo pa.hi offset ) | |
97 | dup bp-vadr or ( op pa.lo pa.hi bpoffset bpva ) | |
98 | 2>r r@ map-page ( op ) ( r: bpoffset bpva ) | |
99 | ||
100 | \ Store the instruction and IFLUSH | |
101 | r> instruction! r> ( bpoffset ) | |
102 | ||
103 | \ Force D$ displacement flush | |
104 | origin+ l@ drop ( ) | |
105 | \ trigger a demap of bp-vadr | |
106 | bp-vadr unmap-page ( ) | |
107 | else ( op adr ) | |
108 | 2drop ( ) | |
109 | then ( ) | |
110 | ; | |
111 | ||
112 | stand-init: Install breakpoint ops | |
113 | ['] sun4u-op@ is op@ | |
114 | ['] sun4u-op! is op! | |
115 | ['] arch-bp-trap? is breakpoint-trap? | |
116 | sun4u-bp-opcode is breakpoint-opcode | |
117 | bp-va-size dup mmu-claim is bp-vadr | |
118 | ; | |
119 |