-
Notifications
You must be signed in to change notification settings - Fork 2
/
risu.h
75 lines (59 loc) · 2.2 KB
/
risu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*******************************************************************************
* Copyright (c) 2010 Linaro Limited
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Peter Maydell (Linaro) - initial implementation
*******************************************************************************/
#ifndef RISU_H
#define RISU_H
#include <inttypes.h>
#include "config.h"
#ifndef HAVE_SOCKLEN_T
#define socklen_t int
#endif /* HAVE_SOCKLEN_T */
#ifndef HAVE_UINTPTR_T
#define uintptr_t size_t
#endif /* HAVE_UINTPTR_T */
/* Socket related routines */
int master_connect(int port);
int apprentice_connect(const char *hostname, int port);
int send_data_pkt(int sock, void *pkt, int pktlen);
int recv_data_pkt(int sock, void *pkt, int pktlen);
void send_response_byte(int sock, int resp);
extern uintptr_t image_start_address;
extern void *memblock;
extern int test_fp_exc;
/* Ops code under test can request from risu: */
#define OP_COMPARE 0
#define OP_TESTEND 1
#define OP_SETMEMBLOCK 2
#define OP_GETMEMBLOCK 3
#define OP_COMPAREMEM 4
/* The memory block should be this long */
#define MEMBLOCKLEN 8192
/* Interface provided by CPU-specific code: */
/* Send the register information from the struct ucontext down the socket.
* Return the response code from the master.
* NB: called from a signal handler.
*/
int send_register_info(int sock, void *uc);
/* 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);
/* 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);
/* Move the PC past this faulting insn by adjusting ucontext
*/
void advance_pc(void *uc);
#endif /* RISU_H */