Main Page | Directories | File List | Globals

irq.c File Reference

#include <agnix/agnix.h>
#include <asm/atomic.h>
#include <agnix/adi/adi.h>
#include <agnix/tasks.h>
#include <agnix/linkage.h>
#include <agnix/console.h>
#include <agnix/memory.h>
#include <agnix/irq.h>
#include <agnix/fastirq.h>
#include <asm/faults.h>
#include <agnix/list.h>
#include <agnix/sched.h>
#include <agnix/signals.h>
#include <agnix/fastrand.h>
#include <asm/segment.h>

Include dependency graph for irq.c:

Go to the source code of this file.

Defines

#define __KERNEL_SYSCALLS__
#define IRQ_BUILD(nr, offset)
#define IRQ_BUILD_NAME(nr, offset)   irq_names[nr * 16 + 0x##offset] = IRQ_##nr##offset;
#define IRQ_BUILD_16(x)
#define IRQ_BUILD_NAME_16(x)

Functions

asmlinkage void syscall_irq (struct regs_s regs)
asmlinkage void execute_irq (u32 irq, struct regs_s regs)
asmlinkage void IRQ_syscall (void)
 __asm__ ("\n.align 16,0x90\n""IRQ_syscall:\n\t"REG_SAVE"call syscall_irq\n\t"REG_RESTORE"iret\n\t")
 IRQ_BUILD_16 (0)
desc_struct idt_table[256] __attribute__ ((__section__("data.idt")))
void irq_disable_soft (u8 irq)
void irq_enable_soft (u8 irq)
int install_irq (u8 irq, struct irq_routine_s *irq_proc)
int free_irq (u8 irq, struct irq_routine_s *irq_proc)
int __init irqs_init (void)

Variables

chip_s i8259a_chip
u32 random_val
irq_s irq_info [256]
void(* irq_names [256])(void)
char irq_disabled [256]


Define Documentation

#define __KERNEL_SYSCALLS__
 

Definition at line 30 of file irq.c.

#define IRQ_BUILD nr,
offset   ) 
 

Value:

asmlinkage void IRQ_##nr##offset(void); \
    __asm__ (   \
    "\n.align 16,0x90\n"        \
    "IRQ_"#nr#offset":\n\t"     \
    REG_SAVE                    \
    "pushl $0x"#nr#offset"\n\t" \
    "call execute_irq\n\t"      \
    "addl $4, %esp\n\t"         \
    REG_RESTORE                 \
    "iret\n\t"                  \
    );

Definition at line 45 of file irq.c.

#define IRQ_BUILD_16  ) 
 

Value:

IRQ_BUILD(x,0); IRQ_BUILD(x,1); IRQ_BUILD(x,2); IRQ_BUILD(x,3); \
    IRQ_BUILD(x,4); IRQ_BUILD(x,5); IRQ_BUILD(x,6); IRQ_BUILD(x,7);     \
    IRQ_BUILD(x,8); IRQ_BUILD(x,9); IRQ_BUILD(x,A); IRQ_BUILD(x,B);     \
    IRQ_BUILD(x,C); IRQ_BUILD(x,D); IRQ_BUILD(x,E); IRQ_BUILD(x,F);

Definition at line 61 of file irq.c.

#define IRQ_BUILD_NAME nr,
offset   )     irq_names[nr * 16 + 0x##offset] = IRQ_##nr##offset;
 

Definition at line 58 of file irq.c.

#define IRQ_BUILD_NAME_16  ) 
 

Value:

Definition at line 67 of file irq.c.

Referenced by irqs_init().


Function Documentation

__asm__ "\n.align   16,
0x90\n""IRQ_syscall:\n\t"REG_SAVE"call syscall_irq\n\t"REG_RESTORE"iret\n\t" 
 

Referenced by __normal_delay(), _fastrand(), add_64_32(), add_64_reg(), add_64_xmm2(), apm_function_call_full(), apm_function_call_simple(), be16_to_le16(), be32_to_le32(), cpu_get_cache_latency(), create_kernel_thread(), div_64_32(), do_machine_halt(), do_machine_hard_reboot(), do_machine_powerdown(), do_machine_reboot(), do_memtest(), do_memtest_check(), idle_state_enter(), irqs_init(), memcheck_type_1(), mul_32_32(), sub_64_32(), sub_64_reg(), sub_64_xmm2(), TRAP_dev_not_avail(), and TRAP_page_fault().

struct desc_struct idt_table [256] __attribute__ (__section__("data.idt"))   ) 
 

asmlinkage void execute_irq u32  irq,
struct regs_s  regs
 

Definition at line 93 of file irq.c.

References execute_signals(), fastirq_queue(), fastirq_run_irq(), fastirq_started, i8259a_chip, and schedule_task().

