diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2010-09-20 18:41:19 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2010-09-20 18:46:37 +0100 |
commit | 452057e1b7fc91bfa3ee06e5a71c3d13d2711b6b (patch) | |
tree | 00e3b1212be8cda04d39bd7b4802d5d6c60cfef2 /risu_i386.c | |
parent | 403892c49503b5939689dc7793ca413bbdd4ba37 (diff) |
Add the initial structure of SIGILL handling and CPU-specific interface.
Diffstat (limited to 'risu_i386.c')
-rw-r--r-- | risu_i386.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/risu_i386.c b/risu_i386.c new file mode 100644 index 0000000..673a711 --- /dev/null +++ b/risu_i386.c @@ -0,0 +1,36 @@ +/* Copyright 2010 Linaro Limited */ + +#include <stdio.h> + +#include "risu.h" + +int send_register_info(int sock, void *uc) +{ + return send_data_pkt(sock, "S", 1); +} + +static unsigned char cmd; + +/* Read register info from the socket and compare it with that from the + * ucontext. Return 0 for match, 1 for end-of-test, 2 for mismatch. + * NB: called from a signal handler. + */ +int recv_and_compare_register_info(int sock, void *uc) +{ + recv_data_pkt(sock, &cmd, 1); + int resp = (cmd == 'S') ? 1 : 2; + send_response_byte(sock, resp); + return resp; +} + +/* Print a useful report on the status of the last comparison + * done in recv_and_compare_register_info(). This is called on + * exit, so need not restrict itself to signal-safe functions. + * Should return 0 if it was a good match (ie end of test) + * and 1 for a mismatch. + */ +int report_match_status(void) +{ + fprintf(stderr, "match status: command %c\n", cmd); + return (cmd == 'S') ? 0 : 1; +} |