2017-01-15 21:28:14 +00:00
|
|
|
#include "powerpc.h"
|
|
|
|
|
|
|
|
.sect .text
|
|
|
|
|
|
|
|
! Bounds check. Traps if the value is out of range.
|
2017-01-17 21:31:38 +00:00
|
|
|
! Stack: ( value descriptor -- value )
|
2017-01-15 21:28:14 +00:00
|
|
|
|
|
|
|
.define .rck
|
|
|
|
.rck:
|
|
|
|
lwz r3, 0 (sp)
|
|
|
|
lwz r4, 4 (sp)
|
2017-01-17 21:31:38 +00:00
|
|
|
addi sp, sp, 4 ! leave value on stack
|
2017-01-15 21:28:14 +00:00
|
|
|
|
|
|
|
lwz r5, 0 (r3)
|
|
|
|
cmp cr0, 0, r4, r5
|
|
|
|
bc IFTRUE, LT, .trap_erange
|
|
|
|
|
|
|
|
lwz r5, 4 (r3)
|
|
|
|
cmp cr0, 0, r4, r5
|
|
|
|
bc IFTRUE, GT, .trap_erange
|
|
|
|
|
|
|
|
bclr ALWAYS, 0, 0
|