Lab 5: GDT, IDT, PIC & PIT


Tasks for today:
  1. Create a working timer interrupt

  • PIT and PIC are chips with their own registers
  • How does CPU read from and write to peripheral chips' registers: memory-mapped and port-mapped: IN and OUT instructions
  • PIT and PIC are port-mapped. Find out PIT's port: PIT
  • Find out PIC's port: PIC
  • Now we can write values to their registers to configure them.
  • What do we want them to do?
  • PIT: Generate timer interrupt once every 10 ms.
  • PIC: Route timer interrupt to interrupt #32
  • Configure PIT: select channel and mode
  • Periodic interrupt to PIC: Channel 0 and Mode 2
  • Mode 2: reload value and counter
  • What is the reload value for 10 ms
  • Configure PIC: use mater PIC and remap IRQ0 to 32. Why? remapping
  • Initialization procedure: init
  • Very last thing: send end of interrupt to acknowledge eoi

  • Author: Zhuoqun (Tom) Cheng.