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

📄 adeos-ipipe-2.6.14-i386-1.2-01.patch

📁 xenomai 很好的linux实时补丁
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
+	/*+	 * "in" is guaranteed to be closer than "out" from the head of the+	 * pipeline (and obviously different).+	 */++	ipipe_percpu_domain[cpuid] = in;++	ipipe_suspend_domain();	/* Sync stage and propagate interrupts. */+	ipipe_load_cpuid();	/* Processor might have changed. */++	if (ipipe_percpu_domain[cpuid] == in)+		/*+		 * Otherwise, something has changed the current domain under+		 * our feet recycling the register set; do not override.+		 */+		ipipe_percpu_domain[cpuid] = out;+}++static inline void ipipe_sigwake_notify(struct task_struct *p)+{+	if (__ipipe_event_pipelined_p(IPIPE_EVENT_SIGWAKE))+		__ipipe_dispatch_event(IPIPE_EVENT_SIGWAKE,p);+}++static inline void ipipe_setsched_notify(struct task_struct *p)+{+	if (__ipipe_event_pipelined_p(IPIPE_EVENT_SETSCHED))+		__ipipe_dispatch_event(IPIPE_EVENT_SETSCHED,p);+}++static inline void ipipe_exit_notify(struct task_struct *p)+{+	if (__ipipe_event_pipelined_p(IPIPE_EVENT_EXIT))+		__ipipe_dispatch_event(IPIPE_EVENT_EXIT,p);+}++static inline int ipipe_trap_notify(int ex, struct pt_regs *regs)+{+	return __ipipe_event_pipelined_p(ex) ? __ipipe_dispatch_event(ex,regs) : 0;+}++#ifdef CONFIG_IPIPE_STATS++#define ipipe_mark_domain_stall(ipd, cpuid)			\+do {								\+	__label__ here;						\+	struct ipipe_stats *ips;				\+here:								\+	ips = (ipd)->stats + cpuid;				\+	if (ips->last_stall_date == 0) {			\+		ipipe_read_tsc(ips->last_stall_date);		\+		ips->last_stall_eip = (unsigned long)&&here;	\+	}							\+} while(0)++static inline void ipipe_mark_domain_unstall(struct ipipe_domain *ipd, int cpuid)+{ /* Called w/ hw interrupts off. */+	struct ipipe_stats *ips = ipd->stats + cpuid;+	unsigned long long t, d;++	if (ips->last_stall_date != 0) {+		ipipe_read_tsc(t);+		d = t - ips->last_stall_date;+		if (d > ips->max_stall_time) {+			ips->max_stall_time = d;+			ips->max_stall_eip = ips->last_stall_eip;+		}+		ips->last_stall_date = 0;+	}+}++static inline void ipipe_mark_irq_receipt(struct ipipe_domain *ipd, unsigned irq, int cpuid)+{+	struct ipipe_stats *ips = ipd->stats + cpuid;++	if (ips->irq_stats[irq].last_receipt_date == 0) {+		ipipe_read_tsc(ips->irq_stats[irq].last_receipt_date);+	}+}++static inline void ipipe_mark_irq_delivery(struct ipipe_domain *ipd, unsigned irq, int cpuid)+{ /* Called w/ hw interrupts off. */+	struct ipipe_stats *ips = ipd->stats + cpuid;+	unsigned long long t, d;++	if (ips->irq_stats[irq].last_receipt_date != 0) {+		ipipe_read_tsc(t);+		d = t - ips->irq_stats[irq].last_receipt_date;+		ips->irq_stats[irq].last_receipt_date = 0;+		if (d > ips->irq_stats[irq].max_delivery_time)+			ips->irq_stats[irq].max_delivery_time = d;+	}+}++static inline void ipipe_reset_stats (void)+{+	int cpu, irq;+	for_each_online_cpu(cpu) {+		ipipe_root_domain->stats[cpu].last_stall_date = 0LL;+		for (irq = 0; irq < IPIPE_NR_IRQS; irq++)+			ipipe_root_domain->stats[cpu].irq_stats[irq].last_receipt_date = 0LL;+	}+}++#else /* !CONFIG_IPIPE_STATS */++#define ipipe_mark_domain_stall(ipd,cpuid)	do { } while(0)+#define ipipe_mark_domain_unstall(ipd,cpuid)	do { } while(0)+#define ipipe_mark_irq_receipt(ipd,irq,cpuid)	do { } while(0)+#define ipipe_mark_irq_delivery(ipd,irq,cpuid)	do { } while(0)+#define ipipe_reset_stats()			do { } while(0)++#endif /* CONFIG_IPIPE_STATS */++/* Public interface */++int ipipe_register_domain(struct ipipe_domain *ipd,+			  struct ipipe_domain_attr *attr);++int ipipe_unregister_domain(struct ipipe_domain *ipd);++void ipipe_suspend_domain(void);++int ipipe_virtualize_irq(struct ipipe_domain *ipd,+			 unsigned irq,+			 ipipe_irq_handler_t handler,+			 void *cookie,+			 ipipe_irq_ackfn_t acknowledge,+			 unsigned modemask);++static inline int ipipe_share_irq(unsigned irq,+				  ipipe_irq_ackfn_t acknowledge)+{+	return ipipe_virtualize_irq(ipipe_current_domain,+				    irq,+				    IPIPE_SAME_HANDLER,+				    NULL,+				    acknowledge,+				    IPIPE_SHARED_MASK | IPIPE_HANDLE_MASK |+				    IPIPE_PASS_MASK);+}++int ipipe_control_irq(unsigned irq,+		      unsigned clrmask,+		      unsigned setmask);++unsigned ipipe_alloc_virq(void);++int ipipe_free_virq(unsigned virq);++int fastcall ipipe_trigger_irq(unsigned irq);++static inline int ipipe_propagate_irq(unsigned irq)+{++	return __ipipe_schedule_irq(irq, ipipe_current_domain->p_link.next);+}++static inline int ipipe_schedule_irq(unsigned irq)+{++	return __ipipe_schedule_irq(irq, &ipipe_current_domain->p_link);+}++static inline void ipipe_stall_pipeline_from(struct ipipe_domain *ipd)+{+	ipipe_declare_cpuid;+#ifdef CONFIG_SMP+	unsigned long flags;++	ipipe_lock_cpu(flags); /* Care for migration. */++	__set_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+	ipipe_mark_domain_stall(ipd, cpuid);++	if (!__ipipe_pipeline_head_p(ipd))+		ipipe_unlock_cpu(flags);+#else	/* CONFIG_SMP */+	set_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+	ipipe_mark_domain_stall(ipd, cpuid);++	if (__ipipe_pipeline_head_p(ipd))+		local_irq_disable_hw();+#endif	/* CONFIG_SMP */+}++static inline unsigned long ipipe_test_pipeline_from(struct ipipe_domain *ipd)+{+	unsigned long flags, s;+	ipipe_declare_cpuid;++	ipipe_get_cpu(flags);+	s = test_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+	ipipe_put_cpu(flags);++	return s;+}++static inline unsigned long ipipe_test_and_stall_pipeline_from(struct+							       ipipe_domain+							       *ipd)+{+	ipipe_declare_cpuid;+	unsigned long s;+#ifdef CONFIG_SMP+	unsigned long flags;++	ipipe_lock_cpu(flags); /* Care for migration. */++	s = __test_and_set_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+	ipipe_mark_domain_stall(ipd, cpuid);++	if (!__ipipe_pipeline_head_p(ipd))+		ipipe_unlock_cpu(flags);+#else	/* CONFIG_SMP */+	s = test_and_set_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+	ipipe_mark_domain_stall(ipd, cpuid);++	if (__ipipe_pipeline_head_p(ipd))+		local_irq_disable_hw();+#endif	/* CONFIG_SMP */++	return s;+}++void fastcall ipipe_unstall_pipeline_from(struct ipipe_domain *ipd);++static inline unsigned long ipipe_test_and_unstall_pipeline_from(struct+								 ipipe_domain+								 *ipd)+{+	unsigned long flags, s;+	ipipe_declare_cpuid;++	ipipe_get_cpu(flags);+	s = test_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+	ipipe_unstall_pipeline_from(ipd);+	ipipe_put_cpu(flags);++	return s;+}++static inline void ipipe_unstall_pipeline(void)+{+	ipipe_unstall_pipeline_from(ipipe_current_domain);+}++static inline unsigned long ipipe_test_and_unstall_pipeline(void)+{+	return ipipe_test_and_unstall_pipeline_from(ipipe_current_domain);+}++static inline unsigned long ipipe_test_pipeline(void)+{+	return ipipe_test_pipeline_from(ipipe_current_domain);+}++static inline unsigned long ipipe_test_and_stall_pipeline(void)+{+	return ipipe_test_and_stall_pipeline_from(ipipe_current_domain);+}++static inline void ipipe_restore_pipeline_from(struct ipipe_domain *ipd,+					       unsigned long flags)+{+	if (flags)+		ipipe_stall_pipeline_from(ipd);+	else+		ipipe_unstall_pipeline_from(ipd);+}++static inline void ipipe_stall_pipeline(void)+{+	ipipe_stall_pipeline_from(ipipe_current_domain);+}++static inline void ipipe_restore_pipeline(unsigned long flags)+{+	ipipe_restore_pipeline_from(ipipe_current_domain, flags);+}++static inline void ipipe_restore_pipeline_nosync(struct ipipe_domain *ipd,+						 unsigned long flags, int cpuid)+{+	/*+	 * If cpuid is current, then it must be held on entry+	 * (ipipe_get_cpu/local_irq_save_hw/local_irq_disable_hw).+	 */++	if (flags) {+		__set_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+		ipipe_mark_domain_stall(ipd,cpuid);+	}+	else {+		__clear_bit(IPIPE_STALL_FLAG, &ipd->cpudata[cpuid].status);+		ipipe_mark_domain_unstall(ipd,cpuid);+	}+}++void ipipe_init_attr(struct ipipe_domain_attr *attr);++int ipipe_get_sysinfo(struct ipipe_sysinfo *sysinfo);++int ipipe_tune_timer(unsigned long ns,+		     int flags);++unsigned long ipipe_critical_enter(void (*syncfn) (void));++void ipipe_critical_exit(unsigned long flags);++static inline void ipipe_set_printk_sync(struct ipipe_domain *ipd)+{+	set_bit(IPIPE_SPRINTK_FLAG, &ipd->flags);+}++static inline void ipipe_set_printk_async(struct ipipe_domain *ipd)+{+	clear_bit(IPIPE_SPRINTK_FLAG, &ipd->flags);+}++int ipipe_catch_event(struct ipipe_domain *ipd,+		      unsigned event,+		      int (*handler)(unsigned event,+				     struct ipipe_domain *ipd,+				     void *data));++cpumask_t ipipe_set_irq_affinity(unsigned irq,+				 cpumask_t cpumask);++int fastcall ipipe_send_ipi(unsigned ipi,+			    cpumask_t cpumask);++int ipipe_setscheduler_root(struct task_struct *p,+			    int policy,+			    int prio);++int ipipe_reenter_root(struct task_struct *prev,+		       int policy,+		       int prio);++int ipipe_alloc_ptdkey(void);++int ipipe_free_ptdkey(int key);++int fastcall ipipe_set_ptd(int key,+			   void *value);++void fastcall *ipipe_get_ptd(int key);++#define local_irq_enable_hw_cond()		local_irq_enable_hw()+#define local_irq_disable_hw_cond()		local_irq_disable_hw()+#define local_irq_save_hw_cond(flags)		local_irq_save_hw(flags)+#define local_irq_restore_hw_cond(flags)	local_irq_restore_hw(flags)+#define spin_lock_irqsave_hw_cond(lock,flags)	spin_lock_irqsave_hw(lock,flags)+#define spin_unlock_irqrestore_hw_cond(lock,flags) spin_unlock_irqrestore_hw(lock,flags)++#define ipipe_irq_lock(irq)						\+	do {								\+		ipipe_declare_cpuid;					\+		ipipe_load_cpuid();					\+		__ipipe_lock_irq(ipipe_percpu_domain[cpuid], cpuid, irq);\+	} while(0)++#define ipipe_irq_unlock(irq)						\+	do {								\+		ipipe_declare_cpuid;					\+		ipipe_load_cpuid();					\+		__ipipe_unlock_irq(ipipe_percpu_domain[cpuid], irq);	\+	} while(0)++#define ipipe_root_domain_p			(ipipe_current_domain == ipipe_root_domain)++#else	/* !CONFIG_IPIPE */++#define ipipe_init()				do { } while(0)+#define ipipe_suspend_domain()			do { } while(0)+#define ipipe_sigwake_notify(p)			do { } while(0)+#define ipipe_setsched_notify(p)		do { } while(0)+#define ipipe_exit_notify(p)			do { } while(0)+#define ipipe_init_proc()			do { } while(0)+#define ipipe_reset_stats()			do { } while(0)+#define ipipe_trap_notify(t,r)			0++#define spin_lock_hw(lock)			spin_lock(lock)+#define spin_unlock_hw(lock)			spin_unlock(lock)+#define spin_lock_irq_hw(lock)			spin_lock_irq(lock)+#define spin_unlock_irq_hw(lock)		spin_unlock_irq(lock)+#define spin_lock_irqsave_hw(lock,flags)	spin_lock_irqsave(lock, flags)+#define spin_unlock_irqrestore_hw(lock,flags)	spin_unlock_irqrestore(lock, flags)++#define local_irq_enable_hw_cond()		do { } while(0)+#define local_irq_disable_hw_cond()		do { } while(0)+#define local_irq_save_hw_cond(flags)		do { (void)(flags); } while(0)+#define local_irq_restore_hw_cond(flags)	do { } while(0)+#define spin_lock_irqsave_hw_cond(lock,flags)	do { (void)(flags); spin_lock(lock); } while(0)+#define spin_unlock_irqrestore_hw_cond(lock,flags)	spin_unlock(lock)++#define ipipe_irq_lock(irq)			do { } while(0)+#define ipipe_irq_unlock(irq)			do { } while(0)++#define ipipe_root_domain_p			1++#endif	/* CONFIG_IPIPE */++#endif	/* !__LINUX_IPIPE_H */--- 2.6.14/include/linux/preempt.h	2005-10-28 02:02:08.000000000 +0200+++ 2.6.14-ipipe/include/linux/preempt.h	2005-10-31 10:15:18.000000000 +0100@@ -13,41 +13,58 @@   extern void fastcall add_preempt_count(int val);   extern void fastcall sub_preempt_count(int val); #else-# define add_preempt_count(val)	do { preempt_count() += (val); } while (0)-# define sub_preempt_count(val)	do { preempt_count() -= (val); } while (0)+#define add_preempt_count(val)	do { preempt_count() += (val); } while (0)+#define sub_preempt_count(val)	do { preempt_count() -= (val); } while (0) #endif -#define inc_preempt_count() add_preempt_count(1)-#define dec_preempt_count() sub_preempt_count(1)+#define inc_preempt_count()	add_preempt_count(1)+#define dec_preempt_count()	sub_preempt_count(1) -#define preempt_count()	(current_thread_info()->preempt_count)+#define preempt_count()		(current_thread_info()->preempt_count)  #ifdef CONFIG_PREEMPT  asmlinkage void preempt_schedule(void); -#define preempt_disable() \-do { \-	inc_preempt_count(); \-	barrier(); \+#ifdef CONFIG_IPIPE++#include <asm/ipipe.h>++extern struct ipipe_domain *ipipe_percpu_domain[], *ipipe_root_domain;++#define ipipe_preempt_guard()	(ipipe_percpu_domain[ipipe_processor_id()] == ipipe_root_domain)+#else+#define ipipe_preempt_guard()	1+#endif++#define preempt_disable()						\+do {									\+	if (ipipe_preempt_guard()) {					\+		inc_preempt_count();					\+		barrier();						\+	}								\ } while (0) -#define preempt_enable_no_resched() \-do { \-	barrier(); \-	dec_preempt_count(); \+#define preempt_enable_no_resched()					\+do {									\+	if (ipipe_preempt_guard()) {					\+		barrier();						\+		dec_preempt_count();					\+	}								\ } while (0) -#define preempt_check_resched() \-do { \-	if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \-		preempt_schedule(); \+#define preempt_check_resched()						\

⌨️ 快捷键说明

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