[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Consult] About SPRs information
From: |
Chen Gang |
Subject: |
Re: [Qemu-devel] [Consult] About SPRs information |
Date: |
Wed, 29 Apr 2015 05:32:41 +0800 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 4/29/15 04:19, Chen Gang wrote:
> On 4/28/15 06:04, Richard Henderson wrote:
>> On 04/27/2015 02:12 PM, Chen Gang wrote:
>>> Now, I am blocked at SPRs: "mtspr SPR_CMPEXCH_VALUE %r12", and trying to
>>> solve it.
>>
>> SPR_CMPEXCH_VALUE should be present in your cpu structure, should be a TCGv
>> like all of your other registers, and this expands to a simple move.
>>
>> You will probably need to dispatch on the SPR number. Some of these will be
>> normal moves to special register slots. Some of these may require a function
>> call in order to handle the side effects.
>>
After check the next instruction cmpexch which uses SPR_CMPEXCH_VALUE:
- Do we need a lock for cmpexch spr? (I guess not)
- Do we need the same lock within cmpexch instruction for reading
cmpexch spr? (I guess not)
- When each spr occurs, do we need end the current block just like
branch/call instruction occurs? (I guess we need)
The related information for cmpexch instruction:
Description
Compare the 8-byte contents of the CmpValue SPR with the 8-byte
value in memory at the address held in the first source register. If
the values are not equal, then no memory operation is performed. If
the values are equal, the 8-byte quantity from the second source
register is written into memory at the address held in the first
source register. In either case, the result of the instruc- tion is
the value read from memory. The compare and write to memory are
atomic and thus can be used for synchronization purposes. This
instruction only operates for addresses aligned to a 8-byte boundary.
Unaligned memory access causes an Unaligned Data Reference interrupt.
Functional Description
uint64_t memVal = memoryReadDoubleWord (rf[SrcA]);
rf[Dest] = memVal;
if (memVal == SPR[CmpValueSPR])
memoryWriteDoubleWord (rf[SrcA], rf[SrcB]);
>
> OK, thank you very much.
>
Thanks.
--
Chen Gang
Open, share, and attitude like air, water, and life which God blessed