From: Petar Jovanovic Date: Wed, 7 Dec 2016 16:19:26 +0000 (+0000) Subject: mips: small changes in VexGuestMIPS{32|64}State structs X-Git-Tag: svn/VALGRIND_3_13_0^2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=654f8627a266d448012acf969cc5ba442e227025;p=thirdparty%2Fvalgrind.git mips: small changes in VexGuestMIPS{32|64}State structs Move host_EvC_FAILADDR and host_EvC_COUNTER fields to the top of the structure, similar to other architectures. This fixes none/tests/libvexmultiarch_test (stderr) on some MIPS platforms, as it avoids internal X86/AMD code generator asserts. Minor stylish changes included too. Patch by Aleksandra Karadzic. git-svn-id: svn://svn.valgrind.org/vex/trunk@3286 --- diff --git a/VEX/priv/host_mips_defs.c b/VEX/priv/host_mips_defs.c index 7d73ecc1e8..ce202d121c 100644 --- a/VEX/priv/host_mips_defs.c +++ b/VEX/priv/host_mips_defs.c @@ -36,9 +36,6 @@ #include "host_generic_regs.h" #include "host_mips_defs.h" -/* guest_COND offset. */ -#define COND_OFFSET(__mode64) (__mode64 ? 612 : 448) - /* Register number for guest state pointer in host code. */ #define GuestSP 23 diff --git a/VEX/priv/host_mips_defs.h b/VEX/priv/host_mips_defs.h index 8504498076..67f234efc7 100644 --- a/VEX/priv/host_mips_defs.h +++ b/VEX/priv/host_mips_defs.h @@ -123,6 +123,9 @@ ST_IN HReg hregMIPS_GPR31 ( Bool mode64 ) { return GPR(mode64, 31, 37, 45); } #define StackFramePointer(_mode64) hregMIPS_GPR30(_mode64) #define StackPointer(_mode64) hregMIPS_GPR29(_mode64) +/* guest_COND offset */ +#define COND_OFFSET(_mode64) ((_mode64) ? 588 : 448) + /* Num registers used for function calls */ #if defined(VGP_mips32_linux) /* a0, a1, a2, a3 */ diff --git a/VEX/priv/host_mips_isel.c b/VEX/priv/host_mips_isel.c index 848234a39f..7fa396d394 100644 --- a/VEX/priv/host_mips_isel.c +++ b/VEX/priv/host_mips_isel.c @@ -61,9 +61,6 @@ static Bool fp_mode64 = False; /* FPR register class for mips32/64 */ #define HRcFPR(_mode64) ((_mode64) ? HRcFlt64 : HRcFlt32) -/* guest_COND offset */ -#define COND_OFFSET(_mode64) ((_mode64) ? 612 : 448) - /*---------------------------------------------------------*/ /*--- ISelEnv ---*/ /*---------------------------------------------------------*/ diff --git a/VEX/pub/libvex_guest_mips32.h b/VEX/pub/libvex_guest_mips32.h index 8351f0e91c..dd787486d4 100644 --- a/VEX/pub/libvex_guest_mips32.h +++ b/VEX/pub/libvex_guest_mips32.h @@ -40,82 +40,86 @@ typedef struct { + /* 0 */ UInt host_EvC_FAILADDR; + /* 4 */ UInt host_EvC_COUNTER; + /* CPU Registers */ - /* 0 */ UInt guest_r0; /* Hardwired to 0 */ - /* 4 */ UInt guest_r1; /* Assembler temporary */ - /* 8 */ UInt guest_r2; /* Values for function returns ...*/ - /* 12 */ UInt guest_r3; /* ...and expression evaluation */ - /* 16 */ UInt guest_r4; /* Function arguments */ - /* 20 */ UInt guest_r5; - /* 24 */ UInt guest_r6; - /* 28 */ UInt guest_r7; - /* 32 */ UInt guest_r8; /* Temporaries */ - /* 36 */ UInt guest_r9; - /* 40 */ UInt guest_r10; - /* 44 */ UInt guest_r11; - /* 48 */ UInt guest_r12; - /* 52 */ UInt guest_r13; - /* 56 */ UInt guest_r14; - /* 60 */ UInt guest_r15; - /* 64 */ UInt guest_r16; /* Saved temporaries */ - /* 68 */ UInt guest_r17; - /* 72 */ UInt guest_r18; - /* 76 */ UInt guest_r19; - /* 80 */ UInt guest_r20; - /* 84 */ UInt guest_r21; - /* 88 */ UInt guest_r22; - /* 92 */ UInt guest_r23; - /* 96 */ UInt guest_r24; /* Temporaries */ - /* 100 */ UInt guest_r25; - /* 104 */ UInt guest_r26; /* Reserved for OS kernel */ - /* 108 */ UInt guest_r27; - /* 112 */ UInt guest_r28; /* Global pointer */ - /* 116 */ UInt guest_r29; /* Stack pointer */ - /* 120 */ UInt guest_r30; /* Frame pointer */ - /* 124 */ UInt guest_r31; /* Return address */ - /* 128 */ UInt guest_PC; /* Program counter */ - /* 132 */ UInt guest_HI; /* Multiply and divide register higher result */ - /* 136 */ UInt guest_LO; /* Multiply and divide register lower result */ + /* 8 */ UInt guest_r0; /* Hardwired to 0. */ + /* 12 */ UInt guest_r1; /* Assembler temporary */ + /* 16 */ UInt guest_r2; /* Values for function returns ...*/ + /* 20 */ UInt guest_r3; /* ... and expression evaluation */ + /* 24 */ UInt guest_r4; /* Function arguments */ + /* 28 */ UInt guest_r5; + /* 32 */ UInt guest_r6; + /* 36 */ UInt guest_r7; + /* 40 */ UInt guest_r8; /* Temporaries */ + /* 44 */ UInt guest_r9; + /* 48 */ UInt guest_r10; + /* 52 */ UInt guest_r11; + /* 56 */ UInt guest_r12; + /* 60 */ UInt guest_r13; + /* 64 */ UInt guest_r14; + /* 68 */ UInt guest_r15; + /* 72 */ UInt guest_r16; /* Saved temporaries */ + /* 76 */ UInt guest_r17; + /* 80 */ UInt guest_r18; + /* 84 */ UInt guest_r19; + /* 88 */ UInt guest_r20; + /* 92 */ UInt guest_r21; + /* 96 */ UInt guest_r22; + /* 100 */ UInt guest_r23; + /* 104 */ UInt guest_r24; /* Temporaries */ + /* 108 */ UInt guest_r25; + /* 112 */ UInt guest_r26; /* Reserved for OS kernel */ + /* 116 */ UInt guest_r27; + /* 120 */ UInt guest_r28; /* Global pointer */ + /* 124 */ UInt guest_r29; /* Stack pointer */ + /* 128 */ UInt guest_r30; /* Frame pointer */ + /* 132 */ UInt guest_r31; /* Return address */ + /* 136 */ UInt guest_PC; /* Program counter */ + /* 140 */ UInt guest_HI; /* Multiply and divide reg higher result */ + /* 144 */ UInt guest_LO; /* Multiply and divide reg lower result */ + /* 148 */ UInt _padding1; /* FPU Registers */ - /* 144 */ ULong guest_f0; /* Floating point general purpose registers */ - /* 152 */ ULong guest_f1; - /* 160 */ ULong guest_f2; - /* 168 */ ULong guest_f3; - /* 176 */ ULong guest_f4; - /* 184 */ ULong guest_f5; - /* 192 */ ULong guest_f6; - /* 200 */ ULong guest_f7; - /* 208 */ ULong guest_f8; - /* 216 */ ULong guest_f9; - /* 224 */ ULong guest_f10; - /* 232 */ ULong guest_f11; - /* 240 */ ULong guest_f12; - /* 248 */ ULong guest_f13; - /* 256 */ ULong guest_f14; - /* 264 */ ULong guest_f15; - /* 272 */ ULong guest_f16; - /* 280 */ ULong guest_f17; - /* 288 */ ULong guest_f18; - /* 296 */ ULong guest_f19; - /* 304 */ ULong guest_f20; - /* 312 */ ULong guest_f21; - /* 320 */ ULong guest_f22; - /* 328 */ ULong guest_f23; - /* 336 */ ULong guest_f24; - /* 344 */ ULong guest_f25; - /* 352 */ ULong guest_f26; - /* 360 */ ULong guest_f27; - /* 368 */ ULong guest_f28; - /* 376 */ ULong guest_f29; - /* 384 */ ULong guest_f30; - /* 392 */ ULong guest_f31; - - /* 400 */ UInt guest_FIR; - /* 404 */ UInt guest_FCCR; - /* 408 */ UInt guest_FEXR; - /* 412 */ UInt guest_FENR; - /* 416 */ UInt guest_FCSR; + /* 152 */ ULong guest_f0; /* Floating point general purpose registers */ + /* 160 */ ULong guest_f1; + /* 168 */ ULong guest_f2; + /* 176 */ ULong guest_f3; + /* 184 */ ULong guest_f4; + /* 192 */ ULong guest_f5; + /* 200 */ ULong guest_f6; + /* 208 */ ULong guest_f7; + /* 216 */ ULong guest_f8; + /* 224 */ ULong guest_f9; + /* 232 */ ULong guest_f10; + /* 240 */ ULong guest_f11; + /* 248 */ ULong guest_f12; + /* 256 */ ULong guest_f13; + /* 264 */ ULong guest_f14; + /* 272 */ ULong guest_f15; + /* 280 */ ULong guest_f16; + /* 288 */ ULong guest_f17; + /* 296 */ ULong guest_f18; + /* 304 */ ULong guest_f19; + /* 312 */ ULong guest_f20; + /* 320 */ ULong guest_f21; + /* 328 */ ULong guest_f22; + /* 336 */ ULong guest_f23; + /* 344 */ ULong guest_f24; + /* 352 */ ULong guest_f25; + /* 360 */ ULong guest_f26; + /* 368 */ ULong guest_f27; + /* 376 */ ULong guest_f28; + /* 384 */ ULong guest_f29; + /* 392 */ ULong guest_f30; + /* 400 */ ULong guest_f31; + + /* 408 */ UInt guest_FIR; + /* 412 */ UInt guest_FCCR; + /* 416 */ UInt guest_FEXR; + /* 420 */ UInt guest_FENR; + /* 424 */ UInt guest_FCSR; /* TLS pointer for the thread. It's read-only in user space. On Linux it is set in user space by various thread-related @@ -126,36 +130,34 @@ typedef environments, the UserLocal register is a pointer to a thread-specific storage block. */ - /* 420 */ UInt guest_ULR; + /* 428 */ UInt guest_ULR; /* Emulation notes */ - /* 424 */ UInt guest_EMNOTE; + /* 432 */ UInt guest_EMNOTE; - /* For clflush: record start and length of area to invalidate */ - /* 428 */ UInt guest_CMSTART; - /* 432 */ UInt guest_CMLEN; - /* 436 */ UInt guest_NRADDR; + /* For clflush: record start and length of area to invalidate. */ + /* 436 */ UInt guest_CMSTART; + /* 440 */ UInt guest_CMLEN; + /* 444 */ UInt guest_NRADDR; - /* 440 */ UInt host_EvC_FAILADDR; - /* 444 */ UInt host_EvC_COUNTER; - /* 448 */ UInt guest_COND; + /* 448 */ UInt guest_COND; /* MIPS32 DSP ASE(r2) specific registers. */ - /* 452 */ UInt guest_DSPControl; - /* 456 */ ULong guest_ac0; - /* 464 */ ULong guest_ac1; - /* 472 */ ULong guest_ac2; - /* 480 */ ULong guest_ac3; + /* 452 */ UInt guest_DSPControl; + /* 456 */ ULong guest_ac0; + /* 464 */ ULong guest_ac1; + /* 472 */ ULong guest_ac2; + /* 480 */ ULong guest_ac3; - /* 488 */ UInt guest_CP0_status; + /* 488 */ UInt guest_CP0_status; - /* 492 */ UInt padding; + /* 492 */ UInt _padding2; } VexGuestMIPS32State; /*---------------------------------------------------------------*/ /*--- Utility functions for MIPS32 guest stuff. ---*/ /*---------------------------------------------------------------*/ -/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */ +/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT. */ /* Initialise all guest MIPS32 state. */ diff --git a/VEX/pub/libvex_guest_mips64.h b/VEX/pub/libvex_guest_mips64.h index 88d1f7fc9e..7584320fd0 100644 --- a/VEX/pub/libvex_guest_mips64.h +++ b/VEX/pub/libvex_guest_mips64.h @@ -46,84 +46,87 @@ typedef struct { + /* 0 */ ULong host_EvC_FAILADDR; + /* 8 */ UInt host_EvC_COUNTER; + /* 12 */ UInt _padding1; + /* CPU Registers */ - /* 0 */ ULong guest_r0; /* Hardwired to 0 */ - /* 8 */ ULong guest_r1; /* Assembler temporary */ - /* 16 */ ULong guest_r2; /* Values for function returns ...*/ - /* 24 */ ULong guest_r3; /* ...and expression evaluation */ - /* 32 */ ULong guest_r4; /* Function arguments */ - /* 40 */ ULong guest_r5; - /* 48 */ ULong guest_r6; - /* 56 */ ULong guest_r7; - /* 64 */ ULong guest_r8; - /* 72 */ ULong guest_r9; - /* 80 */ ULong guest_r10; - /* 88 */ ULong guest_r11; - /* 96 */ ULong guest_r12; /* Temporaries */ - /* 104 */ ULong guest_r13; - /* 112 */ ULong guest_r14; - /* 120 */ ULong guest_r15; - /* 128 */ ULong guest_r16; /* Saved temporaries */ - /* 136 */ ULong guest_r17; - /* 144 */ ULong guest_r18; - /* 152 */ ULong guest_r19; - /* 160 */ ULong guest_r20; - /* 168 */ ULong guest_r21; - /* 176 */ ULong guest_r22; - /* 184 */ ULong guest_r23; - /* 192 */ ULong guest_r24; /* Temporaries */ - /* 200 */ ULong guest_r25; - /* 208 */ ULong guest_r26; /* Reserved for OS kernel */ - /* 216 */ ULong guest_r27; - /* 224 */ ULong guest_r28; /* Global pointer */ - /* 232 */ ULong guest_r29; /* Stack pointer */ - /* 240 */ ULong guest_r30; /* Frame pointer */ - /* 248 */ ULong guest_r31; /* Return address */ - /* 256 */ ULong guest_PC; /* Program counter */ - /* 264 */ ULong guest_HI; /* Multiply and divide reg higher result */ - /* 272 */ ULong guest_LO; /* Multiply and divide reg lower result */ + /* 16 */ ULong guest_r0; /* Hardwired to 0. */ + /* 24 */ ULong guest_r1; /* Assembler temporary */ + /* 32 */ ULong guest_r2; /* Values for function returns ...*/ + /* 40 */ ULong guest_r3; /* ... and expression evaluation */ + /* 48 */ ULong guest_r4; /* Function arguments */ + /* 56 */ ULong guest_r5; + /* 64 */ ULong guest_r6; + /* 72 */ ULong guest_r7; + /* 80 */ ULong guest_r8; + /* 88 */ ULong guest_r9; + /* 96 */ ULong guest_r10; + /* 104 */ ULong guest_r11; + /* 112 */ ULong guest_r12; /* Temporaries */ + /* 120 */ ULong guest_r13; + /* 128 */ ULong guest_r14; + /* 136 */ ULong guest_r15; + /* 144 */ ULong guest_r16; /* Saved temporaries */ + /* 152 */ ULong guest_r17; + /* 160 */ ULong guest_r18; + /* 168 */ ULong guest_r19; + /* 176 */ ULong guest_r20; + /* 184 */ ULong guest_r21; + /* 192 */ ULong guest_r22; + /* 200 */ ULong guest_r23; + /* 208 */ ULong guest_r24; /* Temporaries */ + /* 216 */ ULong guest_r25; + /* 224 */ ULong guest_r26; /* Reserved for OS kernel */ + /* 232 */ ULong guest_r27; + /* 240 */ ULong guest_r28; /* Global pointer */ + /* 248 */ ULong guest_r29; /* Stack pointer */ + /* 256 */ ULong guest_r30; /* Frame pointer */ + /* 264 */ ULong guest_r31; /* Return address */ + /* 272 */ ULong guest_PC; /* Program counter */ + /* 280 */ ULong guest_HI; /* Multiply and divide reg higher result */ + /* 288 */ ULong guest_LO; /* Multiply and divide reg lower result */ /* FPU Registers */ - /* 280 */ ULong guest_f0; /* Floting point gen purpose registers */ - /* 288 */ ULong guest_f1; - /* 296 */ ULong guest_f2; - /* 304 */ ULong guest_f3; - /* 312 */ ULong guest_f4; - /* 320 */ ULong guest_f5; - /* 328 */ ULong guest_f6; - /* 336 */ ULong guest_f7; - /* 344 */ ULong guest_f8; - /* 352 */ ULong guest_f9; - /* 360 */ ULong guest_f10; - /* 368 */ ULong guest_f11; - /* 376 */ ULong guest_f12; - /* 384 */ ULong guest_f13; - /* 392 */ ULong guest_f14; - /* 400 */ ULong guest_f15; - /* 408 */ ULong guest_f16; - /* 416 */ ULong guest_f17; - /* 424 */ ULong guest_f18; - /* 432 */ ULong guest_f19; - /* 440 */ ULong guest_f20; - /* 448 */ ULong guest_f21; - /* 456 */ ULong guest_f22; - /* 464 */ ULong guest_f23; - /* 472 */ ULong guest_f24; - /* 480 */ ULong guest_f25; - /* 488 */ ULong guest_f26; - /* 496 */ ULong guest_f27; - /* 504 */ ULong guest_f28; - /* 512 */ ULong guest_f29; - /* 520 */ ULong guest_f30; - /* 528 */ ULong guest_f31; - - /* 536 */ UInt guest_FIR; - /* 540 */ UInt guest_FCCR; - /* 544 */ UInt guest_FEXR; - /* 548 */ UInt guest_FENR; - /* 552 */ UInt guest_FCSR; - - /* 556 */ UInt guest_CP0_status; + /* 296 */ ULong guest_f0; /* Floating point gen. purpose registers */ + /* 304 */ ULong guest_f1; + /* 312 */ ULong guest_f2; + /* 320 */ ULong guest_f3; + /* 328 */ ULong guest_f4; + /* 336 */ ULong guest_f5; + /* 344 */ ULong guest_f6; + /* 352 */ ULong guest_f7; + /* 360 */ ULong guest_f8; + /* 368 */ ULong guest_f9; + /* 376 */ ULong guest_f10; + /* 384 */ ULong guest_f11; + /* 392 */ ULong guest_f12; + /* 400 */ ULong guest_f13; + /* 408 */ ULong guest_f14; + /* 416 */ ULong guest_f15; + /* 424 */ ULong guest_f16; + /* 432 */ ULong guest_f17; + /* 440 */ ULong guest_f18; + /* 448 */ ULong guest_f19; + /* 456 */ ULong guest_f20; + /* 464 */ ULong guest_f21; + /* 472 */ ULong guest_f22; + /* 480 */ ULong guest_f23; + /* 488 */ ULong guest_f24; + /* 496 */ ULong guest_f25; + /* 504 */ ULong guest_f26; + /* 512 */ ULong guest_f27; + /* 520 */ ULong guest_f28; + /* 528 */ ULong guest_f29; + /* 536 */ ULong guest_f30; + /* 544 */ ULong guest_f31; + + /* 552 */ UInt guest_FIR; + /* 556 */ UInt guest_FCCR; + /* 560 */ UInt guest_FEXR; + /* 564 */ UInt guest_FENR; + /* 568 */ UInt guest_FCSR; + /* 572 */ UInt guest_CP0_status; /* TLS pointer for the thread. It's read-only in user space. On Linux it is set in user space by various thread-related syscalls. @@ -132,29 +135,27 @@ typedef UserLocal register, if it is implemented. In some operating environments, the UserLocal register is a pointer to a thread-specific storage block. - */ - ULong guest_ULR; /* 560 */ + */ + /* 576 */ ULong guest_ULR; /* Emulation notes */ - UInt guest_EMNOTE; /* 568 */ + /* 584 */ UInt guest_EMNOTE; + /* 588 */ UInt guest_COND; /* For clflush: record start and length of area to invalidate */ - ULong guest_CMSTART; /* 576 */ - ULong guest_CMLEN; /* 584 */ + /* 592 */ ULong guest_CMSTART; + /* 600 */ ULong guest_CMLEN; - ULong guest_NRADDR; /* 592 */ + /* 608 */ ULong guest_NRADDR; - ULong host_EvC_FAILADDR; /* 600 */ - UInt host_EvC_COUNTER; /* 608 */ - UInt guest_COND; /* 612 */ - UInt padding[2]; + /* 616 */ ULong _padding2; } VexGuestMIPS64State; /*---------------------------------------------------------------*/ /*--- Utility functions for MIPS64 guest stuff. ---*/ /*---------------------------------------------------------------*/ -/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */ +/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT. */ /* Initialise all guest MIPS64 state. */