00094 {
00095     struct chip_s *chip = &i8259a_chip;
00096 
00097     if (fastirq_started && (irq != 0))
00098         fastirq_queue(irq);
00099     else
00100         fastirq_run_irq(irq);
00101 
00102     pic_ops(chip)->ack_irq(chip, irq);
00103 
00104     if (current_task->signals.pending)
00105         execute_signals(current_task, &regs);
00106 
00107     //if ((regs.cs & 0x03) && current_task->t_resched) {
00108     if (current_task->t_resched) {
00109         schedule_task();
00110     }
00111 }

Here is the call graph for this function:

int free_irq u8  irq,
struct irq_routine_s *  irq_proc
 

Definition at line 127 of file irq.c.

References flags, i8259a_chip, and irq_info.

Referenced by floppy_free_irq().

00128 {
00129     struct chip_s *chip = &i8259a_chip;
00130     struct irq_s *irq_struct = &irq_info[irq];
00131     u32 flags;
00132 
00133     spin_lock_irqsave(&irq_struct->lock, flags);
00134     list_del(&irq_proc->list);
00135 
00136     if (list_empty(&irq_struct->head)) 
00137         pic_ops(chip)->disable_irq(chip, irq);
00138 
00139     spin_unlock_irqrestore(&irq_struct->lock, flags);
00140 
00141     return 0;
00142 }

int install_irq u8  irq,
struct irq_routine_s *  irq_proc
 

Definition at line 113 of file irq.c.

References flags, i8259a_chip, and irq_info.

Referenced by adi_chrdrv_kbd_init(), floppy_set_irq(), i8259a_chip_cascade_init(), rtl_8029_probe(), and timer_init().

00114 {
00115     struct chip_s *chip = &i8259a_chip;
00116     struct irq_s *irq_struct = &irq_info[irq];
00117     u32 flags;
00118 
00119     spin_lock_irqsave(&irq_struct->lock, flags);
00120     pic_ops(chip)->enable_irq(chip, irq);
00121     list_add(&irq_proc->list, &irq_struct->head);
00122     spin_unlock_irqrestore(&irq_struct->lock, flags);
00123     
00124     return 0;
00125 }

IRQ_BUILD_16  ) 
 

void irq_disable_soft u8  irq  ) 
 

Definition at line 83 of file irq.c.

References irq_disabled.

00084 {
00085     atomic_write(&irq_disabled[irq], 1);
00086 }

void irq_enable_soft u8  irq  ) 
 

Definition at line 88 of file irq.c.

References irq_disabled.

00089 {
00090     atomic_write(&irq_disabled[irq], 0);
00091 }

asmlinkage void IRQ_syscall void   ) 
 

Referenced by irqs_init().

int __init irqs_init void   ) 
 

Definition at line 144 of file irq.c.

References __asm__(), flags, IRQ_BUILD_NAME_16, irq_disabled, irq_info, irq_names, IRQ_syscall(), memset(), and set_interrupt_gate().

Referenced by i386_init().

00145 {
00146     int i;
00147     u32 flags;
00148     save_flags(flags); __cli();
00149 
00150     memset(irq_info, 0, 256 * sizeof(struct irq_s));
00151 
00152     for (i = 0; i < 256; i++) {
00153         INIT_LIST_HEAD(&irq_info[i].head);
00154         irq_disabled[i] = 0;
00155     }
00156 
00157     IRQ_BUILD_NAME_16(0);
00158     for (i = 0; i < 16; i++)
00159         set_interrupt_gate(32 + i, __KERNEL_CS, irq_names[i], 0);
00160 
00161     set_interrupt_gate(0x80, __KERNEL_CS, IRQ_syscall, 3);
00162 
00163     __asm__ __volatile__ ("lgdt %0" : "=m" (gdt_descr));
00164     __asm__ __volatile__ ("lidt %0" : "=m" (idt_descr));
00165     __asm__ __volatile__ ("pushfl ; andl $0xffffbfff, (%esp); popfl");
00166 
00167     restore_flags(flags);
00168 
00169     return 0;
00170 }

Here is the call graph for this function:

asmlinkage void syscall_irq struct regs_s  regs  ) 
 

Definition at line 159 of file syscalls.c.

References syscall_table.

00160 {
00161     u32 function;
00162     int ret;
00163     
00164     function = regs.eax;
00165 
00166     if (syscall_table[function] != 0) {
00167         ret = syscall_table[function](&regs);
00168         regs.eax = (u32)ret;
00169     }
00170 }


Variable Documentation

struct chip_s i8259a_chip
 

Definition at line 147 of file i8259a.c.

Referenced by execute_irq(), free_irq(), i8259a_init(), and install_irq().

char irq_disabled[256]
 

Definition at line 81 of file irq.c.

Referenced by irq_disable_soft(), irq_enable_soft(), and irqs_init().

struct irq_s irq_info[256]
 

Definition at line 79 of file irq.c.

Referenced by fastirq_run_irq(), free_irq(), install_irq(), and irqs_init().

void(* irq_names[256])(void)
 

Definition at line 80 of file irq.c.

Referenced by irqs_init().

u32 random_val
 

Definition at line 18 of file fastrand.c.

Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix