@@ -139,6 +139,6 @@ int reginfo_dump(struct reginfo *ri, FILE * f);
int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f);
/* return size of reginfo */
-const int reginfo_size(void);
+int reginfo_size(struct reginfo *ri);
#endif /* RISU_H */
@@ -40,7 +40,7 @@ int send_register_info(write_fn write_fn, void *uc)
case OP_TESTEND:
case OP_COMPARE:
default:
- header.size = reginfo_size();
+ header.size = reginfo_size(&ri);
extra = &ri;
break;
@@ -121,8 +121,9 @@ int recv_and_compare_register_info(read_fn read_fn,
/* Do a simple register compare on (a) explicit request
* (b) end of test (c) a non-risuop UNDEF
*/
- if (header.size != reginfo_size() ||
- read_fn(&apprentice_ri, header.size)) {
+ if (header.size > sizeof(struct reginfo) ||
+ read_fn(&apprentice_ri, header.size) ||
+ header.size != reginfo_size(&apprentice_ri)) {
packet_mismatch = 1;
resp = 2;
} else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) {
@@ -69,7 +69,7 @@ void process_arch_opt(int opt, const char *arg)
#endif
}
-const int reginfo_size(void)
+int reginfo_size(struct reginfo *ri)
{
int size = offsetof(struct reginfo, simd.end);
#ifdef SVE_MAGIC
@@ -194,7 +194,7 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc)
/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */
int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2)
{
- return memcmp(r1, r2, reginfo_size()) == 0;
+ return memcmp(r1, r2, reginfo_size(r1)) == 0;
}
#ifdef SVE_MAGIC
@@ -36,7 +36,7 @@ void process_arch_opt(int opt, const char *arg)
abort();
}
-const int reginfo_size(void)
+int reginfo_size(struct reginfo *ri)
{
return sizeof(struct reginfo);
}
@@ -74,7 +74,7 @@ void process_arch_opt(int opt, const char *arg)
}
}
-const int reginfo_size(void)
+int reginfo_size(struct reginfo *ri)
{
return sizeof(struct reginfo);
}
@@ -23,7 +23,7 @@ void process_arch_opt(int opt, const char *arg)
abort();
}
-const int reginfo_size(void)
+int reginfo_size(struct reginfo *ri)
{
return sizeof(struct reginfo);
}
@@ -32,7 +32,7 @@ void process_arch_opt(int opt, const char *arg)
abort();
}
-const int reginfo_size(void)
+int reginfo_size(struct reginfo *ri)
{
return sizeof(struct reginfo);
}
This will allow dumping of SVE frames without having to know the SVE vector length beforehand. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- risu.h | 2 +- reginfo.c | 7 ++++--- risu_reginfo_aarch64.c | 4 ++-- risu_reginfo_arm.c | 2 +- risu_reginfo_i386.c | 2 +- risu_reginfo_m68k.c | 2 +- risu_reginfo_ppc64.c | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) -- 2.20.1