From: Jason Thorpe Date: Sun, 26 May 2002 17:59:39 +0000 (+0000) Subject: * ns32k-tdep.c (ns32k_register_byte_32082, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2c762e031983be932f3d26aa45a91aa2711fe20;p=binutils-gdb.git * ns32k-tdep.c (ns32k_register_byte_32082, ns32k_register_byte_32382, ns32k_register_raw_size, ns32k_register_virtual_size, ns32k_register_virtual_type): New functions. * config/ns32k/tm-nbsd.h (REGISTER_BYTE): Define as ns32k_register_byte_32382. * config/ns32k/tm-umax.h: Update copyright years. (REGISTER_BYTE): Define as ns32k_register_byte_32082. (REGISTER_RAW_SIZE): Define as ns32k_register_raw_size. (REGISTER_VIRTUAL_SIZE): Define as ns32k_register_virtual_size. (REGISTER_VIRTUAL_TYPE): Define as ns32k_register_virtual_type. (ns32k_get_enter_addr): Fix prototype. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a54edf27d03..af11644b6da 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,18 @@ +2002-05-26 Jason Thorpe + + * ns32k-tdep.c (ns32k_register_byte_32082, + ns32k_register_byte_32382, ns32k_register_raw_size, + ns32k_register_virtual_size, ns32k_register_virtual_type): New + functions. + * config/ns32k/tm-nbsd.h (REGISTER_BYTE): Define as + ns32k_register_byte_32382. + * config/ns32k/tm-umax.h: Update copyright years. + (REGISTER_BYTE): Define as ns32k_register_byte_32082. + (REGISTER_RAW_SIZE): Define as ns32k_register_raw_size. + (REGISTER_VIRTUAL_SIZE): Define as ns32k_register_virtual_size. + (REGISTER_VIRTUAL_TYPE): Define as ns32k_register_virtual_type. + (ns32k_get_enter_addr): Fix prototype. + 2002-05-26 Jason Thorpe * ns32k-tdep.c: Update copyright years. diff --git a/gdb/config/ns32k/tm-nbsd.h b/gdb/config/ns32k/tm-nbsd.h index a3bebbed205..ae29bcfbfb0 100644 --- a/gdb/config/ns32k/tm-nbsd.h +++ b/gdb/config/ns32k/tm-nbsd.h @@ -49,7 +49,7 @@ /* tm-umax.h assumes a 32082 fpu. We have a 32382 fpu. */ #undef REGISTER_NAME -#define REGISTER_NAME(REGNUM) ns32k_register_name_32382(REGNUM) +#define REGISTER_NAME(REGNUM) ns32k_register_name_32382((REGNUM)) #undef NUM_REGS #define NUM_REGS 29 @@ -61,18 +61,7 @@ ((NUM_REGS - 4) * REGISTER_RAW_SIZE(R0_REGNUM) \ + 8 * REGISTER_RAW_SIZE(LP0_REGNUM)) -/* Index within `registers' of the first byte of the space for - register N. */ - -/* This is a bit yuck. The even numbered double precision floating - point long registers occupy the same space as the even:odd numbered - single precision floating point registers, but the extra 32381 fpu - registers are at the end. Doing it this way is compatable for both - 32081 and 32381 equiped machines. */ - #undef REGISTER_BYTE -#define REGISTER_BYTE(N) (((N) < LP0_REGNUM? (N)\ - : ((N) - LP0_REGNUM) & 1? (N) - 1 \ - : ((N) - LP0_REGNUM + FP0_REGNUM)) * 4) +#define REGISTER_BYTE(N) ns32k_register_byte_32382 ((N)) #endif /* TM_NBSD_H */ diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h index ed77f3c795f..85838668613 100644 --- a/gdb/config/ns32k/tm-umax.h +++ b/gdb/config/ns32k/tm-umax.h @@ -1,5 +1,5 @@ /* Definitions to make GDB run on an encore under umax 4.2 - Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001 + Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -106,21 +106,15 @@ extern char *ns32k_register_name_32382 (int); /* Index within `registers' of the first byte of the space for register N. */ +extern int ns32k_register_byte_32082 (int); +extern int ns32k_register_byte_32382 (int); +#define REGISTER_BYTE(N) ns32k_register_byte_32082 ((N)) -#define REGISTER_BYTE(N) ((N) >= LP0_REGNUM ? \ - LP0_REGNUM * 4 + ((N) - LP0_REGNUM) * 8 : (N) * 4) +extern int ns32k_register_raw_size (int); +#define REGISTER_RAW_SIZE(N) ns32k_register_raw_size ((N)) -/* Number of bytes of storage in the actual machine representation - for register N. On the 32000, all regs are 4 bytes - except for the doubled floating registers. */ - -#define REGISTER_RAW_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4) - -/* Number of bytes of storage in the program's representation - for register N. On the 32000, all regs are 4 bytes - except for the doubled floating registers. */ - -#define REGISTER_VIRTUAL_SIZE(N) ((N) >= LP0_REGNUM ? 8 : 4) +extern int ns32k_register_virtual_size (int); +#define REGISTER_VIRTUAL_SIZE(N) ns32k_register_virtual_size ((N)) /* Largest value REGISTER_RAW_SIZE can have. */ @@ -130,17 +124,8 @@ extern char *ns32k_register_name_32382 (int); #define MAX_REGISTER_VIRTUAL_SIZE 8 -/* Return the GDB type object for the "standard" data type - of data in register N. */ - -#define REGISTER_VIRTUAL_TYPE(N) \ - (((N) < FP0_REGNUM) ? \ - builtin_type_int : \ - ((N) < FP0_REGNUM + 8) ? \ - builtin_type_float : \ - ((N) < LP0_REGNUM) ? \ - builtin_type_int : \ - builtin_type_double) +struct type *ns32k_register_virtual_type (int); +#define REGISTER_VIRTUAL_TYPE(N) ns32k_register_virtual_type ((N)) /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. @@ -199,7 +184,7 @@ extern char *ns32k_register_name_32382 (int); Returns positive address > 1 if pc is between enter/exit, 1 if pc before enter or after exit, 0 otherwise. */ -extern CORE_ADDR ns32k_get_enter_addr (); +extern CORE_ADDR ns32k_get_enter_addr (CORE_ADDR); /* Return number of args passed to a frame. Can return -1, meaning no way to tell. */ diff --git a/gdb/ns32k-tdep.c b/gdb/ns32k-tdep.c index 4c2fd0fa90c..f6fb85fad2f 100644 --- a/gdb/ns32k-tdep.c +++ b/gdb/ns32k-tdep.c @@ -64,6 +64,59 @@ ns32k_register_name_32382 (int regno) return (register_names[regno]); } +int +ns32k_register_byte_32082 (int regno) +{ + if (regno >= LP0_REGNUM) + return (LP0_REGNUM * 4) + ((regno - LP0_REGNUM) * 8); + + return (regno * 4); +} + +int +ns32k_register_byte_32382 (int regno) +{ + /* This is a bit yuk. The even numbered double precision floating + point long registers occupy the same space as the even:odd numbered + single precision floating point registers, but the extra 32381 FPU + registers are at the end. Doing it this way is compatible for both + 32081 and 32381 equipped machines. */ + + return ((regno < LP0_REGNUM ? regno + : (regno - LP0_REGNUM) & 1 ? regno - 1 + : (regno - LP0_REGNUM + FP0_REGNUM)) * 4); +} + +int +ns32k_register_raw_size (int regno) +{ + /* All registers are 4 bytes, except for the doubled floating + registers. */ + + return ((regno >= LP0_REGNUM) ? 8 : 4); +} + +int +ns32k_register_virtual_size (int regno) +{ + return ((regno >= LP0_REGNUM) ? 8 : 4); +} + +struct type * +ns32k_register_virtual_type (int regno) +{ + if (regno < FP0_REGNUM) + return (builtin_type_int); + + if (regno < FP0_REGNUM + 8) + return (builtin_type_float); + + if (regno < LP0_REGNUM) + return (builtin_type_int); + + return (builtin_type_double); +} + /* Advance PC across any function entry prologue instructions to reach some "real" code. */