From 416b88692ad45dca8b3ae4800916dd8b3e9c2551 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 4 Nov 2019 12:04:16 +0000 Subject: [PATCH] Initialize the register dumping machinery while testing assembler code. --- math/mpmont-exp.c | 7 +++++++ math/mpmont.c | 7 +++++++ math/mpx-mul4-test.c | 7 +++++++ math/mpx.c | 7 +++++++ symm/chacha.c | 7 +++++++ symm/gcm.c | 7 +++++++ symm/rijndael.c | 5 +++++ symm/rijndael192.c | 5 +++++ symm/rijndael256.c | 5 +++++ symm/salsa20.c | 7 +++++++ 10 files changed, 64 insertions(+) diff --git a/math/mpmont-exp.c b/math/mpmont-exp.c index 6b5c8c43..ff15b2dc 100644 --- a/math/mpmont-exp.c +++ b/math/mpmont-exp.c @@ -93,6 +93,10 @@ mp *mpmont_exp(const mpmont *mm, mp *d, mp *a, mp *e) #ifdef TEST_RIG +#ifdef ENABLE_ASM_DEBUG +# include "regdump.h" +#endif + static int texp(dstr *v) { mp *m = *(mp **)v[0].buf; @@ -136,6 +140,9 @@ static test_chunk tests[] = { int main(int argc, char *argv[]) { sub_init(); +#ifdef ENABLE_ASM_DEBUG + regdump_init(); +#endif test_run(argc, argv, tests, SRCDIR "/t/mpmont"); return (0); } diff --git a/math/mpmont.c b/math/mpmont.c index 094ac401..cc5ffaf3 100644 --- a/math/mpmont.c +++ b/math/mpmont.c @@ -444,6 +444,10 @@ mp *mpmont_mul(const mpmont *mm, mp *d, mp *a, mp *b) #ifdef TEST_RIG +#ifdef ENABLE_ASM_DEBUG +# include "regdump.h" +#endif + static int tcreate(dstr *v) { mp *m = *(mp **)v[0].buf; @@ -558,6 +562,9 @@ static test_chunk tests[] = { int main(int argc, char *argv[]) { sub_init(); +#ifdef ENABLE_ASM_DEBUG + regdump_init(); +#endif test_run(argc, argv, tests, SRCDIR "/t/mpmont"); return (0); } diff --git a/math/mpx-mul4-test.c b/math/mpx-mul4-test.c index 30e76912..85a15327 100644 --- a/math/mpx-mul4-test.c +++ b/math/mpx-mul4-test.c @@ -29,6 +29,10 @@ #include "config.h" +#ifdef ENABLE_ASM_DEBUG +# include "regdump.h" +#endif + #include #include #include @@ -319,6 +323,9 @@ static test_chunk tests[] = { int main(int argc, char *argv[]) { sub_init(); +#ifdef ENABLE_ASM_DEBUG + regdump_init(); +#endif if (!cpu_features_p()) { fprintf(stderr, "required cpu feature not available\n"); exit(77); } test_run(argc, argv, tests, SRCDIR "/t/mpx-mul4"); diff --git a/math/mpx.c b/math/mpx.c index 07a6c20f..f761003f 100644 --- a/math/mpx.c +++ b/math/mpx.c @@ -1278,6 +1278,10 @@ mpw mpx_udivn(mpw *qv, mpw *qvl, const mpw *rv, const mpw *rvl, mpw d) #include #include +#ifdef ENABLE_ASM_DEBUG +# include "regdump.h" +#endif + #include "mpscan.h" #define ALLOC(v, vl, sz) do { \ @@ -1709,6 +1713,9 @@ static test_chunk defs[] = { int main(int argc, char *argv[]) { +#ifdef ENABLE_ASM_DEBUG + regdump_init(); +#endif test_run(argc, argv, defs, SRCDIR"/t/mpx"); return (0); } diff --git a/symm/chacha.c b/symm/chacha.c index b06deaed..8cc16b8d 100644 --- a/symm/chacha.c +++ b/symm/chacha.c @@ -853,6 +853,10 @@ CHACHA_VARS(DEFXGRAND) #include #include +#ifdef ENABLE_ASM_DEBUG +# include "regdump.h" +#endif + #define DEFVCORE(r) \ static int v_core_##r(dstr *v) \ { \ @@ -987,6 +991,9 @@ CHACHA_VARS(DEFXTAB) int main(int argc, char *argv[]) { +#ifdef ENABLE_ASM_DEBUG + regdump_init(); +#endif test_run(argc, argv, defs, SRCDIR"/t/chacha"); return (0); } diff --git a/symm/gcm.c b/symm/gcm.c index 95718945..b4384153 100644 --- a/symm/gcm.c +++ b/symm/gcm.c @@ -782,6 +782,10 @@ void gcm_concat(const gcm_params *p, uint32 *z, const uint32 *x, #include #include +#ifdef ENABLE_ASM_DEBUG +# include "regdump.h" +#endif + static void report_failure(const char *test, unsigned nbits, const char *ref, dstr v[], dstr *d) { @@ -874,6 +878,9 @@ GCM_WIDTHS(TEST) int main(int argc, char *argv[]) { ego(argv[0]); +#ifdef ENABLE_ASM_DEBUG + regdump_init(); +#endif test_run(argc, argv, defs, SRCDIR"/t/gcm"); return (0); } diff --git a/symm/rijndael.c b/symm/rijndael.c index 7db9e012..597ae98f 100644 --- a/symm/rijndael.c +++ b/symm/rijndael.c @@ -34,6 +34,11 @@ #include +#if defined(TEST_RIG) && defined(ENABLE_ASM_DEBUG) +# include "regdump.h" +# define BLKC_TESTHOOK do { regdump_init(); } while (0) +#endif + #include "blkc.h" #include "dispatch.h" #include "gcipher.h" diff --git a/symm/rijndael192.c b/symm/rijndael192.c index 424f8f90..46562feb 100644 --- a/symm/rijndael192.c +++ b/symm/rijndael192.c @@ -32,6 +32,11 @@ #include +#if defined(TEST_RIG) && defined(ENABLE_ASM_DEBUG) +# include "regdump.h" +# define BLKC_TESTHOOK do { regdump_init(); } while (0) +#endif + #include "blkc.h" #include "gcipher.h" #include "rijndael.h" diff --git a/symm/rijndael256.c b/symm/rijndael256.c index 9fb72983..4030ab2c 100644 --- a/symm/rijndael256.c +++ b/symm/rijndael256.c @@ -32,6 +32,11 @@ #include +#if defined(TEST_RIG) && defined(ENABLE_ASM_DEBUG) +# include "regdump.h" +# define BLKC_TESTHOOK do { regdump_init(); } while (0) +#endif + #include "blkc.h" #include "gcipher.h" #include "rijndael.h" diff --git a/symm/salsa20.c b/symm/salsa20.c index 7806e6ca..f0fe3d7c 100644 --- a/symm/salsa20.c +++ b/symm/salsa20.c @@ -875,6 +875,10 @@ SALSA20_VARS(DEFXGRAND) #include #include +#ifdef ENABLE_ASM_DEBUG +# include "regdump.h" +#endif + static const int perm[] = { 0, 13, 10, 7, 4, 1, 14, 11, @@ -1017,6 +1021,9 @@ SALSA20_VARS(DEFXTAB) int main(int argc, char *argv[]) { +#ifdef ENABLE_ASM_DEBUG + regdump_init(); +#endif test_run(argc, argv, defs, SRCDIR"/t/salsa20"); return (0); } -- 2.11.0