Previous - Up - Next

4.5   Getting Files into a Simulated System

A full systems simulation can be run completely isolated, but Simics also provides a way for the simulated system to access files that are located on the host, i.e, your real computer.

SimicsFS is a Linux kernel filesystem module that talks to a simulated device, namely a corresponding Simics module. Our firststeps machine is prepared with simicsfs support; just mount /host to access it.

root@firststeps: ~# mount /host
[simicsfs] mounted
root@firststeps: ~# ls /host
bin         etc         lost+found  net         root        sys
boot        home        media       opt         sbin        tmp
root@firststeps: ~#

Note: Support for SimicsFS have to be installed in the target system, which means it have to be modified. Modules exists for the Linux 2.4 and 2.6 series. On other systems a module has to be written in order to get SimicsFS to work.

As write support is experimental, SimicsFS is mounted read-only by default. To be able to transfer files from the simulation to the host, mount it read-write.

root@firststeps: ~# mount /host -o remount,rw
root@firststeps: ~# cp /proc/cpuinfo /host/tmp/cpuinfo
root@firststeps: ~# umount /host
root@firststeps: ~#

Now, we can read the file on our host machine.

[press control-C]
simics>  !cat /tmp/cpuinfo
processor       : 0
cpu             : 440GP Rev. C
revision        : 4.129 (pvr 4012 0481)
bogomips        : 799.53
vendor          : IBM
machine         : Ebony

Note: The ! command will interpret the rest of the command line as if it was given in a shell.

Sometimes it is desirable to limit the accessible files to a certain directory. This is done with the <hostfs>.root command. Set the root to the Simics installation directory.

[press control-C]
simics>  hfs0.root sim->simics_base
simics>  c

Now transfer the file to be used in next section into the simulated system.

root@firststeps: ~# mount /host
[simicsfs] mounted
root@firststeps: ~# cp /host/targets/ebony/images/debug_example .
root@firststeps: ~#

You can read more about SimicsFS/hostfs and other ways to transfer files in chapter 7.

Previous - Up - Next