XSM Simulator Usage Specification
Introduction¶
The XSM (eXperimental String Machine) Simulator is used to simulate the XSM hardware.
Within your XSM directory, use the following command to run the simulator
./xsm [--timer #1] [--disk #2] [--console #3] [--debug]
-
Syntax :
--timer value
Semantics : This flag sets the number of user mode instructions after which timer interrupt is triggered to the value specified. --timer 0 disables the timer. The range of value is from 0 to 1024. Default Value : 20 -
Syntax :
--disk value
Semantics : This flag sets the number of user mode instructions after which the disk interrupt is triggered to the value specified. The range of value is from 20 to 1024. Note that count begins only after a LOAD or STORE machine instruction gets executed. Default Value : 20 -
Syntax :
--console value
Semantics : This flag sets the number of user mode instructions after which console interrupt is triggered to the value specified. The range of value is from 20 to 1024. Note that count begins only after a IN machine instruction gets executed. Default Value : 20 -
Syntax :
--debug
Semantics : This flag sets the machine into DEBUG mode when it encounters a BRKP machine instruction. Any BRKP instruction in the program will be ignored by the machine if this flag is not set. Further details are given in the section below. The machine instruction INI gets enabled only in DEBUG mode.
Debugging¶
The --debug
flag is used to debug the running machine. When this flag is set and the machine encounters a breakpoint instruction, the machine enters the DEBUG mode. In this mode a prompt is displayed which allows the user to enter commands to inspect the state of the machine.
The commands in DEBUG mode are :
-
Syntax :
step
/s
Semantics : The execution proceeds by a single step. -
Syntax :
step <N>
/s <N>
Semantics : The execution proceeds by N number of steps. -
Syntax :
continue
/c
Semantics : The execution proceeds till the next breakpoint (BRKP) instruction. -
Syntax :
continue <N>
/c <N>
Semantics : The execution proceeds till the next N'th occurance of the breakpoint (BRKP) instruction. -
Syntax :
reg
/r
Semantics : Displays the contents of all the machine registers namely IP, SP, BP, PTBR, PTLR, EIP, EC, EPN, EMA, R0-R19 in that order. -
Syntax :
reg <register_name>
/r <register_name>
Semantics : Displays the contents of the specified register.
Sample usage: r R5, reg PTLR -
Syntax :
mem <page_num>
/m <page_num>
Semantics : Writes the contents of the memory page<page_num>
to the file "mem" in the XSM folder.
Sample usage: mem 5, m 20 -
Syntax :
mem <page_num_1> <page_num_2>
/m <page_num_1> <page_num_2>
Semantics : Writes the contents of the memory from pages<page_num_1>
to<page_num_2>
to the file "mem" in XSM folder.
Sample usage: mem 5 8, m 0 10 -
Syntax :
pcb
/p
Semantics : Displays the Process Table entry of the current process. -
Syntax :
pcb <pid>
/p <pid>
Semantics : Displays the Process Table entry of the process with the given<pid>
. -
Syntax :
pagetable
/pt
Semantics : Displays the Page Table at the location pointed by PTBR (Page Table Base Register). -
Syntax :
pagetable <pid>
/pt <pid>
Semantics : Displays the<pid>th
Page Table. -
Syntax :
diskmaptable
/dmt
Semantics : Displays the Disk Map Table of the current process. -
Syntax :
diskmaptable <pid>
/dmt <pid>
Semantics : Displays the Disk Map Table of the process with the given<pid>
. -
Syntax :
resourcetable
/rt
Semantics : Displays the Per-process Resource Table of the current process. -
Syntax :
resourcetable <pid>
/rt <pid>
Semantics : Displays the Per-process Resource Table of the process with the given<pid>
. -
Syntax :
filetable
/ft
Semantics : Displays the Open File Table. -
Syntax :
semtable
/st
Semantics : Displays the Semaphore Table. -
Syntax :
memfreelist
/mf
Semantics : Displays the Memory Free List. -
Syntax :
filestatus
/fst
Semantics : Displays the File Status Table. -
Syntax :
diskstatus
/dst
Semantics : Displays the Disk Status Table. -
Syntax :
systemstatus
/sst
Semantics : Displays the System Status Table. -
Syntax :
terminalstatus
/tst
Semantics : Displays the Terminal Status Table. -
Syntax :
buffertable
/bt
Semantics : Displays the Buffer Table. -
Syntax :
inodetable
/it
Semantics : Displays the memory copy of the Inode Table. -
Syntax :
usertable
/ut
Semantics : Displays the memory copy of the User Table. -
Syntax :
diskfreelist
/df
Semantics : Displays the memory copy of the Disk Free List. -
Syntax :
rootfile
/rf
Semantics : Displays the memory copy of the Root File. -
Syntax :
location <address>
/l <address>
Semantics : Displays the content at memory address after address translation. -
Syntax :
val <address>
/v <address>
Semantics : Displays the content at memory address without address translation. -
Syntax :
watch <physical_address>
/w <physical_address>
Semantics : Sets a watch point to this address. Watch point is used to track changes of a particular memory location. Whenever a word which is watched is altered, program execution is stopped and the debug interface is invoked. Atmost 16 watch points can be set. -
Syntax :
watchclear
/wc
Semantics : Clears all the watch points. -
Syntax :
list
/ls
Semantics : List 10 instructions before and after the current instruction . -
Syntax :
page <address>
/pg <address>
Semantics : Displays the Page Number and Offset for the given<address>
. -
Syntax :
exit
/e
Semantics : Exits the debug prompt and halts the machine. -
Syntax :
help
/h
Semantics : Displays commands in brief. -
Syntax :
accesslocktable
/alt
Semantics : Displays the Access Lock Table. (Only available on NEXSM simulator used in Stage 28 of Roadmap)
Note
Simply pressing the Return key at the debug prompt will re-execute the previous command.