+
+ if (r == I387_FISEG_REGNUM (tdep))
+ {
+ long l = *((long *) context_offset) & 0xffff;
+ regcache->raw_supply (r, (char *) &l);
+ }
+ else if (r == I387_FOP_REGNUM (tdep))
+ {
+ long l = (*((long *) context_offset) >> 16) & ((1 << 11) - 1);
+ regcache->raw_supply (r, (char *) &l);
+ }
+ else if (segment_register_p (r))
+ {
+ /* GDB treats segment registers as 32bit registers, but they are
+ in fact only 16 bits long. Make sure we do not read extra
+ bits from our source buffer. */
+ long l = *((long *) context_offset) & 0xffff;
+ regcache->raw_supply (r, (char *) &l);
+ }
+ else
+ regcache->raw_supply (r, context_offset);
+}
+
+void
+windows_nat_target::fetch_registers (struct regcache *regcache, int r)
+{
+ DWORD pid = ptid_get_tid (regcache->ptid ());
+ windows_thread_info *th = thread_rec (pid, TRUE);
+
+ /* Check if TH exists. Windows sometimes uses a non-existent
+ thread id in its events. */
+ if (th == NULL)
+ return;