⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hal13c1-2.4.25.patch

📁 rtai-3.1-test3的源代码(Real-Time Application Interface )
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+        "cld\n\t" \+        "pushl $0\n\t" \+        "pushl %es\n\t" \+        "pushl %ds\n\t" \+        "pushl %eax\n\t" \+        "pushl %ebp\n\t" \+        "pushl %edi\n\t" \+        "pushl %esi\n\t" \+        "pushl %edx\n\t" \+        "pushl %ecx\n\t" \+        "pushl %ebx\n\t" \+        "movl $" STR(__KERNEL_DS) ",%edx\n\t" \+	"mov %dx,%ds\n\t" \+	"mov %dx,%es\n\t" \+        "movl (" __stringify(__adeos_event_monitors + 4 * trapnr)"),%eax\n\t" \+	"testl %eax,%eax\n\t" \+	"jz 1f\n\t" \+	"movl %esp,%eax\n\t" \+        "pushl %eax\n\t" \+	"pushl $"#trapnr"\n\t" \+        "call " __stringify(__adeos_handle_event) "\n\t" \+	"addl $8,%esp\n\t" \+	"testl %eax,%eax\n\t" \+"1:      popl %ebx\n\t" \+        "popl %ecx\n\t" \+	"popl %edx\n\t" \+        "popl %esi\n\t" \+        "popl %edi\n\t" \+	"popl %ebp\n\t" \+	"jz 2f\n\t" \+	"popl %eax\n\t" \+	"popl %ds\n\t" \+	"popl %es\n\t" \+	"addl $4,%esp\n\t" \+	"iret\n" \+"2:      movl ("SYMBOL_NAME_STR(__adeos_std_vector_table + 4 * trapnr)"),%eax\n\t" \+	"movl %eax,12(%esp)\n\t" \+	"popl %eax\n\t" \+	"popl %ds\n\t" \+	"popl %es\n\t" \+	"ret\n");++BUILD_TRAP_NOERRCODE(0x0)   BUILD_TRAP_NOERRCODE(0x1)   BUILD_TRAP_NOERRCODE(0x2)+BUILD_TRAP_NOERRCODE(0x3)   BUILD_TRAP_NOERRCODE(0x4)   BUILD_TRAP_NOERRCODE(0x5)+BUILD_TRAP_NOERRCODE(0x6)   BUILD_TRAP_NOERRCODE(0x7)   BUILD_TRAP_ERRCODE(0x8)+BUILD_TRAP_NOERRCODE(0x9)   BUILD_TRAP_ERRCODE(0xa)     BUILD_TRAP_ERRCODE(0xb)+BUILD_TRAP_ERRCODE(0xc)     BUILD_TRAP_ERRCODE(0xd)     BUILD_TRAP_ERRCODE(0xe)+BUILD_TRAP_NOERRCODE(0xf)   BUILD_TRAP_NOERRCODE(0x10)  BUILD_TRAP_ERRCODE(0x11)+BUILD_TRAP_NOERRCODE(0x12)  BUILD_TRAP_NOERRCODE(0x13)  BUILD_TRAP_ERRCODE(0x14)+BUILD_TRAP_ERRCODE(0x15)    BUILD_TRAP_ERRCODE(0x16)    BUILD_TRAP_ERRCODE(0x17)+BUILD_TRAP_ERRCODE(0x18)    BUILD_TRAP_ERRCODE(0x19)    BUILD_TRAP_ERRCODE(0x1a)+BUILD_TRAP_ERRCODE(0x1b)    BUILD_TRAP_ERRCODE(0x1c)    BUILD_TRAP_ERRCODE(0x1d)+BUILD_TRAP_ERRCODE(0x1e)    BUILD_TRAP_ERRCODE(0x1f)++#define LIST_TRAP(trapnr) &__adeos_trap_ ## trapnr++static void (*__adeos_trap_trampolines[])(void) = {+    LIST_TRAP(0x0), LIST_TRAP(0x1), LIST_TRAP(0x2), LIST_TRAP(0x3),+    LIST_TRAP(0x4), LIST_TRAP(0x5), LIST_TRAP(0x6), LIST_TRAP(0x7),+    LIST_TRAP(0x8), LIST_TRAP(0x9), LIST_TRAP(0xa), LIST_TRAP(0xb),+    LIST_TRAP(0xc), LIST_TRAP(0xd), LIST_TRAP(0xe), LIST_TRAP(0xf),+    LIST_TRAP(0x10), LIST_TRAP(0x11), LIST_TRAP(0x12), LIST_TRAP(0x13),+    LIST_TRAP(0x14), LIST_TRAP(0x15), LIST_TRAP(0x16), LIST_TRAP(0x17),+    LIST_TRAP(0x18), LIST_TRAP(0x19), LIST_TRAP(0x1a), LIST_TRAP(0x1b),+    LIST_TRAP(0x1c), LIST_TRAP(0x1d), LIST_TRAP(0x1e), LIST_TRAP(0x1f)+};++static int __adeos_ack_common_irq (unsigned irq)++{+    irq_desc_t *desc = irq_desc + irq;+#ifdef CONFIG_PREEMPT+    preempt_disable();+#endif /* CONFIG_PREEMPT */+    desc->handler->ack(irq);+#ifdef CONFIG_PREEMPT+    preempt_enable_no_resched();+#endif /* CONFIG_PREEMPT */++    return 1;+}++static unsigned __adeos_override_irq_startup (unsigned irq)++{+    unsigned long adflags, hwflags;+    adeos_declare_cpuid;+    unsigned s;++    adeos_lock_cpu(hwflags);+    adflags = adeos_test_and_stall_pipeline();+#ifdef CONFIG_PREEMPT+    preempt_disable();+#endif /* CONFIG_PREEMPT */+    __adeos_unlock_irq(adp_cpu_current[cpuid],irq);+    s = __adeos_std_irq_dtype[irq].startup(irq);+#ifdef CONFIG_PREEMPT+    preempt_enable_no_resched();+#endif /* CONFIG_PREEMPT */+    adeos_restore_pipeline_nosync(adp_cpu_current[cpuid],adflags,cpuid);+    adeos_unlock_cpu(hwflags);++    return s;+}++static void __adeos_override_irq_shutdown (unsigned irq)++{+    unsigned long adflags, hwflags;+    adeos_declare_cpuid;++    adeos_lock_cpu(hwflags);+    adflags = adeos_test_and_stall_pipeline();+#ifdef CONFIG_PREEMPT+    preempt_disable();+#endif /* CONFIG_PREEMPT */+    __adeos_std_irq_dtype[irq].shutdown(irq);+    __adeos_clear_irq(adp_cpu_current[cpuid],irq);+#ifdef CONFIG_PREEMPT+    preempt_enable_no_resched();+#endif /* CONFIG_PREEMPT */+    adeos_restore_pipeline_nosync(adp_cpu_current[cpuid],adflags,cpuid);+    adeos_unlock_cpu(hwflags);+}++static void __adeos_override_irq_enable (unsigned irq)++{+    unsigned long adflags, hwflags;+    adeos_declare_cpuid;++    adeos_lock_cpu(hwflags);+    adflags = adeos_test_and_stall_pipeline();++#ifdef CONFIG_PREEMPT+    preempt_disable();+#endif /* CONFIG_PREEMPT */++    __adeos_unlock_irq(adp_cpu_current[cpuid],irq);+    __adeos_std_irq_dtype[irq].enable(irq);++#ifdef CONFIG_PREEMPT+    preempt_enable_no_resched();+#endif /* CONFIG_PREEMPT */++    adeos_restore_pipeline_nosync(adp_cpu_current[cpuid],adflags,cpuid);+    adeos_unlock_cpu(hwflags);+}++static void __adeos_override_irq_disable (unsigned irq)++{+    unsigned long adflags, hwflags;+    adeos_declare_cpuid;++    adeos_lock_cpu(hwflags);+    adflags = adeos_test_and_stall_pipeline();+#ifdef CONFIG_PREEMPT+    preempt_disable();+#endif /* CONFIG_PREEMPT */+    __adeos_std_irq_dtype[irq].disable(irq);+    __adeos_lock_irq(adp_cpu_current[cpuid],cpuid,irq);+#ifdef CONFIG_PREEMPT+    preempt_enable_no_resched();+#endif /* CONFIG_PREEMPT */+    adeos_restore_pipeline_nosync(adp_cpu_current[cpuid],adflags,cpuid);+    adeos_unlock_cpu(hwflags);+}++static void __adeos_override_irq_end (unsigned irq)++{+    unsigned long adflags, hwflags;+    adeos_declare_cpuid;++    adeos_lock_cpu(hwflags);+    adflags = adeos_test_and_stall_pipeline();+#ifdef CONFIG_PREEMPT+    preempt_disable();+#endif /* CONFIG_PREEMPT */++#ifdef CONFIG_X86_IO_APIC+    if (!IO_APIC_IRQ(irq) || !(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))+#else /* !CONFIG_X86_IO_APIC */+    if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))+#endif /* CONFIG_X86_IO_APIC */+	__adeos_unlock_irq(adp_cpu_current[cpuid],irq);++    __adeos_std_irq_dtype[irq].end(irq);++#ifdef CONFIG_PREEMPT+    preempt_enable_no_resched();+#endif /* CONFIG_PREEMPT */+    adeos_restore_pipeline_nosync(adp_cpu_current[cpuid],adflags,cpuid);+    adeos_unlock_cpu(hwflags);+}++static void __adeos_override_irq_affinity (unsigned irq, unsigned long mask)++{+    unsigned long adflags, hwflags;+    adeos_declare_cpuid;++    adeos_lock_cpu(hwflags);+    adflags = adeos_test_and_stall_pipeline();+#ifdef CONFIG_PREEMPT+    preempt_disable();+#endif /* CONFIG_PREEMPT */+    __adeos_std_irq_dtype[irq].set_affinity(irq,mask);+#ifdef CONFIG_PREEMPT+    preempt_enable_no_resched();+#endif /* CONFIG_PREEMPT */+    adeos_restore_pipeline_nosync(adp_cpu_current[cpuid],adflags,cpuid);+    adeos_unlock_cpu(hwflags);+}++/* __adeos_enable_pipeline() -- Take over the interrupt control from+   the root domain (i.e. Linux). After this routine has returned, all+   interrupts go through the pipeline. */++void __adeos_enable_pipeline (void)++{+    unsigned vector, irq;+    unsigned long flags;++    /* Collect the original vector table. */++    for (vector = 0; vector < 256; vector++)+	__adeos_std_vector_table[vector] = __adeos_get_gate_addr(vector);++#ifdef CONFIG_SMP++    /* This vector must be set up prior to call+       adeos_critical_enter(). */++    __adeos_set_irq_gate(ADEOS_CRITICAL_VECTOR,+			 __adeos_irq_trampolines[ADEOS_CRITICAL_IPI]);++#endif /* CONFIG_SMP */++    flags = adeos_critical_enter(NULL);++    /* First, grab the ISA and IO-APIC interrupts. */++    for (irq = 0; irq < NR_IRQS && irq + FIRST_EXTERNAL_VECTOR < FIRST_SYSTEM_VECTOR; irq++)+	{+#ifdef CONFIG_X86_IO_APIC+	if (IO_APIC_IRQ(irq))+	    {+	    vector = IO_APIC_VECTOR(irq);++	    if (vector == 0)+		continue;+	    }+	else+#endif /* CONFIG_X86_IO_APIC */+	    {+	    vector = irq + FIRST_EXTERNAL_VECTOR;++	    if (vector == SYSCALL_VECTOR)+		continue;+	    }++	/* Fails for ADEOS_CRITICAL_IPI but that's ok. */++	adeos_virtualize_irq(irq,+			     (void (*)(unsigned))__adeos_std_vector_table[vector],+			     &__adeos_ack_common_irq,+			     IPIPE_CALLASM_MASK|IPIPE_HANDLE_MASK|IPIPE_PASS_MASK);++	__adeos_set_irq_gate(vector,__adeos_irq_trampolines[irq]);+	}++    /* Interpose on the IRQ control routines so we can make them+       atomic using hw masking and prevent the interrupt log from+       being untimely flushed. Since we don't want to be too smart+       about what's going on into irq.c and we want to change only+       some of the controller members, let's be dumb and interpose the+       rough way. */++    for (irq = 0; irq < NR_IRQS; irq++)+	__adeos_std_irq_dtype[irq] = *irq_desc[irq].handler;++    /* The original controller structs are often shared, so we first+       save them all before changing any of them. Notice that we don't+       redirect the ack handler since the relevant XT-PIC/IO-APIC+       management code is already Adeos-aware. */++    for (irq = 0; irq < NR_IRQS; irq++)+	{+	irq_desc[irq].handler->startup = &__adeos_override_irq_startup;+	irq_desc[irq].handler->shutdown = &__adeos_override_irq_shutdown;+	irq_desc[irq].handler->enable = &__adeos_override_irq_enable;+	irq_desc[irq].handler->disable = &__adeos_override_irq_disable;+	irq_desc[irq].handler->end = &__adeos_override_irq_end;++	if (irq_desc[irq].handler->set_affinity != NULL)+	    irq_desc[irq].handler->set_affinity = &__adeos_override_irq_affinity;+	}++#ifdef CONFIG_X86_LOCAL_APIC++    /* Map the APIC system vectors including the unused ones so that+       client domains can virtualize the corresponding IRQs. */++    for (vector = FIRST_SYSTEM_VECTOR; vector < CALL_FUNCTION_VECTOR; vector++)+      {+      adeos_virtualize_irq(vector - FIRST_EXTERNAL_VECTOR,+			   (void (*)(unsigned))__adeos_std_vector_table[vector],+			   &__adeos_ack_system_irq,+			   IPIPE_CALLASM_MASK|IPIPE_HANDLE_MASK|IPIPE_PASS_MASK);+      +      __adeos_set_irq_gate(vector,+			   __adeos_irq_trampolines[vector - FIRST_EXTERNAL_VECTOR]);+      }++    __adeos_tick_irq = using_apic_timer ? LOCAL_TIMER_VECTOR - FIRST_EXTERNAL_VECTOR : 0;++#else  /* !CONFIG_X86_LOCAL_APIC */++    __adeos_tick_irq = 0;++#endif /* CONFIG_X86_LOCAL_APIC */++#ifdef CONFIG_SMP++    /* All interrupts must be pipelined, but the spurious one since we+       don't even want to acknowledge it. */++    for (vector = CALL_FUNCTION_VECTOR; vector < SPURIOUS_APIC_VECTOR; vector++)+      {+      adeos_virtualize_irq(vector - FIRST_EXTERNAL_VECTOR,+			   (void (*)(unsigned))__adeos_std_vector_table[vector],+			   &__adeos_ack_system_irq,+			   IPIPE_CALLASM_MASK|IPIPE_HANDLE_MASK|IPIPE_PASS_MASK);+      +      __adeos_set_irq_gate(vector,+			   __adeos_irq_trampolines[vector - FIRST_EXTERNAL_VECTOR]);+      }++    __adeos_set_irq_gate(ADEOS_SERVICE_VECTOR,+			 __adeos_irq_trampolines[ADEOS_SERVICE_IPI]);++#endif /* CONFIG_SMP */++    /* Redirect traps and exceptions (except NMI). */++    __adeos_set_trap_gate(0,__adeos_trap_trampolines[0]);+    __adeos_set_trap_gate(1,__adeos_trap_trampolines[1]);+    __adeos_set_sys_gate(3,__adeos_trap_trampolines[3]);+    __adeos_set_sys_gate(4,__adeos_trap_trampolines[4]);+    __adeos_set_sys_gate(5,__adeos_trap_trampolines[5]);+    __adeos_set_trap_gate(6,__adeos_trap_trampolines[6]);+    __adeos_set_trap_gate(7,__adeos_trap_trampolines[7]);+    __adeos_set_trap_gate(8,__adeos_trap_trampolines[8]);+    __adeos_set_trap_gate(9,__adeos_trap_trampolines[9]);+    __adeos_set_trap_gate(10,__adeos_trap_trampolines[10]);+    __adeos_set_trap_gate(11,__adeos_trap_trampolines[11]);+    __adeos_set_trap_gate(12,__adeos_trap_trampolines[12]);+    __adeos_set_trap_gate(13,__adeos_trap_trampolines[13]);+    __adeos_set_irq_gate(14,__adeos_trap_trampolines[14]);+    __adeos_set_trap_gate(15,__adeos_trap_trampolines[15]);+    __adeos_set_trap_gate(16,__adeos_trap_trampolines[16]);+    __adeos_set_trap_gate(17,__adeos_trap_trampolines[17]);+    __adeos_set_trap_gate(18,__adeos_trap_trampolines[18]);+    __adeos_set_trap_gate(19,__adeos_trap_trampolines[19]);++#if defined(CONFIG_ADEOS_MODULE) || defined(CONFIG_X86_IO_APIC)+    adp_pipelined = 1;+#endif /* CONFIG_ADEOS_MODULE || CONFIG_X86_IO_APIC */++    adeos_critical_exit(flags);+}++/* __adeos_disable_pipeline() -- Disengage the pipeline. */++void __adeos_disable_pipeline (void)++{+    unsigned vector, irq;+    unsigned long flags;++    flags = adeos_critical_enter(NULL);++    /* Restore interrupt controllers. */++    for (irq = 0; irq < NR_IRQS; irq++)+	*irq_desc[irq].handler = __adeos_std_irq_dtype[irq];++    /* Restore original IDT settings. */++    for (irq = 0; irq < NR_IRQS && irq + FIRST_EXTERNAL_VECTOR < FIRST_SYSTEM_VECTOR; irq++)+	{+#ifdef CONFIG_X86_IO_APIC+	if (IO_APIC_IRQ(irq))+	    {+	    vector = IO_APIC_VECTOR(irq);++	    if (vector == 0)+		continue;+	    }+	else+#endif /* CONFIG_X86_IO_APIC */+	    {+	    vector = irq + FIRST_EXTERNAL_VECTOR;++	    if (vector == SYSCALL_VECTOR)+		continue;+	    }++	__adeos_set_irq_gate(vector,__adeos_std_vector_table[vector]);+	}++#ifdef CONFIG_X86_LOCAL_APIC++    for (vector = FIRST_SYSTEM_VECTOR; vector < CALL_FUNCTION_VECTOR; vector++)+      __adeos_set_irq_gate(vector,__adeos_std_vector_table[vector]);++#endif /* CONFIG_X86_LOCAL_APIC */+

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -