Guardian Procedure Calls Reference Manual
Examples
• This example is of a function that returns the addresses and their lengths. Note that if the length
is 0, the address is not significant.
typedef struct {
void * baseAddress;
intlength;
} globalLocation[4];
extern char _data_start;
extern char _data_end;
extern char _sdata_start;
extern char _sdata_end;
extern char _sbss_start;
extern char _sbss_end;
extern char _bss_start;
extern char _bss_end;
void GETGLOB (globalLocation g) {
g[0].baseAddress=&_data_start;
g[0].length=&_data_end-&_data_start;
g[1].baseAddress=&_sdata_start;
g[1].length=&_sdata_end-&_sdata_start;
g[2].baseAddress=&_bss_start;
g[2].length=&_bss_end-&_bss_start;
g[3].baseAddress=&_sbss_start;
g[3].length=&_sbss_end-&_sbss_start;
}
• This is an example of an EpTAL program skeleton that uses the previous function:
struct globalLocation[0:3];
begin
extaddr baseAddress;
int(32) length;
end;
proc GETGLOB(g);
int .ext g(globalLocation);
external;
?source $system.system.extdecs(DEBUG)
proc m main;
begin
GETGLOB(globalLocation);
DEBUG;
end;
• This is an example of the contents of the global Location from eInspect at that DEBUG call:
(eInspect 1,455):p GLOBALLOCATION
$1 = {{
BASEADDRESS = 0x8000000,
LENGTH = 0
}, {
BASEADDRESS = 0x8000090,
LENGTH = 0
}, {
BASEADDRESS = 0x8000090,
LENGTH = 0
}, {
BASEADDRESS = 0x8000090,
LENGTH = 48
}}
Bounds Checking of Reference Parameters for Guardian Procedures 37