Codes
WiiRd forum
March 29, 2024, 08:22:32 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome on the new server

Update 4.3 - do NOT update!
Gecko 1.9.3.1
Should I get a USB Gecko, I wanna hack?
How do I use my USB Gecko
Where can I get WiiRd?
 
   Home   CODE DATABASE GAMEHACKING Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Indexed and With Update  (Read 3005 times)
Igglyboo
The Greatest
Hacker
Hero Member
*****

Karma: 22
Posts: 593

The Greatest


« on: February 13, 2009, 03:13:41 AM »

I've been trying to understand what these two meant when used in the context of some other op codes but i have no idea.
Could someone please elaborate?

i.e.
Store Word Indexed       stwx  rS, rA, rB
Store Word with update  stwu  rS, d(rA)
Logged

Link
that dev there
Moderator
Hero Member
*****

Karma: 76
Posts: 1254

I hate everyone in this community. Except for you!


WWW
« Reply #1 on: February 13, 2009, 09:33:34 AM »

This gateway to the world.. with a connection to the universe..

okay no.. there are pretty simple:

stwx  rS, rA, rB
-->
 [rA+rB] = rS
 
stwu  rS, d(rA)
-->
 [rA+d] = rS
 rA = rA-4
(could be that I mix up the order - could also lower rA before, brkirch will probably know ^^)

Basically stwu is normally used on rA = r1 - r1 is the stack register, and thus you can store registers on the stack!
Logged

brkirch
Hacker
Sr. Member
*****

Karma: 53
Posts: 395


« Reply #2 on: February 13, 2009, 10:16:46 PM »

stwu  rS, d(rA)
-->
 [rA+d] = rS
 rA = rA-4
(could be that I mix up the order - could also lower rA before, brkirch will probably know ^^)
The register is changed after the value has been stored so that much is right, but actually it does not do rA = rA-4 but instead rA = rA+d.

Basically stwu is normally used on rA = r1 - r1 is the stack register, and thus you can store registers on the stack!
To elaborate on that, the idea is that stwu will allow for the stack pointer to be stored AND changed with the same instruction.  If this was not possible then there would be a time between storing the stack pointer and changing it where the stack is corrupted; during that time an interrupt handler could try to use the stack and bad things could happen (crash, memory corruption, etc.).
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!