kern

annotate src/intr.h @ 54:4eaecb14fe31

bringing the task switching thing into shape with proper per-process kernel stacks and shit
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 14 Aug 2011 16:57:23 +0300
parents fa65b4f45366
children
rev   line source
nuclear@11 1 #ifndef INTR_H_
nuclear@11 2 #define INTR_H_
nuclear@11 3
nuclear@11 4 #include <inttypes.h>
nuclear@25 5 #include "asmops.h"
nuclear@11 6
nuclear@35 7 /* offset used to remap IRQ numbers (+32) */
nuclear@35 8 #define IRQ_OFFSET 32
nuclear@35 9 /* conversion macros between IRQ and interrupt numbers */
nuclear@35 10 #define IRQ_TO_INTR(x) ((x) + IRQ_OFFSET)
nuclear@35 11 #define INTR_TO_IRQ(x) ((x) - IRQ_OFFSET)
nuclear@35 12 /* checks whether a particular interrupt is an remapped IRQ */
nuclear@35 13 #define IS_IRQ(n) ((n) >= IRQ_OFFSET && (n) < IRQ_OFFSET + 16)
nuclear@35 14
nuclear@47 15 /* structure used to pass the interrupt stack frame from the
nuclear@47 16 * entry points to the C dispatch function.
nuclear@47 17 */
nuclear@47 18 struct intr_frame {
nuclear@47 19 /* registers pushed by pusha in intr_entry_* */
nuclear@47 20 struct registers regs;
nuclear@54 21 /* data segment selectors */
nuclear@54 22 uint32_t ds, es, fs, gs;
nuclear@47 23 /* interrupt number and error code pushed in intr_entry_* */
nuclear@47 24 uint32_t inum, err;
nuclear@47 25 /* pushed by CPU during interrupt entry */
nuclear@47 26 uint32_t eip, cs, eflags;
nuclear@47 27 /* pushed by CPU during interrupt entry from user space */
nuclear@47 28 uint32_t esp, ss;
nuclear@49 29 } __attribute__ ((packed));
nuclear@47 30
nuclear@47 31
nuclear@35 32
nuclear@52 33 typedef void (*intr_func_t)(int);
nuclear@11 34
nuclear@11 35
nuclear@11 36 void init_intr(void);
nuclear@11 37
nuclear@52 38 struct intr_frame *get_intr_frame(void);
nuclear@52 39
nuclear@11 40 void interrupt(int intr_num, intr_func_t func);
nuclear@11 41
nuclear@25 42 /* defined in intr-asm.S */
nuclear@25 43 int get_intr_state(void);
nuclear@25 44 void set_intr_state(int s);
nuclear@25 45
nuclear@47 46 void intr_ret(struct intr_frame ifrm);
nuclear@47 47
nuclear@51 48 void end_of_irq(int irq);
nuclear@51 49
nuclear@11 50 #endif /* INTR_H_ */