abrossard@watcgl.waterloo.edu (Alain Brossard) (10/11/88)
I'm porting gdb to a system using a 68020 with a floating point chip (68881) on board. Going through the file m-sun3.h which has the same hardware characteristics I think I've spotted a few incorrect assumptions regarding the 68020 and the 68881: The status register (SP_REGNUM) is only 2 bytes long and pushed on the stack that way by the 68020 when it encounters an exception (or interrupt). REGISTER_NAMES: "fpcontrol", "fpstatus", "fpiaddr", "fpcode", "fpflags" } The 68881 has 3 control registers and not 5, am I to assume that two of those are specific to the Sun? /* Number of bytes of storage in the actual machine representation for register N. On the 68000, all regs are 4 bytes except the floating point regs which are 12 bytes. */ #define REGISTER_RAW_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4) Again this is incorrect for the status register and for all normal 68020 registers if I read this correctly: all registers lower than FP8 are assumed to be size 12, which is obviously incorrect. Here is my corrected version: #define REGISTER_RAW_SIZE(N) \ (unsigned(N) == PS_REGNUM ? 2 : ((unsigned)(N) < FP0_REGNUM) ? 4 : \ ((unsigned)(N) < FPC_REGNUM ? 12 : 4) Same thing about the following two: #define REGISTER_BYTE(N) \ ((N) >= FPC_REGNUM ? (((N) - FPC_REGNUM) * 4) + 166 \ : (N) >= FP0_REGNUM ? (((N) - FP0_REGNUM) * 12) + 70 \ : ( (N) <= PS_REGNUM ? (N) * 4 : (N) * 4 - 2)) #define REGISTER_VIRTUAL_SIZE(N) \ (unsigned(N) == PS_REGNUM ? 2 : ((unsigned)(N) < FP0_REGNUM) ? 4 : \ ((unsigned)(N) < FPC_REGNUM ? 8 : 4) Also wrong is: #define REGISTER_CONVERTIBLE(N) (((unsigned)(N) - FP0_REGNUM) < 8) Since the non floating point registers don't need to be converted. #define REGISTER_VIRTUAL_TYPE(N) \ (((unsigned)(N) - FP0_REGNUM) < 8 ? builtin_type_double : builtin_type_int) (same incorrect test) Alain Brossard vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Alain Brossard, CS Dept., U. Waterloo, Waterloo, Ontario, Canada N2L 3G1 INTERNET:abrossard@watcgl.uwaterloo.ca INTERNET:abrossard@watcgl.waterloo.edu UUCP :uunet!watmath!watcgl!abrossard EAN :abrossard@cgl.waterloo.cdn
abrossard@watcgl.waterloo.edu (Alain Brossard) (10/11/88)
I forgot to specify the version: cgl$ more version.c /* Define the current version number of GDB. */ char *version = "2.7"; Alain Brossard