Hi all, On X86-64 architectures, (reference Intel 64 and IA-32 architectures software developer manual, volume 1, section 8.1.7 http://www.intel.com/Assets/PDF/manual/253665.pdf ), the X87 FPU tag word description has the folowing comment - "Software cannot directly load or modify the tags in the tag register. The FLDENV and FRSTOR instructions load an image of the tag register into the x87 FPU; however, the x87 FPU uses those tag values only to determine if the data registers are empty (11B) or non-empty (00B, 01B, or 10B)." However, using a gdb, I can change the ftag register value. I used gdb 6.8, the session output is given below. I have few questions - 1) Is it right for gdb users to be allowed to change ftag, given the restriction stated in the Intel document ? 2) What would be a use case for someone to change the ftag value in a debugging session ? I mean, when do gdb users see a need to change ftag value ? 3) When I change the register value from gdb, the ftag value change is not always what I give (see example output below). Is the kernel ptrace code validating the value before seting the ftag value ? [sujoys@abacus][~][501]$ gdb gdb/mnbn/vla_linux GNU gdb Fedora (6.8-37.el5) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu"... (gdb) shell uname -a Linux abacus 2.6.18-160.el5 #1 SMP Mon Jul 27 17:28:29 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux (gdb) b main Breakpoint 1 at 0x4004ec: file vla.c, line 16. (gdb) r Starting program: /home/sujoys/gdb/mnbn/vla_linux Breakpoint 1, main () at vla.c:16 16 fl1 = 78.99; (gdb) i reg $ftag ftag 0xffff 65535 (gdb) p $ftag=0x7755 $1 = 30549 (gdb) i reg $ftag ftag 0x7755 30549 (gdb) p $ftag=0x500 $2 = 1280 (gdb) i reg $ftag ftag 0x5555 21845
Do let me know if I need to give any more information / clarification regardign my query. Regards, Sujoy