typedef enum { Pin_Init, Pin_Smi, Pin_Nmi, Pin_Ignne, Pin_Mcerr, Pin_Cmci /* Do not add new pins. Instead, define individual signal ports */ } x86_pin_t;
The start_up function is used by the local APIC to bring the processor obj out of the waiting for start-up IPI state, with a start address of start_address.
The interrupt function tells the CPU that an interrupt is
waiting. The interrupt vector number is given by the ack callback
function. It is not allowed to call the ack callback during the
interrupt call itself. The data object should
implement the interrupt_cpu
interface. Note that the
interrupt_cpu
interface defines the ack function,
which should be the same as the ack argument. It is recommended
that new implementations does not use rely on the ack argument,
but rather looks up the callback through the interrupt_cpu
interface from the object given by the data argument. The
interrupt function returns 1 if the interrupt is accepted, and 0
if it is not accepted because there is already an interrupt queued up to be
processed. If 0 is returned, the caller should retry the call after one
step. It should wait one step since the handling of an interrupt takes one
step.
If a checkpoint was taken when an interrupt was waiting, the acknowledge
callback function can be recovered by looking up the
interrupt_cpu
interface at the APIC object given in the
data parameter.
If the interrupt was cancelled before it was acknowledged, the uninterrupt function is used. It is also called by the acknowledge callback. Thus, each invocation of interrupt is followed by exactly one call to uninterrupt at all times. The ack parameter is unused and should be ignored. When the processor is reset, it forgets a waiting interrupt so it is not necessary to call uninterrupt during a reset.
The functions in the interrupt_ack
interface provides almost
the same functionality as the interrupt and
uninterrupt functions in this interface. The only difference is
that the interrupt function in this interface returns 0 when the
interrupt cannot be handled which allows the device to retry later.
The has_pending_interrupt and has_waiting_interrupt calls should return information about interrupts in progress. An interrupt is said to be pending if it is acked by the processor and will be taken before execution of the next instruction. An interrupt is waiting if the logical interrupt line is high, but the interrupt has not yet been acked. These functions are used for sanity checks by the APIC. The APIC should keep track of posted interrupts by itself. These functions return 1 if an interrupt is pending/waiting, and 0 otherwise.
The logical_to_linear function returns the translated linear address from the given logical address and segment register number. The function uses the current content of control registers and segment registers to calculate the linear address. The tagged return value is marked invalid if no valid translation exists, for example if the passed logical address is beyond the segment limit of the passed segment or if it is non-canonical. The encoding of segment is 0 for ES, 1 for CS, 2 for SS, 3 for DS, 4 for FS, and 5 for GS.
The linear_to_physical function returns the physical address corresponding to the given linear address. The function uses the current content of control registers, TLBs and possibly page tables to calculate the physical address. A return value of -1 signals that no valid mapping exists.
enter_acpi_c2_state is called from the chipset power module to request the CPU to enter an energy-saving state.
SIM_INTERFACE(x86) { void (*set_pin_status)(conf_object_t *obj, x86_pin_t pin, int status); void (*start_up)(conf_object_t *obj, uint32 start_address); int (*interrupt)(conf_object_t *obj, int (*ack)(conf_object_t *obj), conf_object_t *data); void (*uninterrupt)(conf_object_t *obj, int (*ack)(conf_object_t *obj)); int (*has_pending_interrupt)(conf_object_t *obj); int (*has_waiting_interrupt)(conf_object_t *obj); tagged_linear_address_t (*logical_to_linear)(conf_object_t *obj, int segment, logical_address_t addr); physical_address_t (*linear_to_physical)(conf_object_t *obj, data_or_instr_t d_or_i, linear_address_t addr); void (*enter_acpi_c2_state)(conf_object_t *obj); }; #define X86_INTERFACE "x86"