mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
Completes port of interrpt handling logic
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3340 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* GDT data structures
|
||||
/* GDT data structures ******************************************************
|
||||
*
|
||||
* The Global Descriptor Table or GDT is a data structure used by Intel x86-
|
||||
* family processors starting with the 80286 in order to define the
|
||||
@@ -114,7 +114,33 @@ struct gdt_entry_s
|
||||
struct gdt_ptr_s
|
||||
{
|
||||
uint16_t limit; /* The upper 16 bits of all selector limits */
|
||||
uint32_t base; /* The address of the first gdt_entry_t struct */
|
||||
uint32_t base; /* The address of the first GDT entry */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* IDT data structures ******************************************************
|
||||
*
|
||||
* The Interrupt Descriptor Table (IDT) is a data structure used by the x86
|
||||
* architecture to implement an interrupt vector table. The IDT is used by the
|
||||
* processor to determine the correct response to interrupts and exceptions.
|
||||
*/
|
||||
|
||||
struct idt_entry_s
|
||||
{
|
||||
uint16_t lobase; /* Lower 16-bits of vector address for interrupt */
|
||||
uint16_t sel; /* Kernel segment selector */
|
||||
uint8_t zero; /* This must always be zero */
|
||||
uint8_t flags; /* (See documentation) */
|
||||
uint16_t hibase; /* Upper 16-bits of vector address for interrupt */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* A struct describing a pointer to an array of interrupt handlers. This is
|
||||
* in a format suitable for giving to 'lidt'.
|
||||
*/
|
||||
|
||||
struct idt_ptr_s
|
||||
{
|
||||
uint16_t limit;
|
||||
uint32_t base; /* The address of the first GDT entry */
|
||||
} __attribute__((packed));
|
||||
|
||||
/****************************************************************************
|
||||
@@ -156,6 +182,9 @@ extern "C" {
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN void gdt_flush(uint32_t gdt_addr);
|
||||
EXTERN void idt_flush(uint32_t idt_addr);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
+26
-23
@@ -54,28 +54,29 @@
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Storage order: %ebx, $esi, %edi, %ebp, sp, and return PC */
|
||||
/* Common register save structgure created by up_saveusercontext() and by
|
||||
* ISR/IRQ interrupt processing.
|
||||
*/
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
# define REG_EBX (0*4)
|
||||
# define REG_ESI (1*4)
|
||||
# define REG_EDI (2*4)
|
||||
# define REG_EBP (3*4)
|
||||
# define REG_SP (4*4)
|
||||
# define REG_PC (5*4)
|
||||
# define REG_FLAGS (6*4)
|
||||
#else
|
||||
# define REG_EBX (0)
|
||||
# define REG_ESI (1)
|
||||
# define REG_EDI (2)
|
||||
# define REG_EBP (3)
|
||||
# define REG_SP (4)
|
||||
# define REG_PC (5)
|
||||
# define REG_FLAGS (6)
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#define REG_DS (0) /* Data segment selector */
|
||||
#define REG_EDI (1) /* Saved by pusha */
|
||||
#define REG_ESI (2) /* " " "" " " */
|
||||
#define REG_EBP (3) /* " " "" " " */
|
||||
#define REG_ESP (4) /* " " "" " " */
|
||||
#define REG_EBX (5) /* " " "" " " */
|
||||
#define REG_EDX (6) /* " " "" " " */
|
||||
#define REG_ECX (7) /* " " "" " " */
|
||||
#define REG_EAX (8) /* " " "" " " */
|
||||
#define REG_IRQNO (9) /* Interrupt number */
|
||||
#define REG_ERRCODE (10) /* Error code */
|
||||
#define REG_EIP (11) /* Pushed by process on interrupt processing */
|
||||
#define REG_CS (12) /* " " "" " " "" " " " " */
|
||||
#define REG_EFLAGS (13) /* " " "" " " "" " " " " */
|
||||
#define REG_SP (14) /* " " "" " " "" " " " " */
|
||||
#define REG_SS (15) /* " " "" " " "" " " " " */
|
||||
|
||||
#define XCPTCONTEXT_REGS (7)
|
||||
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
|
||||
#define XCPTCONTEXT_REGS (16)
|
||||
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@@ -93,10 +94,12 @@ struct xcptcontext
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
void *sigdeliver; /* Actual type is sig_deliver_t */
|
||||
|
||||
/* These are saved copies of LR and CPSR used during signal processing. */
|
||||
/* These are saved copies of instruction pointer and EFLAGS used during
|
||||
* signal processing.
|
||||
*/
|
||||
|
||||
uint32_t saved_pc;
|
||||
uint32_t saved_flags;
|
||||
uint32_t saved_eip;
|
||||
uint32_t saved_eflags;
|
||||
#endif
|
||||
|
||||
/* Register save area */
|
||||
|
||||
Reference in New Issue
Block a user