
101
Chapter 2 Applications Programming
2.2.3 Run–Time HIF Services
Table 2-2 lists the HIF system call services, calling parameters, and the returned
values. If a column entry is blank, it means the register is not used or is undefined.
Table 2-3 describes the parameters given in Table 2-2 . Before invoking a HIF ser-
vice, the service number and any input parameters passed to the operating system are
loaded into assigned global registers. Each HIF service is identified by its associated
service number which is placed in global register
gr121
. Parameters are passed, as
with procedure calls, in local registers starting with
lr2
. Application programs do not
need to issue ASSERT instructions directly when making service calls. They normal-
ly use a library of assembly code glue routines. The
write
service glue routine is
shown below:
__write:
;HIF assembly glue routine for write service
gr121,20
;tav is gr121
69,gr1,gr1
;system call trap
gr121,lr0
;return if sucessful
gr122,_errno
;pass errror number
gr122,_errno
0,0,gr121,gr122 ;store errnor number
lr0
;return if failure
constn gr96,–1
const
asneq
jmpti
const
consth
store
jmpi
Application programs need merely call the
_write()
leaf routine to issue the ser-
vice request. The system call convention states that return values are placed in global
registers starting with
gr96
; this makes the transfer of return data by the assembly
glue routine very simple and efficient. If a service fails, due to, say, bad input parame-
ters, global register
gr121
is returned with an error number supplied by the operating
system. If the service was successful,
gr121
is set to Boolean TRUE (0x80000000).
The glue routines check the
gr121
value, and if it is not TRUE, copy the value to
memory location
errno.
This location, unlike
gr121
is directly accessible by a C lan-
guage application which requested the service.
Run–time HIF services are divided into two groups, they are separated by their
service number. Numbers 255 and less require the support of complex operating sys-
tem services such as file system management. Service numbers 256 and higher relate
to simpler service tasks. Note, AMD reserves service numbers 0–127 and 256–383
for HIF use. Users are free to extend operating system services using the unreserved
service numbers. Operating systems which implement HIF, OS–boot for example,
do not always directly support services 255 and lower. These HIF services are often
translated into native operating system calls which are virtualising HIF services. For
example, when a HIF conforming application program is running on a UNIX–based
system, the HIF services are translated into the underlying UNIX services. OS–boot
supports the more complex services by making use of the MiniMON29K message
system to communicate the service request to a debug support host processor (see
Chapter 7). For this reason, services 255 and lower are not always available. Services