geegeeWap
geegeeWap

Reputation: 35

Return 0 in PowerPC 32 bit

I'm quite new to PPC and currently haven't been able to find the instruction to return 0 in PPC? I've done quite a bit of searching around and haven't really found anything of use, any help would be appreciated thanks.

Upvotes: 0

Views: 176

Answers (1)

user6501446
user6501446

Reputation:

r3 is generally the register that contains the result or the return of a function. In PowerPC, returning zero usually looks like this:

li r3, 0
blr

To break it down a bit, the instruction li will load r3 with the immediate value of 0 and the instruction blr will handle branching to the address in the link register.

Upvotes: 2

Related Questions