diff options
author | Mark Kettenis <kettenis@gnu.org> | 2003-11-27 20:35:38 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2003-11-27 20:35:38 +0000 |
commit | efb1c01c42e189ee72b721d5079ffa19f1aecfae (patch) | |
tree | 68c7c5a33746a346cc3a5c09ef9fd9d065a6277d /gdb/i387-tdep.c | |
parent | 41a7d11a930fffaa7ec7192e76ff296e841f1f62 (diff) | |
download | gdb-efb1c01c42e189ee72b721d5079ffa19f1aecfae.zip gdb-efb1c01c42e189ee72b721d5079ffa19f1aecfae.tar.gz gdb-efb1c01c42e189ee72b721d5079ffa19f1aecfae.tar.bz2 |
* 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.
Diffstat (limited to 'gdb/i387-tdep.c')
-rw-r--r-- | gdb/i387-tdep.c | 28 |
1 files changed, 28 insertions, 0 deletions
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 +} |