Previous - Up - Next

21   Driving Context Changes

As explained in section 12.3.1, each processor has a current context, which represents the virtual address space currently visible to code running on the processor. Things such as virtual-address breakpoints and symbol information are properties of contexts, so when the current context of a processor is changed, those things change with it.

Chapter 12.3 explains how this is used in practice. This chapter focuses on another issue: how to actually change the current context.

As a general guideline, you probably want a separate context for each userspace process and kernel that you are interested in (and a default context for everything you are not interested in). After all, one of the abstractions maintained by most operating systems is that each process has its own virtual address space, so if you, for example, set a virtual breakpoint at an address in one process, you probably do not want it to trigger in other processes.

The bad news is that since Simics does not need to know about the abstractions—such as processes—implemented by the operating system, it (quite correctly) does not try to. This is actually very good news most of the time, since Simics can then run any and all code without having to be modified, but in this case it is bad news: Simics knows nothing about processes on the simulated machine, and so cannot change contexts automatically. You will have to do that, and section 21.1 explains how.

The good news is that Simics comes with add-on modules, process trackers, that each understand a particular architecture/OS combination, and can help you tell which process is active when. They even come with source code, which is helpful if you want to write your own process tracker for some architecture/OS combination that does not yet have one. Process trackers are covered in section 21.2.

Simics also comes with a context-switcher module. It automates the task of listening to what the process tracker says and switching contexts accordingly. Section 21.3 describes how to use it.

21.1   Switching Contexts Manually

21.2   Process Trackers

21.3   Switching Contexts Automatically

Previous - Up - Next