Crate x86

Source
Expand description

Generic support for 32-bit Intel/AMD CPUs.

§Interrupt Handling

Once initialized, this crate assumes ownership of the CPU’s interrupt handling facilities.

Interrupts from external devices are handled by calling an extern function named _handle_external_interrupt, which must be defined by the chip or board crate. This function must have a cdecl ABI and must accept a single u32 argument which is the number of the external interrupt.

The _handle_external_interrupt function should typically perform the following tasks:

  1. Call InterruptPoller::set_pending to mark the given interrupt as pending
  2. Send an EOI signal to any relevant interrupt controllers

Any other logic needed to service the interrupt (for instance, reading from buffers or re-arming hardware) should typically be performed within the current chip’s service_pending_interrupts method.

Apart from external interrupts, all other interrupt categories such as CPU exceptions or system calls are handled internally by this crate.

§Safety

Some of the unsafe code in this crate relies on the blanket assumption that this code is being compiled into a Tock kernel for an x86 system. When calling code from this crate, the following statements must always be true:

  • The CPU is executing at ring 0
  • The CPU has I/O privileges

Modules§

mpu
registers
Tock x86.
support
Miscellaneous low-level operations

Structs§

Boundary
Defines the usermode-kernelmode ABI for x86 platforms.
InterruptPoller
A mechanism for synchronously managing and polling x86 interrupts.

Constants§

IDT_RESERVED_EXCEPTIONS
Number of exceptions reserved in the IDT by Intel. Reference: https://en.wikipedia.org/wiki/Interrupt_descriptor_table#Common_IDT_layouts

Functions§

init
Performs low-level CPU initialization.