CS318 - Pintos
Pintos source browser for JHU CS318 course
Data Structures | Typedefs | Enumerations | Functions
interrupt.h File Reference
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for interrupt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  intr_frame
 Interrupt stack frame. More...
 

Typedefs

typedef void intr_handler_func(struct intr_frame *)
 

Enumerations

enum  intr_level { INTR_OFF, INTR_ON }
 Interrupts on or off? More...
 

Functions

enum intr_level intr_get_level (void)
 Returns the current interrupt status. More...
 
enum intr_level intr_set_level (enum intr_level)
 Enables or disables interrupts as specified by LEVEL and returns the previous interrupt status. More...
 
enum intr_level intr_enable (void)
 Enables interrupts and returns the previous interrupt status. More...
 
enum intr_level intr_disable (void)
 Disables interrupts and returns the previous interrupt status. More...
 
void intr_init (void)
 Initializes the interrupt system. More...
 
void intr_register_ext (uint8_t vec, intr_handler_func *, const char *name)
 Registers external interrupt VEC_NO to invoke HANDLER, which is named NAME for debugging purposes. More...
 
void intr_register_int (uint8_t vec, int dpl, enum intr_level, intr_handler_func *, const char *name)
 Registers internal interrupt VEC_NO to invoke HANDLER, which is named NAME for debugging purposes. More...
 
bool intr_context (void)
 Returns true during processing of an external interrupt and false at all other times. More...
 
void intr_yield_on_return (void)
 During processing of an external interrupt, directs the interrupt handler to yield to a new process just before returning from the interrupt. More...
 
void intr_dump_frame (const struct intr_frame *)
 Dumps interrupt frame F to the console, for debugging. More...
 
const char * intr_name (uint8_t vec)
 threads/interrupt.h More...
 

Typedef Documentation

◆ intr_handler_func

typedef void intr_handler_func(struct intr_frame *)

Definition at line 58 of file interrupt.h.

Enumeration Type Documentation

◆ intr_level

enum intr_level

Interrupts on or off?

Enumerator
INTR_OFF 

Interrupts disabled.

INTR_ON 

Interrupts enabled.

Definition at line 8 of file interrupt.h.

Function Documentation

◆ intr_context()

bool intr_context ( void  )

Returns true during processing of an external interrupt and false at all other times.

Definition at line 212 of file interrupt.c.

References in_external_intr.

Referenced by acquire_console(), cond_signal(), cond_wait(), console_locked_by_current_thread(), intq_getc(), intq_putc(), intr_enable(), intr_handler(), intr_yield_on_return(), lock_acquire(), release_console(), sema_down(), thread_block(), thread_exit(), thread_yield(), and wait().

Here is the caller graph for this function:

◆ intr_disable()

enum intr_level intr_disable ( void  )

Disables interrupts and returns the previous interrupt status.

Definition at line 104 of file interrupt.c.

References intr_get_level().

Referenced by debug_backtrace_all(), debug_panic(), idle(), init_thread(), input_getc(), intr_set_level(), pit_configure_channel(), sema_down(), sema_try_down(), sema_up(), serial_flush(), serial_init_queue(), serial_putc(), speaker_off(), speaker_on(), thread_exit(), thread_unblock(), thread_yield(), timer_ticks(), and vga_putc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intr_dump_frame()

void intr_dump_frame ( const struct intr_frame )

Dumps interrupt frame F to the console, for debugging.

Definition at line 411 of file interrupt.c.

References intr_frame::cs, intr_frame::ds, intr_frame::eax, intr_frame::ebp, intr_frame::ebx, intr_frame::ecx, intr_frame::edi, intr_frame::edx, intr_frame::eip, intr_frame::error_code, intr_frame::es, intr_frame::esi, intr_frame::esp, intr_names, printf(), PRIx16, PRIx32, intr_frame::ss, and intr_frame::vec_no.

Referenced by kill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intr_enable()

enum intr_level intr_enable ( void  )

Enables interrupts and returns the previous interrupt status.

Definition at line 88 of file interrupt.c.

References ASSERT, intr_context(), and intr_get_level().

Referenced by intr_set_level(), kernel_thread(), page_fault(), and thread_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intr_get_level()

enum intr_level intr_get_level ( void  )

◆ intr_init()

void intr_init ( void  )

Initializes the interrupt system.

Definition at line 118 of file interrupt.c.

References idt, INTR_CNT, intr_names, intr_stubs, make_idtr_operand(), make_intr_gate(), and pic_init().

Referenced by pintos_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intr_name()

const char* intr_name ( uint8_t  vec)

threads/interrupt.h

threads/interrupt.h

Definition at line 435 of file interrupt.c.

References intr_names.

Referenced by kill().

Here is the caller graph for this function:

◆ intr_register_ext()

void intr_register_ext ( uint8_t  vec_no,
intr_handler_func handler,
const char *  name 
)

Registers external interrupt VEC_NO to invoke HANDLER, which is named NAME for debugging purposes.

The handler will execute with interrupts disabled.

Definition at line 181 of file interrupt.c.

References ASSERT, INTR_OFF, name, and register_handler().

Referenced by ide_init(), kbd_init(), serial_init_queue(), and timer_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intr_register_int()

void intr_register_int ( uint8_t  vec_no,
int  dpl,
enum intr_level  level,
intr_handler_func handler,
const char *  name 
)

Registers internal interrupt VEC_NO to invoke HANDLER, which is named NAME for debugging purposes.

The interrupt handler will be invoked with interrupt status LEVEL.

The handler will have descriptor privilege level DPL, meaning that it can be invoked intentionally when the processor is in the DPL or lower-numbered ring. In practice, DPL==3 allows user mode to invoke the interrupts and DPL==0 prevents such invocation. Faults and exceptions that occur in user mode still cause interrupts with DPL==0 to be invoked. See [IA32-v3a] sections 4.5 "Privilege Levels" and 4.8.1.1 "Accessing Nonconforming Code Segments" for further discussion.

Definition at line 202 of file interrupt.c.

References ASSERT, name, and register_handler().

Referenced by exception_init(), and syscall_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intr_set_level()

enum intr_level intr_set_level ( enum  intr_level)

Enables or disables interrupts as specified by LEVEL and returns the previous interrupt status.

Definition at line 81 of file interrupt.c.

References intr_disable(), intr_enable(), and INTR_ON.

Referenced by debug_backtrace_all(), init_thread(), input_getc(), pit_configure_channel(), sema_down(), sema_try_down(), sema_up(), serial_flush(), serial_init_queue(), serial_putc(), speaker_off(), speaker_on(), thread_unblock(), thread_yield(), timer_ticks(), and vga_putc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ intr_yield_on_return()

void intr_yield_on_return ( void  )

During processing of an external interrupt, directs the interrupt handler to yield to a new process just before returning from the interrupt.

May not be called at any other time.

Definition at line 222 of file interrupt.c.

References ASSERT, intr_context(), and yield_on_return.

Referenced by thread_tick().

Here is the call graph for this function:
Here is the caller graph for this function: