This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi,
In h8300 simulator, stack handling of TRAPA instruction is not as per hardware manual. Presently it takes 12 bytes to store CCR,PC and EXR registers on stack but it should do it with 6 bytes. Also simulation of @aa:8 addressing is broken as SBR register is initialized to zero after initialized with 0xFFFFFF00.
Following patch does proper stack and @aa:8 handling.
Regards, Asgari Jinia
---------------------------------------------------------------------
ChangeLog sim/h8300
2004-04-13 Asgari Jinia <asgarij@kpitcummins.com>
* compile.c (sim_resume): updated stack for TRAPA as per
hardware manual.
(init_pointers): Initialization of h8_get_reg_buf removed as it
corrupts SBR_REGNUM register, initialized in sim_state_initialize function.
--- sim/h8300/compile.old.c 2004-01-06 06:28:48.000000000 +0530
+++ sim/h8300/compile.c 2004-04-13 14:31:43.000000000 +0530
@@ -1808,7 +1808,6 @@ init_pointers (SIM_DESC sd)
h8_set_mask (sd, memory_size - 1);
- memset (h8_get_reg_buf (sd), 0, sizeof (((STATE_CPU (sd, 0))->regs)));
for (i = 0; i < 8; i++)
{
@@ -3584,14 +3583,13 @@ sim_resume (SIM_DESC sd, int step, int s
if (h8300smode) /* pop exr */
{
- h8_set_exr (sd, GET_MEMORY_L (tmp));
- tmp += 4;
+ h8_set_exr (sd, GET_MEMORY_W (tmp));
+ tmp += 2;
}
if (h8300hmode && !h8300_normal_mode)
{
- h8_set_ccr (sd, GET_MEMORY_L (tmp));
- tmp += 4;
- pc = GET_MEMORY_L (tmp);
+ h8_set_ccr (sd, (GET_MEMORY_L (tmp) >> 24));
+ pc = GET_MEMORY_L (tmp) & 0x00FFFFFF;
tmp += 4;
}
else
@@ -3671,17 +3669,16 @@ sim_resume (SIM_DESC sd, int step, int s
else
{
tmp -= 4;
- SET_MEMORY_L (tmp, code->next_pc);
- tmp -= 4;
- SET_MEMORY_L (tmp, h8_get_ccr (sd));
+ SET_MEMORY_L (tmp, (code->next_pc & 0x00FFFFFF)+
+ ((tmp, h8_get_ccr (sd))<<24));
}
intMaskBit = 1;
BUILDSR (sd);
if (h8300smode)
{
- tmp -= 4;
- SET_MEMORY_L (tmp, h8_get_exr (sd));
+ tmp -= 2;
+ SET_MEMORY_W (tmp, h8_get_exr (sd));
}
h8_set_reg (sd, SP_REGNUM, tmp);
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |