1 \ *****************************************************************************
2 \ * Copyright (c) 2004, 2008 IBM Corporation
3 \ * All rights reserved.
4 \ * This program and the accompanying materials
5 \ * are made available under the terms of the BSD License
6 \ * which accompanies this distribution, and is available at
7 \ * http://www.opensource.org/licenses/bsd-license.php
10 \ * IBM Corporation - initial implementation
11 \ ****************************************************************************/
14 cell FIELD >r0 cell FIELD >r1 cell FIELD >r2 cell FIELD >r3
15 cell FIELD >r4 cell FIELD >r5 cell FIELD >r6 cell FIELD >r7
16 cell FIELD >r8 cell FIELD >r9 cell FIELD >r10 cell FIELD >r11
17 cell FIELD >r12 cell FIELD >r13 cell FIELD >r14 cell FIELD >r15
18 cell FIELD >r16 cell FIELD >r17 cell FIELD >r18 cell FIELD >r19
19 cell FIELD >r20 cell FIELD >r21 cell FIELD >r22 cell FIELD >r23
20 cell FIELD >r24 cell FIELD >r25 cell FIELD >r26 cell FIELD >r27
21 cell FIELD >r28 cell FIELD >r29 cell FIELD >r30 cell FIELD >r31
22 cell FIELD >cr cell FIELD >xer cell FIELD >lr cell FIELD >ctr
23 cell FIELD >srr0 cell FIELD >srr1 cell FIELD >dar cell FIELD >dsisr
28 : .16 10 0.r 3 spaces ;
29 : .8 8 spaces 8 0.r 3 spaces ;
30 : .4regs cr 4 0 DO dup @ .16 8 cells+ LOOP drop ;
32 cr ." R0 .. R7 R8 .. R15 R16 .. R23 R24 .. R31"
33 dup 8 0 DO dup .4regs cell+ LOOP drop
37 cr ." CR / XER LR / CTR SRR0 / SRR1 DAR / DSISR"
38 cr dup >cr @ .8 dup >lr @ .16 dup >srr0 @ .16 dup >dar @ .16
39 cr dup >xer @ .16 dup >ctr @ .16 dup >srr1 @ .16 >dsisr @ .8
48 : .hw-exception ( reason-code exception-nr -- )
51 200 OF ." Machine Check" ENDOF
52 300 OF ." Data Storage" ENDOF
53 380 OF ." Data Segment" ENDOF
54 400 OF ." Instruction Storage" ENDOF
55 480 OF ." Instruction Segment" ENDOF
56 500 OF ." External" ENDOF
57 600 OF ." Alignment" ENDOF
58 700 OF ." Program" ENDOF
59 800 OF ." Floating-point unavailable" ENDOF
60 900 OF ." Decrementer" ENDOF
61 980 OF ." Hypervisor Decrementer" ENDOF
62 C00 OF ." System Call" ENDOF
63 D00 OF ." Trace" ENDOF
64 F00 OF ." Performance Monitor" ENDOF
65 F20 OF ." VMX Unavailable" ENDOF
66 1200 OF ." System Error" ENDOF
67 1600 OF ." Maintenance" ENDOF
68 1800 OF ." Thermal" ENDOF
69 dup OF ." Unknown" ENDOF
71 ." Exception [ " . ." ]"
74 : .sw-exception ( exception-nr -- )
75 ." Exception [ " . ." ] triggered by boot firmware."
78 \ this word gets also called for non-hardware exceptions.
79 : be-hw-exception ( [reason-code] exception-nr -- )
81 dup 0> IF .hw-exception ELSE .sw-exception THEN
84 ' be-hw-exception to hw-exception-handler
86 : (boot-exception-handler) ( x1...xn exception-nr -- x1...xn)
89 negate cp 9 emit ." : " type
92 -6d OF cr ." W3411: Client application returned." cr ENDOF
93 -6c OF cr ." E3400: It was not possible to boot from any device "
94 ." specified in the VPD." cr
96 -6b OF cr ." E3410: Boot list successfully read from VPD "
97 ." but no useful information received." cr
99 -6a OF cr ." E3420: Boot list could not be read from VPD." cr
102 cr ." E3406: Client application returned an error"
103 abort"-str @ count dup IF
110 -68 OF cr ." E3405: No such device" cr ENDOF
111 -67 OF cr ." E3404: Not a bootable device!" cr ENDOF
112 -66 OF cr ." E3408: Failed to claim memory for the executable" cr
114 -65 OF cr ." E3407: Load failed" cr ENDOF
115 -64 OF cr ." E3403: Bad executable: " abort"-str @ count type cr
117 -63 OF cr ." E3409: Unknown FORTH Word" cr ENDOF
118 -2 OF cr ." E3401: Aborting boot, " abort"-str @ count type cr
120 dup OF ." E3402: Aborting boot, internal error" cr ENDOF
128 ' (boot-exception-handler) to boot-exception-handler
130 : throw-error ( error-code "error-string" -- )
131 skipws 0a parse rot throw
134 \ Enable external interrupt in msr
136 : enable-ext-int ( -- )
140 \ Disable external interrupt in msr
142 : disable-ext-int ( -- )
143 msr@ 8000 not and msr!
146 \ Generate external interrupt through Internal Interrupt Controller of BE
149 7fffffff dec! \ Reset decrementer
150 enable-ext-int \ Enable interrupt
151 FF 20000508418 rx! \ Interrupt priority mask
152 10 20000508410 rx! \ Interrupt priority