ack/mach/powerpc/libem/sts.s

51 lines
655 B
ArmAsm
Raw Normal View History

2007-11-02 18:56:58 +00:00
.sect .text
! Stores a variable-sized structure from the stack.
!
! r3 = size
! r4 = address
.define .sts
.sts:
! These sizes are handled specially.
2007-11-02 18:56:58 +00:00
lwz r5, 0(sp)
cmplwi r3, 1
ble size1
cmplwi r3, 2
ble size2
cmplwi r3, 4
ble size4
2007-11-02 18:56:58 +00:00
! Variable-sized structure.
2007-11-02 18:56:58 +00:00
addi r3, r3, 3
clrrwi r3, r3, 2 ! align size
srwi r3, r3, 2 ! convert size to the number of words
2007-11-02 18:56:58 +00:00
mtspr ctr, r3
2007-11-02 18:56:58 +00:00
1:
lwz r5, 0(sp)
addi sp, sp, 4
stw r5, 0(r4)
addi r4, r4, 4
bdnz 1b ! decrement CTR, jump if non-zero
blr
2007-11-02 18:56:58 +00:00
size1:
stb r5, 0(r4)
b 1f
size2:
sth r5, 0(r4)
b 1f
size4:
stw r5, 0(r4)
1:
addi sp, sp, 4
blr