Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: transien.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 | \ transien.fth 2.10 99/05/04 | |
43 | \ Copyright 1985-1990 Bradley Forthware | |
44 | ||
45 | \ Transient vocabulary | |
46 | \ | |
47 | \ transient ( -- ) Compile following definitions into the | |
48 | \ transient dictionary | |
49 | \ Nested 'transient's are *not* allowed | |
50 | \ resident ( -- ) Compile following definitions into the resident | |
51 | \ dictionary. | |
52 | ||
53 | decimal | |
54 | 0 value transize | |
55 | 0 value transtart | |
56 | ||
57 | 0 value there | |
58 | 0 value hedge | |
59 | 0 value ouser | |
60 | \ Two dictionary pointers exist, for transient space and | |
61 | \ resident space. "Here" always points to the set currently being used. | |
62 | \ "There" points to the "other" one. | |
63 | \ "limit" is top of current space, "hedge" is top of other space | |
64 | \ "ouser" is the other user area allocation pointer. | |
65 | 0 value transient? | |
66 | ||
67 | hex | |
68 | : set-transize ( transient-size user-transient-size -- ) | |
69 | over 0= if ( 0 user-transient-size ) | |
70 | transize if ( 0 user-transient-size ) | |
71 | transtart transize + is limit ( 0 user-transient-size ) | |
72 | then ( 0 user-transient-size ) | |
73 | drop is transize ( ) | |
74 | exit | |
75 | then | |
76 | ||
77 | there transtart <> abort" Cannot change transient area unless unused." | |
78 | ||
79 | user-size swap - is ouser | |
80 | ||
81 | is transize | |
82 | limit is hedge \ Top of transient space | |
83 | hedge transize - is transtart | |
84 | transtart is there | |
85 | transtart is limit | |
86 | ; | |
87 | decimal | |
88 | \ \t16 decimal 30000 set-transize | |
89 | \ \t32 decimal 40000 set-transize | |
90 | ||
91 | : exchange ( -- ) \ switch "here" with "there" | |
92 | here there dp ! is there | |
93 | limit hedge is limit is hedge | |
94 | ||
95 | #user @ ouser #user ! is ouser | |
96 | \ XXX need to support limit checking for user area too. | |
97 | ; | |
98 | ||
99 | : in-any-dictionary? ( adr -- flag ) | |
100 | dup origin here between ( adr flag ) | |
101 | transize if | |
102 | swap transtart dup transize + between or | |
103 | else | |
104 | nip | |
105 | then | |
106 | ; | |
107 | ' in-any-dictionary? is in-dictionary? | |
108 | ||
109 | false value suppress-transient? | |
110 | : transient ( -- ) | |
111 | suppress-transient? if exit then | |
112 | transient? abort" Nested transient's not allowed" | |
113 | true is transient? | |
114 | exchange | |
115 | ; | |
116 | : resident ( -- ) transient? if false is transient? exchange then ; | |
117 | ||
118 | : headerless: ( r-xt -- ) origin+ create 0 setalias ; | |
119 | : header: ( r-xt -- ) drop [compile] \ ; immediate |