History

s390/extable: convert to relative table with data

Follow arm64, riscv, and x86 and change extable layout to common "relative table with data". This allows to get rid of s390 specific code in sorttable.c. The main difference to before is that extable entries do not contain a relative function pointer anymore. Instead data and type fields are added. The type field is used to indicate which exception handler needs to be called, while the data field is currently unused.

Heiko Carstens committed 4 years ago

Commit 3d667181 parent 46fee165 files · +46 −74Browse files

Showing the changes to scripts (1 of 5 files). Show all

Unified · Split

scripts/sorttable.c+1−42
@@ -261,45 +261,6 @@ static void sort_relative_table_with_data(char *extab_image, int image_size) · 260 unmodified lines
261 }261 }
262}262}
263 263
264static void s390_sort_relative_table(char *extab_image, int image_size)
265{
266 int i;
267
268 for (i = 0; i < image_size; i += 16) {
269 char *loc = extab_image + i;
270 uint64_t handler;
271
272 w(r((uint32_t *)loc) + i, (uint32_t *)loc);
273 w(r((uint32_t *)(loc + 4)) + (i + 4), (uint32_t *)(loc + 4));
274 /*
275 * 0 is a special self-relative handler value, which means that
276 * handler should be ignored. It is safe, because it means that
277 * handler field points to itself, which should never happen.
278 * When creating extable-relative values, keep it as 0, since
279 * this should never occur either: it would mean that handler
280 * field points to the first extable entry.
281 */
282 handler = r8((uint64_t *)(loc + 8));
283 if (handler)
284 handler += i + 8;
285 w8(handler, (uint64_t *)(loc + 8));
286 }
287
288 qsort(extab_image, image_size / 16, 16, compare_relative_table);
289
290 for (i = 0; i < image_size; i += 16) {
291 char *loc = extab_image + i;
292 uint64_t handler;
293
294 w(r((uint32_t *)loc) - i, (uint32_t *)loc);
295 w(r((uint32_t *)(loc + 4)) - (i + 4), (uint32_t *)(loc + 4));
296 handler = r8((uint64_t *)(loc + 8));
297 if (handler)
298 handler -= i + 8;
299 w8(handler, (uint64_t *)(loc + 8));
300 }
301}
302
303static int do_file(char const *const fname, void *addr)264static int do_file(char const *const fname, void *addr)
304{265{
305 int rc = -1;266 int rc = -1;
@@ -340,12 +301,10 @@ static int do_file(char const *const fname, void *addr) · 34 unmodified lines
340 case EM_386:301 case EM_386:
341 case EM_AARCH64:302 case EM_AARCH64:
342 case EM_RISCV:303 case EM_RISCV:
304 case EM_S390:
343 case EM_X86_64:305 case EM_X86_64:
344 custom_sort = sort_relative_table_with_data;306 custom_sort = sort_relative_table_with_data;
345 break;307 break;
346 case EM_S390:
347 custom_sort = s390_sort_relative_table;
348 break;
349 case EM_PARISC:308 case EM_PARISC:
350 case EM_PPC:309 case EM_PPC:
351 case EM_PPC64:310 case EM_PPC64:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t