|
1 | 1 | // SPDX-License-Identifier: GPL-2.0
|
2 | 2 | /* Copyright (C) 2019 ARM Limited */
|
| 3 | + |
| 4 | +#include <ctype.h> |
| 5 | +#include <string.h> |
| 6 | + |
3 | 7 | #include "testcases.h"
|
4 | 8 |
|
5 | 9 | struct _aarch64_ctx *get_header(struct _aarch64_ctx *head, uint32_t magic,
|
@@ -109,14 +113,15 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err)
|
109 | 113 | bool terminated = false;
|
110 | 114 | size_t offs = 0;
|
111 | 115 | int flags = 0;
|
112 |
| - int new_flags; |
| 116 | + int new_flags, i; |
113 | 117 | struct extra_context *extra = NULL;
|
114 | 118 | struct sve_context *sve = NULL;
|
115 | 119 | struct za_context *za = NULL;
|
116 | 120 | struct _aarch64_ctx *head =
|
117 | 121 | (struct _aarch64_ctx *)uc->uc_mcontext.__reserved;
|
118 | 122 | void *extra_data = NULL;
|
119 | 123 | size_t extra_sz = 0;
|
| 124 | + char magic[4]; |
120 | 125 |
|
121 | 126 | if (!err)
|
122 | 127 | return false;
|
@@ -194,11 +199,19 @@ bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err)
|
194 | 199 | /*
|
195 | 200 | * A still unknown Magic: potentially freshly added
|
196 | 201 | * to the Kernel code and still unknown to the
|
197 |
| - * tests. |
| 202 | + * tests. Magic numbers are supposed to be allocated |
| 203 | + * as somewhat meaningful ASCII strings so try to |
| 204 | + * print as such as well as the raw number. |
198 | 205 | */
|
| 206 | + memcpy(magic, &head->magic, sizeof(magic)); |
| 207 | + for (i = 0; i < sizeof(magic); i++) |
| 208 | + if (!isalnum(magic[i])) |
| 209 | + magic[i] = '?'; |
| 210 | + |
199 | 211 | fprintf(stdout,
|
200 |
| - "SKIP Unknown MAGIC: 0x%X - Is KSFT arm64/signal up to date ?\n", |
201 |
| - head->magic); |
| 212 | + "SKIP Unknown MAGIC: 0x%X (%c%c%c%c) - Is KSFT arm64/signal up to date ?\n", |
| 213 | + head->magic, |
| 214 | + magic[3], magic[2], magic[1], magic[0]); |
202 | 215 | break;
|
203 | 216 | }
|
204 | 217 |
|
|
0 commit comments