1 | # $Id: biosorg_check.sed 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # For converting biosorg_check_<addr> lines in a wlink mapfile
|
---|
4 | # to kmk_expr checks.
|
---|
5 | #
|
---|
6 |
|
---|
7 | #
|
---|
8 | # Copyright (C) 2012-2022 Oracle and/or its affiliates.
|
---|
9 | #
|
---|
10 | # This file is part of VirtualBox base platform packages, as
|
---|
11 | # available from https://www.virtualbox.org.
|
---|
12 | #
|
---|
13 | # This program is free software; you can redistribute it and/or
|
---|
14 | # modify it under the terms of the GNU General Public License
|
---|
15 | # as published by the Free Software Foundation, in version 3 of the
|
---|
16 | # License.
|
---|
17 | #
|
---|
18 | # This program is distributed in the hope that it will be useful, but
|
---|
19 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | # General Public License for more details.
|
---|
22 | #
|
---|
23 | # You should have received a copy of the GNU General Public License
|
---|
24 | # along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
25 | #
|
---|
26 | # SPDX-License-Identifier: GPL-3.0-only
|
---|
27 | #
|
---|
28 |
|
---|
29 |
|
---|
30 | /biosorg_check_at_/b check_at
|
---|
31 | /biosorg_check_before_or_at_/b check_before_or_at
|
---|
32 | b end
|
---|
33 |
|
---|
34 | :check_at
|
---|
35 | #p # --debug
|
---|
36 | s/\(.*\)/\L\1/g
|
---|
37 | s/....:\(....\). *biosorg_check_at_0\(\1\)h *//
|
---|
38 | /^$/b end
|
---|
39 | q 1
|
---|
40 | b end
|
---|
41 |
|
---|
42 | # after or equal.
|
---|
43 | :check_before_or_at
|
---|
44 | #p # --debug
|
---|
45 | s/\(.*\)/\L\1/g
|
---|
46 |
|
---|
47 | h
|
---|
48 | s/^....:\(....\). *biosorg_check_before_or_at_0\(....\)h */\2/
|
---|
49 | x
|
---|
50 | s/^....:\(....\)/\1 /
|
---|
51 |
|
---|
52 |
|
---|
53 | # Loop for comparing the two addresses. The one in the pattern buffer (left) must be
|
---|
54 | # smaller or equal to the one in in the pattern buffer (BIOSORG address).
|
---|
55 | :compare_loop
|
---|
56 | /^f/b match_f_or_greater
|
---|
57 | /^e/b match_e_or_greater
|
---|
58 | /^d/b match_d_or_greater
|
---|
59 | /^c/b match_c_or_greater
|
---|
60 | /^b/b match_b_or_greater
|
---|
61 | /^a/b match_a_or_greater
|
---|
62 | /^9/b match_9_or_greater
|
---|
63 | /^8/b match_8_or_greater
|
---|
64 | /^7/b match_7_or_greater
|
---|
65 | /^6/b match_6_or_greater
|
---|
66 | /^5/b match_5_or_greater
|
---|
67 | /^4/b match_4_or_greater
|
---|
68 | /^3/b match_3_or_greater
|
---|
69 | /^2/b match_2_or_greater
|
---|
70 | /^1/b match_1_or_greater
|
---|
71 | /^0/b match_0_or_greater
|
---|
72 | :bad
|
---|
73 | p
|
---|
74 | x
|
---|
75 | p
|
---|
76 | q 1
|
---|
77 | b end
|
---|
78 |
|
---|
79 | :bad_other
|
---|
80 | x
|
---|
81 | b bad
|
---|
82 |
|
---|
83 |
|
---|
84 | :match_f_or_greater
|
---|
85 | x
|
---|
86 | /^f/b next_compare
|
---|
87 | b bad_other
|
---|
88 |
|
---|
89 | :match_e_or_greater
|
---|
90 | x
|
---|
91 | /^f/b end
|
---|
92 | /^e/b next_compare
|
---|
93 | b bad_other
|
---|
94 |
|
---|
95 | :match_d_or_greater
|
---|
96 | x
|
---|
97 | /^[e-f]/b end
|
---|
98 | /^d/b next_compare
|
---|
99 | b bad_other
|
---|
100 |
|
---|
101 | :match_c_or_greater
|
---|
102 | x
|
---|
103 | /^[d-f]/b end
|
---|
104 | /^c/b next_compare
|
---|
105 | b bad_other
|
---|
106 |
|
---|
107 | :match_b_or_greater
|
---|
108 | x
|
---|
109 | /^[c-f]/b end
|
---|
110 | /^b/b next_compare
|
---|
111 | b bad_other
|
---|
112 |
|
---|
113 | :match_a_or_greater
|
---|
114 | x
|
---|
115 | /^[b-f]/b end
|
---|
116 | /^a/b next_compare
|
---|
117 | b bad_other
|
---|
118 |
|
---|
119 | :match_9_or_greater
|
---|
120 | x
|
---|
121 | /^[a-f]/b end
|
---|
122 | /^9/b next_compare
|
---|
123 | b bad_other
|
---|
124 |
|
---|
125 | :match_8_or_greater
|
---|
126 | x
|
---|
127 | /^[9a-f]/b end
|
---|
128 | /^8/b next_compare
|
---|
129 | b bad_other
|
---|
130 |
|
---|
131 | :match_7_or_greater
|
---|
132 | x
|
---|
133 | /^[8-9a-f]/b end
|
---|
134 | /^7/b next_compare
|
---|
135 | b bad_other
|
---|
136 |
|
---|
137 | :match_6_or_greater
|
---|
138 | x
|
---|
139 | /^[7-9a-f]/b end
|
---|
140 | /^6/b next_compare
|
---|
141 | b bad_other
|
---|
142 |
|
---|
143 | :match_5_or_greater
|
---|
144 | x
|
---|
145 | /^[6-9a-f]/b end
|
---|
146 | /^5/b next_compare
|
---|
147 | b bad_other
|
---|
148 |
|
---|
149 | :match_4_or_greater
|
---|
150 | x
|
---|
151 | /^[5-9a-f]/b end
|
---|
152 | /^4/b next_compare
|
---|
153 | b bad_other
|
---|
154 |
|
---|
155 | :match_3_or_greater
|
---|
156 | x
|
---|
157 | /^[4-9a-f]/b end
|
---|
158 | /^3/b next_compare
|
---|
159 | b bad_other
|
---|
160 |
|
---|
161 | :match_2_or_greater
|
---|
162 | x
|
---|
163 | /^[3-9a-f]/b end
|
---|
164 | /^2/b next_compare
|
---|
165 | b bad_other
|
---|
166 |
|
---|
167 | :match_1_or_greater
|
---|
168 | x
|
---|
169 | /^[2-9a-f]/b end
|
---|
170 | /^1/b next_compare
|
---|
171 | b bad_other
|
---|
172 |
|
---|
173 | :match_0_or_greater
|
---|
174 | x
|
---|
175 | /^[1-9a-f]/b end
|
---|
176 | /^0/b next_compare
|
---|
177 | b bad_other
|
---|
178 |
|
---|
179 |
|
---|
180 | # Next round of the loop.
|
---|
181 | # 1. Drop the leading digit of the max address (BIOSORG).
|
---|
182 | # 2. Check if we've reached end of the address. If so, check that we've reached the space in the actual address.
|
---|
183 | # 3. Switch buffers so the actual address in the pattern space.
|
---|
184 | # 4. Drop the leading digit of the actual address.
|
---|
185 | # 5. Repeat.
|
---|
186 | :next_compare
|
---|
187 | s/^.//
|
---|
188 | /^$/b end_of_compare
|
---|
189 | x
|
---|
190 | s/^.//
|
---|
191 | b compare_loop
|
---|
192 |
|
---|
193 | :end_of_compare
|
---|
194 | x
|
---|
195 | /^. /b end
|
---|
196 | b bad
|
---|
197 |
|
---|
198 | :end
|
---|
199 |
|
---|