<- previous    index    next ->

Lecture 11 Privileged instructions

The Intel 80x86 have privilege levels.
There are instructions that can only be executed at the highest
privilege level, CPL = 0. This would be reserved for the
operating system in order to preven the average user from
causing chaos. e.g. The average user could issue a HLT instruction
to halt the machine and thus every process would be dead.
Other CPL=0 only instructions include:
  CLTS  Clear Task Switcing flag in cr0
  INVP  Invalidate cache
  INVLPG Invalidate translation lookaside buffer, TLB
  WBINVD Write Back and Invalidate cache

It should be obvious that when running a multiprocessing operating
system, that there are many instructions that only the operating
system should use.

The operating system controls the resources of the computer,
including RAM, I/O and user processes. Some sample protections
are tested by the following sample programs:

A few simple tests to be sure protections are working.
These three programs result in segfault, intentionally.
safe.asm store into read only section
safe1.asm store into code section
safe2.asm jump (execute) data

A few simple tests to be sure privileged instructions can not execute.
priv.asm hlt instruction to halt computer
priv1.asm other privileged instructions

In order to allow the user some access, controlled access, to
system resources, an interface to the operating system, or kernel,
is provided. You will see in the next lecture that some BIOS
functions are also provided as Linux kernel calls.

    <- previous    index    next ->

Other links

Go to top