PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set
(06-25-2021, 12:09 AM)Vega Wrote: Not it's not. Eieio is the only instruction that is designed to effect store gathering.

Sync vs Isync

sync: Waits for all instructions to complete and no subsequent instructions are initiated until the sync itself has been completed.

isync: Waits for all instructions to complete, however instructions after the isync are refetched and executed with whatever context (privilege, translation, protection) that was established by the previous instructions.

Basically sync is a full barricade, while isync is a partial barrier in lamest terms.

Sync is also used to wait for data cache updates/flushes/etc to complete, while isync is used to wait for instruction cache updates/flushes/etc to complete. I only know a little bit of Broadway's Cache model so there's definitely more to sync and isync than what I just explained.

Regarding Wii codes, sync and isync are used for self modifying code or to flush out the cache (as a whole) if a code is writing a new instruction to memory so another code will run the new instruction. If the cache isn't flushed, the old instruction may execute even though you see the new instruction in memory.

lis r0, 0x4E80 #Example compiled instruction for a blr
ori r0, r0, 0x0020
stw r0, 0 (r4) #Write in new instruction to memory
dcbst 0, r4 #Update memory
sync #Wait for everything to complete, update the data cache
icbi 0, r4 #Whatever instruction(s) was in the instruction cache beforehand is invalidated
isync #Wait for instruction cache to be updated

At this point the new blr instruction in memory is there and will be executed if called upon

I'll be honest. I'm not sure if I fully understand it still, I had to look some other things up for it but I think I might have a basic understanding so far.
This is the list I've made for this, do I have the correct definitions?

dcbst = (Data Cache Block Store) = Writes a byte into the system memory. If you decide to use a register number for the first operand instead of the value "0", the code will write whatever is in Register B to the system memory.

icbi = (Instruction Cache Block Invalidate) =  Clears the system memory of the value stored by dcbst?

sync = (Sync) = Waits for every prior instruction within a function to be executed before it advances to the next instruction.

isync = (Instruction Synchronize) = Prevents code from advancing until the memory cache is changed/cleared?

Messages In This Thread
RE: PowerPC For Dummies: A simplified guide to understanding the PowerPC Instruction Set - by JimmyKazakhstan - 06-25-2021, 05:17 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)