Reputation: 1386
what is the usage of context
in xv6 OS ?
what is the job of each register in context
?
struct context {
uint edi;
uint esi;
uint ebx;
uint ebp;
uint eip;
};
Upvotes: 2
Views: 2749
Reputation: 323
This structure is the kernel context of the running process.
The user mode context is saved into the trapframe
structure.
Upvotes: 2
Reputation: 220
context
is that set of information that allows you to resume execution of a task from the exact same point where it stopped due to context switch (i.e. the scheduler selects another task to run and suspends the current one, hence it has to save the execution information of the current task and restore those of the next task to run).
The purpose of each of those registers is:
edi
: Destination index, for string operationsesi
: Source index, for string operationsebx
: Base index, for use with arraysebp
: Stack Base Pointer, for holding the address of the current stack frame eip
: Instruction Pointer, points to instruction to be executedUpvotes: 8