if actual_mem_addr is non-NULL, store there the address that it
was fetched from (or if from a register the offset within
registers). Set *LVAL to lval_memory or lval_register, depending
- on where it came from. */
+ on where it came from. The contents written into MYADDR are in
+ target format. */
void
read_register_stack (memaddr, myaddr, actual_mem_addr, lval)
CORE_ADDR memaddr;
/* If we don't do this 'info register' stops in the middle. */
if (memaddr >= rstack_high_address)
{
- int val = -1; /* a bogus value */
+ /* a bogus value */
+ static char val[] = {~0, ~0, ~0, ~0};
/* It's in a local register, but off the end of the stack. */
int regnum = (memaddr - rsp) / 4 + LR0_REGNUM;
if (myaddr != NULL)
- *(int*)myaddr = val; /* Provide bogusness */
- supply_register(regnum, (char *)&val); /* More bogusness */
+ {
+ /* Provide bogusness */
+ memcpy (myaddr, val, 4);
+ }
+ supply_register(regnum, val); /* More bogusness */
if (lval != NULL)
*lval = lval_register;
if (actual_mem_addr != NULL)
{
/* It's in the memory portion of the register stack. */
if (myaddr != NULL)
- read_memory (memaddr, myaddr, 4);
+ read_memory (memaddr, myaddr, 4);
if (lval != NULL)
*lval = lval_memory;
if (actual_mem_addr != NULL)
CORE_ADDR memaddr;
int len;
{
- long buf;
- read_register_stack (memaddr, &buf, NULL, NULL);
- SWAP_TARGET_AND_HOST (&buf, 4);
- return buf;
+ char buf[4];
+ read_register_stack (memaddr, buf, NULL, NULL);
+ return extract_signed_integer (buf, 4);
}
/* Copy 4 bytes from GDB memory at MYADDR into inferior memory
if (regnum == RSP_REGNUM)
{
if (raw_buffer != NULL)
- *(CORE_ADDR *)raw_buffer = fi->frame;
+ {
+ store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), fi->frame);
+ }
if (lvalp != NULL)
*lvalp = not_lval;
return;
else if (regnum == PC_REGNUM)
{
if (raw_buffer != NULL)
- *(CORE_ADDR *)raw_buffer = fi->pc;
+ {
+ store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), fi->pc);
+ }
/* Not sure we have to do this. */
if (lvalp != NULL)
if (raw_buffer != NULL)
{
if (fi->next != NULL)
- *(CORE_ADDR *)raw_buffer = fi->next->saved_msp;
+ {
+ store_address (raw_buffer, REGISTER_RAW_SIZE (regnum),
+ fi->next->saved_msp);
+ }
else
- *(CORE_ADDR *)raw_buffer = read_register (MSP_REGNUM);
+ read_register_gen (MSP_REGNUM, raw_buffer);
}
/* The value may have been computed, not fetched. */
if (lvalp != NULL)
/* These registers are not saved over procedure calls,
so just print out the current values. */
if (raw_buffer != NULL)
- *(CORE_ADDR *)raw_buffer = read_register (regnum);
+ read_register_gen (regnum, raw_buffer);
if (lvalp != NULL)
*lvalp = lval_register;
if (addrp != NULL)
write_register (lrnum, read_register (NPC_REGNUM));
}
+enum a29k_processor_types processor_type = a29k_unknown;
+
+void
+a29k_get_processor_type ()
+{
+ unsigned int cfg_reg = (unsigned int) read_register (CFG_REGNUM);
+
+ /* Most of these don't have freeze mode. */
+ processor_type = a29k_no_freeze_mode;
+
+ switch ((cfg_reg >> 28) & 0xf)
+ {
+ case 0:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29000");
+ break;
+ case 1:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29005");
+ break;
+ case 2:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29050");
+ processor_type = a29k_freeze_mode;
+ break;
+ case 3:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29035");
+ break;
+ case 4:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29030");
+ break;
+ case 5:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am2920*");
+ break;
+ case 6:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am2924*");
+ break;
+ case 7:
+ fprintf_filtered (gdb_stderr, "Remote debugging an Am29040");
+ break;
+ default:
+ fprintf_filtered (gdb_stderr, "Remote debugging an unknown Am29k\n");
+ /* Don't bother to print the revision. */
+ return;
+ }
+ fprintf_filtered (gdb_stderr, " revision %c\n", 'A' + ((cfg_reg >> 24) & 0x0f));
+}
void
_initialize_29k()