HP (Hewlett-Packard) Ski Simulator Manuale Utente

Pagina di 110
Copyright © 2000 Hewlett-Packard Co.
Linux and MS-DOS ABI Emulation
7-3
Ski IA-64 Simulator Reference Manual 1.0L
7.3
MS-DOS Application Environment
IA-32 application-mode programs “see” a limited MS-DOS environment. The MS-DOS environment is emulated by cre-
ating and initializing an MS-DOS Program Segment Prefix (PSP) and by setting up the stack pointer (
iasp
) and segmen-
tation registers. The arguments you gave with the
iaload
command, such as “
iaload my_program foo bar baz
”, are
placed in the PSP as if they were command line parameters.
Ski supports the MS-DOS “
INT 20
” call to terminate the simulated program and the “
INT 21
” system calls shown in
Table 7-3. When an IA-32 program makes an
INT 21
call that’s not supported, the simulator stops the simulation and dis-
plays an error message.
7.4
Program I/O
Your program may need to read from standard in (stdin: file descriptor 0) and write to standard out (stdout: file descriptor
1) and standard err (stderr: file descriptor 2). As with all Linux programs, these file descriptors are connected, by default,
to your keyboard and screen. You can redirect them in the usual way: when you invoke Ski, use the < and > operators rec-
ognized by most Linux shells. For example, “
bski
-noconsole
my_program
foo
bar
baz
<
test_input
>simulated_output
” runs
bski
, loading the IA-64 program file
my_program
and passing it the arguments
foo
,
bar
and
baz
via the argc/argv mechanism. Because no command file was provided via the
-i
flag (described in Section 2.5.1,
bski
internally generates a
run
command followed by a
quit
command. The (simulated) pro-
gram reads on standard in from the file
test_input
and writes on standard out to the file
simulated_output
. Having
not been redirected, writes to standard err go to the default place, normally the terminal screen.
Table 7-3. MS-DOS System Calls (in Hexadecimal) Supported by Ski
00: terminate program
02: display character
08: read keyboard without echo
09: display string
2a: get date
2c: get time
30: get version number
3c: create file with handle
3d: open file with handle
3e: close file with handle
3f: read file or device
40: write file or device
44: device status control
44, sub-function 0: get device data
4c: end program
51: get PSP address
62: get PSP address (same as 51)