Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / arch / sun4u / starthacks.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: starthacks.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: @(#)starthacks.fth 1.11 05/04/08
43purpose:
44copyright: Copyright 2005 Sun Microsystems, Inc. All Rights Reserved
45copyright: Use is subject to license terms.
46
47also hidden also
48
49headerless
50: monitor-interrupt-state ( -- )
51 \ I bet we get an interrupt right now
52 restartable? @ 0= if
53 h# 0d pil! ]unlock
54 then
55;
56: client-interrupt-state ( -- )
57;
58
59\ Actions to perform in order to recover from an error reset
60defer error-reset-cleanup ' noop is error-reset-cleanup
61
62: safe-execute ( method-name ihandle -- )
63 ?dup if ( method$ ihandle )
64 ['] $call-method catch if ( method$ ihandle )
65 3drop ( )
66 then ( )
67 else ( method$ )
68 2drop
69 then
70;
71
72\ This turns on the screen in case the screen went blank as the result
73\ of an error reset. Some SBus frame buffers tend to do that.
74: ?reset-video ( -- )
75 " reset-screen" stdout @ safe-execute
76;
77
78headers
79defer debugger-vocabulary-hook
80' noop is debugger-vocabulary-hook
81headerless
82: "restore" " restore" ;
83: enter-forth ( -- )
84 init-c-stack
85 monitor-interrupt-state
86 clear-keyboard
87
88 \ Just In case we were in the device tree.
89 device-end
90
91 \ Allow for custom search orders
92 debugger-vocabulary-hook
93
94 ?reset-video
95 error-reset-trap -1 = if
96 "restore" stdout @ safe-execute
97 "restore" stdin @ safe-execute
98 error-reset-cleanup
99 then
100 (handle-breakpoint
101;
102
103: exit-forth ( -- ) reset-interrupts (restart ;
104
105\ set the default state, and also force it in stand-init
106' enter-forth is handle-breakpoint
107' exit-forth is restart
108
109stand-init: Installing enter/exit handlers
110 ['] enter-forth is handle-breakpoint
111 ['] exit-forth is restart
112 ?mp-prompt
113;
114previous previous
115headers