CPU Modes Flashcards

1
Q

The 2 CPU Modes

A

Kernel and User Mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How are CPU modes implemented?

A

Using protection rings (privilege levels).
Lower numbered rings have higher privilege.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why are protection rings needed?

A
  1. Fault isolation (handled in more privileged ring)
  2. Privileged instructions
  3. Privileged memory space
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When is Kernel mode used?

A
  1. Faults are captured and handled by the kernel
  2. Issuing privileged instructions (i.e. disk I/O)
  3. Accessing kernel memory space
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Privileged Instruction Examples

A
  • I/O operations!!
  • Enable/disable interrupts
  • Changing from kernel to user mode
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

System Call

A

Call to the kernel to execute a privileged instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

PC

A

Program Counter.
Register that stores the address of the instruction to be executed.
Incremented after fetching an instruction.
Can only be incremented by Kernel code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Process for Linux System Call

A
  1. Privileged instruction is encountered (printf)
  2. System call type is stored in register (%eax = sys_write;)
  3. Interrupt is sent (0x80)
  4. Enters Kernel mode
  5. Interrupt code is used to look up handlers in IDT, Interrupt descriptor table
  6. Previously saved sys call is used to look up code in previously found handler table (syscalls[%eax])
  7. Needed code is run
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is interrupt code for a system call?

A

0x80

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

strace

A

Intercepts and records process’s system calls and the process’s received signals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

ltrace

A

Intercepts and records executed process’s dynamic library calls and the process’s received signals

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Hypervisor

A

VMM (Virtual Machine Monitor) that runs and manages virtual machines.
Has its own separate permission ring that has the highest privileges.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly