4.8.8 Accessing Functions in Boot or Secure Segments
Functions in the boot or secure segments without access entries can be referenced like any other function:
call func1 ; call func1
mov #handle(func1),w1 ; create 16 bit pointer to func1 (instr)
.word handle(func1) ; create 16 bit pointer to func1 (data)
.pword func1 ; create 24 bit pointer to func1
In order to support the separate linking of boot and secure application segments, access entry points may be defined. Access entry points provide a way to transfer control across segments to a function that may not be defined at link time. For more information about access entry points, see 5.5 Directives that Define Symbols and 11.12 Boot and Secure Segments.
The boot()
and secure()
operators can be used to reference boot or secure functions via access entry points. These operators can be applied in both instructions and data directives, and will return 16, 24, or 32 bits, depending on the context.
call boot(4) ; call access entry 4 in the boot segment
rcall secure(4) ; pc-relative call to secure access entry 4
mov #boot(4),w1 ; load 16 bit pointer to boot entry 4
.word secure(5) ; create 16 bit pointer to secure entry 5
.pword secure(5) ; create 24 bit pointer to secure entry 5
.long boot(6) ; create 32 bit pointer to boot entry 6
goto boot(7) ; jump to boot entry 7
bra secure(7) ; unconditional branch to secure entry 7
bra cc, boot(8) ; conditional branch to boot entry 8