/[hurd]/hurd/exec/elfcore.c
ViewVC logotype

Diff of /hurd/exec/elfcore.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by roland, Wed May 29 08:48:38 2002 UTC revision 1.10 by roland, Tue Sep 17 21:18:21 2002 UTC
# Line 45  the Free Software Foundation, 675 Mass A Line 45  the Free Software Foundation, 675 Mass A
45  #ifdef i386_THREAD_STATE  #ifdef i386_THREAD_STATE
46  # define ELF_MACHINE            EM_386  # define ELF_MACHINE            EM_386
47    
48  /* There is a natural layout for this on x86, so it happens  /* The gregset_t format (compatible with Linux/x86) almost fits
49     that the canonical gregset_t from <sys/ucontext.h>     the Mach i386_thread_state.  */
    matches Mach's i386_thread_state exactly.  */  
50  static inline void  static inline void
51  fetch_thread_regset (thread_t thread, prgregset_t *gregs)  fetch_thread_regset (thread_t thread, prgregset_t *gregs)
52  {  {
53      union
54      {
55        struct i386_thread_state state;
56        prgregset_t gregs;
57      } *u = (void *) gregs;
58    mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;    mach_msg_type_number_t count = i386_THREAD_STATE_COUNT;
59    assert (sizeof (struct i386_thread_state) == sizeof (prgregset_t));    assert (sizeof (struct i386_thread_state) < sizeof (prgregset_t));
60    assert (offsetof (struct i386_thread_state, gs) == REG_GS);    assert (offsetof (struct i386_thread_state, gs) == REG_GS * 4);
61    assert (offsetof (struct i386_thread_state, eip) == REG_EIP * 4);    assert (offsetof (struct i386_thread_state, eax) == REG_EAX * 4);
62    assert (offsetof (struct i386_thread_state, ss) == REG_SS * 4);  
63    (void) thread_get_state (thread, i386_THREAD_STATE,    (void) thread_get_state (thread, i386_THREAD_STATE,
64                             (thread_state_t) gregs, &count);                             (thread_state_t) &u->state, &count);
65    
66      u->gregs[REG_EIP] = u->state.eip;
67      u->gregs[REG_CS] = u->state.cs;
68      u->gregs[REG_EFL] = u->state.efl;
69      u->gregs[REG_UESP] = u->state.uesp;
70      u->gregs[REG_SS] = u->state.ss;
71    
72      /* These are the extra words that don't exist in prgregset_t.  */
73      u->gregs[REG_ERR] = u->gregs[REG_TRAPNO] = 0;
74  }  }
75    
76  static inline void  static inline void

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26