From efb1c01c42e189ee72b721d5079ffa19f1aecfae Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 27 Nov 2003 20:35:38 +0000 Subject: * x86-64-tdep.c (RET_INT_REGS, RET_SSE_REGS): Remove defines. (x86_64_use_struct_convention, x86_64_extract_return_value, x86_64_store_return_value): Remove. (amd64_reg_class): New enum. (amd64_merge_classes, amd64_classify_aggregate, amd64_classify, amd64_return_value): New functions. (x86_64_init_abi): Don't set extract_return_value, store_return_value and use_struct_convention. Set return_value to amd64_return_value. * i387-tdep.h (i387_return_value): New prototype. * i387-tdep.c (i387_return_value): New function. --- gdb/i387-tdep.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'gdb/i387-tdep.c') diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c index ff369f9..1552565 100644 --- a/gdb/i387-tdep.c +++ b/gdb/i387-tdep.c @@ -734,3 +734,31 @@ i387_tag (const unsigned char *raw) } } } + +/* Prepare the FPU stack in REGCACHE for a function return. */ + +void +i387_return_value (struct gdbarch *gdbarch, struct regcache *regcache) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + ULONGEST fstat; + + /* Define I387_ST0_REGNUM such that we use the proper + definitions for the architecture. */ +#define I387_ST0_REGNUM tdep->st0_regnum + + /* Set the top of the floating-point register stack to 7. The + actual value doesn't really matter, but 7 is what a normal + function return would end up with if the program started out with + a freshly initialized FPU. */ + regcache_raw_read_unsigned (regcache, I387_FSTAT_REGNUM, &fstat); + fstat |= (7 << 11); + regcache_raw_write_unsigned (regcache, I387_FSTAT_REGNUM, fstat); + + /* Mark %st(1) through %st(7) as empty. Since we set the top of the + floating-point register stack to 7, the appropriate value for the + tag word is 0x3fff. */ + regcache_raw_write_unsigned (regcache, I387_FTAG_REGNUM, 0x3fff); + +#undef I387_ST0_REGNUM +} -- cgit v1.1