This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add regcache_raw_supply_part/regcache_raw_collect_part


On Wed, Feb 3, 2010 at 1:14 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Tue, 2 Feb 2010 19:31:31 -0800
>> From: "H.J. Lu" <hongjiu.lu@intel.com>
>>
>> Hi,
>>
>> Intel AVX saves a 256bit YMM register in lower 128bit and upper 128bit
>> separately. This patch adds regcache_raw_supply_part and
>> regcache_raw_collect_part. They will be used in AVX gdb patches . OK
>> to install?
>
> I think introducing these functions would be a mistake. ?If you're not
> careful, you'll end up with a register cache where part of some
> registers is filled with garbage.

They are used

                if ((clear_bv & bit_XSTATE_SSE))
                  regcache_raw_supply_part (regcache, i, NULL,
                                            0, 16, 0);
                else
                  regcache_raw_supply_part (regcache, i,
                                            XSAVE_SSE_ADDR (tdep, regs, i),
                                            0, 16, 0);
                if ((clear_bv & bit_XSTATE_AVX))
                  regcache_raw_supply_part (regcache, i, NULL,
                                            16, 16, 1);
                else
                  regcache_raw_supply_part (regcache, i,
                                            XSAVE_AVXH_ADDR (tdep, regs, i),
                                            16, 16, 1);

I mark regcache as valid after full register is updated. If we get garbage in
regcache, it is a bug.

> I think it is better for the code that fills the register cache, to
> collect the pieces and build the full 256-bit value, and then use
> regcache_raw_supply() to fill the register cache.
>

I can do that with extra memory copy.


-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]