Support reading and writing of %fs and %gs (except from core files).

This commit is contained in:
Bruce Evans 1997-06-07 04:50:43 +00:00
parent 7b3c84247b
commit b7542f0123
7 changed files with 57 additions and 11 deletions

View File

@ -34,7 +34,7 @@ static int tregmap[] =
tEAX, tECX, tEDX, tEBX,
tESP, tEBP, tESI, tEDI,
tEIP, tEFLAGS, tCS, tSS,
tDS, tES, tSS, tSS, /* lies: no fs or gs */
tDS, tES, tFS, tGS,
};
void
@ -88,6 +88,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
CORE_ADDR reg_addr;
{
register int regno;
register int cregno;
register int addr;
int bad_reg = -1;
int offset = -reg_addr & (core_reg_size - 1);
@ -99,8 +100,27 @@ printf("-reg_addr: %08x\n", -reg_addr);
for (regno = 0; regno < NUM_REGS; regno++)
{
addr = offset + 4 * tregmap[regno];
if (addr < 0 || addr >= core_reg_size)
cregno = tregmap[regno];
#if 1
if (cregno == tFS)
cregno = tCS;
else if (cregno == tGS)
cregno = tDS;
#endif
addr = offset + 4 * cregno;
if (cregno == tFS)
{
#if 0
supply_register (15, (char *)&u.u_pcb.pcb_fs);
#endif
}
else if (cregno == tGS)
{
#if 0
supply_register (16, (char *)&u.u_pcb.pcb_gs);
#endif
}
else if (addr < 0 || addr >= core_reg_size)
{
if (bad_reg < 0)
bad_reg = regno;

View File

@ -844,8 +844,10 @@ read_pcb (fd, uaddr)
supply_register (6, (char *)&pcb.pcb_esi);
supply_register (7, (char *)&pcb.pcb_edi);
supply_register (PC_REGNUM, (char *)&pcb.pcb_eip);
for (i = 9; i < 16; ++i) /* eflags, cs, ss, ds, es, fs, gs */
for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es */
supply_register (i, (char *)&noreg);
supply_register (15, (char *)&pcb.pcb_fs);
supply_register (16, (char *)&pcb.pcb_gs);
/* XXX 80387 registers? */
}

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "i386/tm-i386bsd.h"
#undef NUM_REGS
#define NUM_REGS 14
#define NUM_REGS 16
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));

View File

@ -844,8 +844,10 @@ read_pcb (fd, uaddr)
supply_register (6, (char *)&pcb.pcb_esi);
supply_register (7, (char *)&pcb.pcb_edi);
supply_register (PC_REGNUM, (char *)&pcb.pcb_eip);
for (i = 9; i < 16; ++i) /* eflags, cs, ss, ds, es, fs, gs */
for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es */
supply_register (i, (char *)&noreg);
supply_register (15, (char *)&pcb.pcb_fs);
supply_register (16, (char *)&pcb.pcb_gs);
/* XXX 80387 registers? */
}

View File

@ -34,7 +34,7 @@ static int tregmap[] =
tEAX, tECX, tEDX, tEBX,
tESP, tEBP, tESI, tEDI,
tEIP, tEFLAGS, tCS, tSS,
tDS, tES, tSS, tSS, /* lies: no fs or gs */
tDS, tES, tFS, tGS,
};
void
@ -88,6 +88,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
CORE_ADDR reg_addr;
{
register int regno;
register int cregno;
register int addr;
int bad_reg = -1;
int offset = -reg_addr & (core_reg_size - 1);
@ -99,8 +100,27 @@ printf("-reg_addr: %08x\n", -reg_addr);
for (regno = 0; regno < NUM_REGS; regno++)
{
addr = offset + 4 * tregmap[regno];
if (addr < 0 || addr >= core_reg_size)
cregno = tregmap[regno];
#if 1
if (cregno == tFS)
cregno = tCS;
else if (cregno == tGS)
cregno = tDS;
#endif
addr = offset + 4 * cregno;
if (cregno == tFS)
{
#if 0
supply_register (15, (char *)&u.u_pcb.pcb_fs);
#endif
}
else if (cregno == tGS)
{
#if 0
supply_register (16, (char *)&u.u_pcb.pcb_gs);
#endif
}
else if (addr < 0 || addr >= core_reg_size)
{
if (bad_reg < 0)
bad_reg = regno;

View File

@ -844,8 +844,10 @@ read_pcb (fd, uaddr)
supply_register (6, (char *)&pcb.pcb_esi);
supply_register (7, (char *)&pcb.pcb_edi);
supply_register (PC_REGNUM, (char *)&pcb.pcb_eip);
for (i = 9; i < 16; ++i) /* eflags, cs, ss, ds, es, fs, gs */
for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es */
supply_register (i, (char *)&noreg);
supply_register (15, (char *)&pcb.pcb_fs);
supply_register (16, (char *)&pcb.pcb_gs);
/* XXX 80387 registers? */
}

View File

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "i386/tm-i386bsd.h"
#undef NUM_REGS
#define NUM_REGS 14
#define NUM_REGS 16
extern struct frame_info *setup_arbitrary_frame PARAMS ((int, CORE_ADDR *));