aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Brooksby2012-09-10 15:47:16 +0100
committerRichard Brooksby2012-09-10 15:47:16 +0100
commit065c419ffe5c0068d19d7d654ac92aada019e311 (patch)
tree72d0698e1215204dde856472e78132204ba70953 /mps/code
parent0a8bedb1c2943932173f683b6c1a84598f4fc78e (diff)
downloademacs-065c419ffe5c0068d19d7d654ac92aada019e311.tar.gz
emacs-065c419ffe5c0068d19d7d654ac92aada019e311.zip
Suppressing strict aliasing warning about machine context registers, and adding note about dubious safety.
Copied from Perforce Change: 179397 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/prmci3li.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mps/code/prmci3li.c b/mps/code/prmci3li.c
index 9c606f181ab..33be380ba61 100644
--- a/mps/code/prmci3li.c
+++ b/mps/code/prmci3li.c
@@ -36,26 +36,26 @@ SRCID(prmci3li, "$Id$");
36 36
37MRef Prmci3AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum) 37MRef Prmci3AddressHoldingReg(MutatorFaultContext mfc, unsigned int regnum)
38{ 38{
39 Word *gregs;
40
41 AVER(regnum <= 7); 39 AVER(regnum <= 7);
42 AVER(regnum >= 0); 40 AVER(regnum >= 0);
43 41
44 gregs = (Word *)&mfc->ucontext->uc_mcontext.gregs;
45
46 /* .source.i486 */ 42 /* .source.i486 */
47 /* .assume.regref */ 43 /* .assume.regref */
48 /* The REG_EAX etc. symbols are only present if _GNU_SOURCE is defined. 44 /* The REG_EAX etc. symbols are only present if _GNU_SOURCE is defined.
49 Currently this is in lii3gc.gmk in PFMDEFS. */ 45 Currently this is in lii3gc.gmk in PFMDEFS. */
46 /* TODO: The current arrangement of the fix operation (taking a Ref *)
47 forces us to pun these registers (actually `int` on LII3GC). We can
48 suppress the warning my casting through `char *` and this might make
49 it safe, but does it really? RB 2012-09-10 */
50 switch (regnum) { 50 switch (regnum) {
51 case 0: return &gregs[REG_EAX]; 51 case 0: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_EAX]);
52 case 1: return &gregs[REG_ECX]; 52 case 1: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_ECX]);
53 case 2: return &gregs[REG_EDX]; 53 case 2: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_EDX]);
54 case 3: return &gregs[REG_EBX]; 54 case 3: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_EBX]);
55 case 4: return &gregs[REG_ESP]; 55 case 4: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_ESP]);
56 case 5: return &gregs[REG_EBP]; 56 case 5: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_EBP]);
57 case 6: return &gregs[REG_ESI]; 57 case 6: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_ESI]);
58 case 7: return &gregs[REG_EDI]; 58 case 7: return (MRef)((char *)&mfc->ucontext->uc_mcontext.gregs[REG_EDI]);
59 } 59 }
60 NOTREACHED; 60 NOTREACHED;
61 return (MRef)NULL; /* Avoids compiler warning. */ 61 return (MRef)NULL; /* Avoids compiler warning. */