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

📄 hal5-2.6.5.patch

📁 rtai-3.1-test3的源代码(Real-Time Application Interface )
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
diff -uNrp linux-2.6.5/Documentation/adeos.txt linux-2.6.5-adeos/Documentation/adeos.txt--- linux-2.6.5/Documentation/adeos.txt	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.5-adeos/Documentation/adeos.txt	2004-05-27 18:59:35.000000000 +0200@@ -0,0 +1,176 @@++The Adeos nanokernel is based on research and publications made in the+early '90s on the subject of nanokernels. Our basic method was to+reverse the approach described in most of the papers on the subject.+Instead of first building the nanokernel and then building the client+OSes, we started from a live and known-to-be-functional OS, Linux, and+inserted a nanokernel beneath it. Starting from Adeos, other client+OSes can now be put side-by-side with the Linux kernel.++To this end, Adeos enables multiple domains to exist simultaneously on+the same hardware. None of these domains see each other, but all of+them see Adeos. A domain is most probably a complete OS, but there is+no assumption being made regarding the sophistication of what's in+a domain.++To share the hardware among the different OSes, Adeos implements an+interrupt pipeline (ipipe). Every OS domain has an entry in the ipipe.+Each interrupt that comes in the ipipe is passed on to every domain+in the ipipe. Instead of disabling/enabling interrupts, each domain+in the pipeline only needs to stall/unstall his pipeline stage. If+an ipipe stage is stalled, then the interrupts do not progress in the+ipipe until that stage has been unstalled. Each stage of the ipipe+can, of course, decide to do a number of things with an interrupt.+Among other things, it can decide that it's the last recipient of the+interrupt. In that case, the ipipe does not propagate the interrupt+to the rest of the domains in the ipipe.++Regardless of the operations being done in the ipipe, the Adeos code+does __not__ play with the interrupt masks. The only case where the+hardware masks are altered is during the addition/removal of a domain+from the ipipe. This also means that no OS is allowed to use the real+hardware cli/sti. But this is OK, since the stall/unstall calls+achieve the same functionality.++Our approach is based on the following papers (links to these+papers are provided at the bottom of this message):+[1] D. Probert, J. Bruno, and M. Karzaorman. "Space: a new approach to+operating system abstraction." In: International Workshop on Object+Orientation in Operating Systems, pages 133-137, October 1991.+[2] D. Probert, J. Bruno. "Building fundamentally extensible application-+specific operating systems in Space", March 1995.+[3] D. Cheriton, K. Duda. "A caching model of operating system kernel+functionality". In: Proc. Symp. on Operating Systems Design and+Implementation, pages 179-194, Monterey CA (USA), 1994.+[4] D. Engler, M. Kaashoek, and J. O'Toole Jr. "Exokernel: an operating+system architecture for application-specific resource management",+December 1995.++If you don't want to go fetch the complete papers, here's a summary.+The first 2 discuss the Space nanokernel, the 3rd discussed the cache+nanokernel, and the last discusses exokernel.++The complete Adeos approach has been thoroughly documented in a whitepaper+published more than a year ago entitled "Adaptive Domain Environment+for Operating Systems" and available here: http://www.opersys.com/adeos+The current implementation is slightly different. Mainly, we do not+implement the functionality to move Linux out of ring 0. Although of+interest, this approach is not very portable.++Instead, our patch taps right into Linux's main source of control+over the hardware, the interrupt dispatching code, and inserts an+interrupt pipeline which can then serve all the nanokernel's clients,+including Linux.++This is not a novelty in itself. Other OSes have been modified in such+a way for a wide range of purposes. One of the most interesting+examples is described by Stodolsky, Chen, and Bershad in a paper+entitled "Fast Interrupt Priority Management in Operating System+Kernels" published in 1993 as part of the Usenix Microkernels and+Other Kernel Architectures Symposium. In that case, cli/sti were+replaced by virtual cli/sti which did not modify the real interrupt+mask in any way. Instead, interrupts were defered and delivered to+the OS upon a call to the virtualized sti.++Mainly, this resulted in increased performance for the OS. Although+we haven't done any measurements on Linux's interrupt handling+performance with Adeos, our nanokernel includes by definition the+code implementing the technique described in the abovementioned+Stodolsky paper, which we use to redirect the hardware interrupt flow+to the pipeline.++i386 and armnommu are currently supported. Most of the+architecture-dependent code is easily portable to other architectures.++Aside of adding the Adeos module (driver/adeos), we also modified some+files to tap into Linux interrupt and system event dispatching (all+the modifications are encapsulated in #ifdef CONFIG_ADEOS_*/#endif).++We modified the idle task so it gives control back to Adeos in order for+the ipipe to continue propagation.++We modified init/main.c to initialize Adeos very early in the startup.++Of course, we also added the appropriate makefile modifications and+config options so that you can choose to enable/disable Adeos as+part of the kernel build configuration.++Adeos' public API is fully documented here:+http://www.freesoftware.fsf.org/adeos/doc/api/index.html.++In Linux's case, adeos_register_domain() is called very early during+system startup.++To add your domain to the ipipe, you need to:+1) Register your domain with Adeos using adeos_register_domain()+2) Call adeos_virtualize_irq() for all the IRQs you wish to be+notified about in the ipipe.++That's it. Provided you gave Adeos appropriate handlers in step+#2, your interrupts will be delivered via the ipipe.++During runtime, you may change your position in the ipipe using+adeos_renice_domain(). You may also stall/unstall the pipeline+and change the ipipe's handling of the interrupts according to your+needs.++Adeos supports SMP, and APIC support on UP.++Here are some of the possible uses for Adeos (this list is far+from complete):+1) Much like User-Mode Linux, it should now be possible to have 2+Linux kernels living side-by-side on the same hardware. In contrast+to UML, this would not be 2 kernels one ontop of the other, but+really side-by-side. Since Linux can be told at boot time to use+only one portion of the available RAM, on a 128MB machine this+would mean that the first could be made to use the 0-64MB space and+the second would use the 64-128MB space. We realize that many+modifications are required. Among other things, one of the 2 kernels+will not need to conduct hardware initialization. Nevertheless, this+possibility should be studied closer.++2) It follows from #1 that adding other kernels beside Linux should+be feasible. BSD is a prime candidate, but it would also be nice to+see what virtualizers such as VMWare and Plex86 could do with Adeos.+Proprietary operating systems could potentially also be accomodated.++3) All the previous work that has been done on nanokernels should now+be easily ported to Linux. Mainly, we would be very interested to+hear about extensions to Adeos. Primarily, we have no mechanisms+currently enabling multiple domains to share information. The papers+mentioned earlier provide such mechanisms, but we'd like to see+actual practical examples.++4) Kernel debuggers' main problem (tapping into the kernel's+interrupts) is solved and it should then be possible to provide+patchless kernel debuggers. They would then become loadable kernel+modules.++5) Drivers who require absolute priority and dislike other kernel+portions who use cli/sti can now create a domain of their own+and place themselves before Linux in the ipipe. This provides a+mechanism for the implementation of systems that can provide guaranteed+realtime response.++Philippe Gerum <rpm@xenomai.org>+Karim Yaghmour <karim@opersys.com>++----------------------------------------------------------------------+Links to papers:+1-+http://citeseer.nj.nec.com/probert91space.html+ftp://ftp.cs.ucsb.edu/pub/papers/space/iwooos91.ps.gz (not working)+http://www4.informatik.uni-erlangen.de/~tsthiel/Papers/Space-iwooos91.ps.gz++2-+http://www.cs.ucsb.edu/research/trcs/abstracts/1995-06.shtml+http://www4.informatik.uni-erlangen.de/~tsthiel/Papers/Space-trcs95-06.ps.gz++3-+http://citeseer.nj.nec.com/kenneth94caching.html+http://guir.cs.berkeley.edu/projects/osprelims/papers/cachmodel-OSkernel.ps.gz++4-+http://citeseer.nj.nec.com/engler95exokernel.html+ftp://ftp.cag.lcs.mit.edu/multiscale/exokernel.ps.Z+----------------------------------------------------------------------diff -uNrp linux-2.6.5/Makefile linux-2.6.5-adeos/Makefile--- linux-2.6.5/Makefile	2004-04-21 15:24:01.000000000 +0200+++ linux-2.6.5-adeos/Makefile	2004-05-27 18:59:35.000000000 +0200@@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 5-EXTRAVERSION =+EXTRAVERSION = -adeos NAME=Zonked Quokka  # *DOCUMENTATION*@@ -426,6 +426,8 @@ AFLAGS := $(CPPFLAGS) $(AFLAGS)  core-y		+= kernel/ mm/ fs/ ipc/ security/ crypto/ +core-$(CONFIG_ADEOS) += adeos/+ SUBDIRS		+= $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ 		     $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ 		     $(net-y) $(net-m) $(libs-y) $(libs-m)))@@ -469,7 +471,7 @@ CFLAGS += $(call check_gcc,-Wdeclaration # images.  Uncomment if you want to place them anywhere other than root. # -#export	INSTALL_PATH=/boot+export	INSTALL_PATH=/boot  # # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directorydiff -uNrp linux-2.6.5/adeos/Kconfig linux-2.6.5-adeos/adeos/Kconfig--- linux-2.6.5/adeos/Kconfig	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.5-adeos/adeos/Kconfig	2004-05-27 18:59:35.000000000 +0200@@ -0,0 +1,15 @@+menu "Adeos support"++config ADEOS+	tristate "Adeos support"+	default y+	---help---+	  Activate this option if you want the Adeos nanokernel to be+	  compiled in.++config ADEOS_CORE+	bool+	depends on ADEOS+	default y++endmenudiff -uNrp linux-2.6.5/adeos/Makefile linux-2.6.5-adeos/adeos/Makefile--- linux-2.6.5/adeos/Makefile	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.5-adeos/adeos/Makefile	2004-05-27 18:59:35.000000000 +0200@@ -0,0 +1,11 @@+#+# Makefile for the Adeos layer.+#++obj-$(CONFIG_ADEOS)	+= adeos.o++adeos-objs		:= generic.o++adeos-$(CONFIG_X86)	+= x86.o++adeos-$(CONFIG_IA64)	+= ia64.odiff -uNrp linux-2.6.5/adeos/generic.c linux-2.6.5-adeos/adeos/generic.c--- linux-2.6.5/adeos/generic.c	1970-01-01 01:00:00.000000000 +0100+++ linux-2.6.5-adeos/adeos/generic.c	2004-06-01 09:42:28.000000000 +0200@@ -0,0 +1,790 @@+/*+ *   linux/adeos/generic.c+ *+ *   Copyright (C) 2002 Philippe Gerum.+ *+ *   This program is free software; you can redistribute it and/or modify+ *   it under the terms of the GNU General Public License as published by+ *   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,+ *   USA; either version 2 of the License, or (at your option) any later+ *   version.+ *+ *   This program is distributed in the hope that it will be useful,+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ *   GNU General Public License for more details.+ *+ *   You should have received a copy of the GNU General Public License+ *   along with this program; if not, write to the Free Software+ *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.+ *+ *   Architecture-independent ADEOS services.+ */++#include <linux/version.h>+#include <linux/module.h>+#include <linux/init.h>+#include <linux/kernel.h>+#include <linux/sched.h>+#include <linux/irq.h>++MODULE_DESCRIPTION("Adeos nanokernel");+MODULE_AUTHOR("Philippe Gerum");+MODULE_LICENSE("GPL");++extern spinlock_t __adeos_pipelock;++extern struct list_head __adeos_pipeline;++/* adeos_register_domain() -- Add a new domain to the system. All+   client domains must call this routine to register themselves to+   ADEOS before using its services. */++int adeos_register_domain (adomain_t *adp, adattr_t *attr)++{+    struct list_head *pos;+    unsigned long flags;+    int n;++    if (adp_current != adp_root)+	{+	printk(KERN_WARNING "Adeos: Only the root domain may register a new domain.\n");+	return -EPERM;+	}++    flags = adeos_critical_enter(NULL);++    list_for_each(pos,&__adeos_pipeline) {+    	adomain_t *_adp = list_entry(pos,adomain_t,p_link);+	if (_adp->domid == attr->domid)+            break;+    }++    adeos_critical_exit(flags);++    if (pos != &__adeos_pipeline)+	/* A domain with the given id already exists -- fail. */+	return -EBUSY;++    for (n = 0; n < ADEOS_NR_CPUS; n++)+	adp->cpudata[n].status = 0;++    /* A special case for domains who won't process events (i.e. no+       entry). We have to mark them as suspended so that+       adeos_suspend_domain() won't consider them, unless they+       _actually_ receive events, which would lead to a panic+       situation since they have no stack context... :o> */++    for (n = 0; n < ADEOS_NR_CPUS; n++)+	{+	set_bit(IPIPE_SLEEP_FLAG,&adp->cpudata[n].status);++	if (attr->entry == NULL)+	    adp->estackbase[n] = 0;+	}++    adp->name = attr->name;+    adp->priority = attr->priority;+    adp->domid = attr->domid;+    adp->dswitch = attr->dswitch;+    adp->flags = 0;+    adp->ptd_setfun = attr->ptdset;+    adp->ptd_getfun = attr->ptdget;+    adp->ptd_keymap = 0;+    adp->ptd_keycount = 0;+    adp->ptd_keymax = attr->nptdkeys;++    for (n = 0; n < ADEOS_NR_EVENTS; n++)+	/* Event handlers must be cleared before the i-pipe stage is+	   inserted since an exception may occur on behalf of the new+	   emerging domain. */+	adp->events[n].handler = NULL;++    if (attr->entry != NULL)+	__adeos_init_domain(adp,attr);++    /* Insert the domain in the interrupt pipeline last, so it won't+       be resumed for processing interrupts until it has a valid stack+       context. */++    __adeos_init_stage(adp);++    INIT_LIST_HEAD(&adp->p_link);++    flags = adeos_critical_enter(NULL);++    list_for_each(pos,&__adeos_pipeline) {+    	adomain_t *_adp = list_entry(pos,adomain_t,p_link);+	if (adp->priority > _adp->priority)+            break;+    }++    list_add_tail(&adp->p_link,pos);++    adeos_critical_exit(flags);++    printk(KERN_WARNING "Adeos: Domain %s registered.\n",adp->name);++    /* Finally, allow the new domain to perform its initialization+       chores on behalf of its own stack context. */++    if (attr->entry != NULL)+	{+	adeos_declare_cpuid;++	adeos_get_cpu(flags);++	__adeos_switch_to(adp,cpuid);++	adeos_load_cpuid();	/* Processor might have changed. */++	if (!test_bit(IPIPE_STALL_FLAG,&adp_root->cpudata[cpuid].status) &&+	    adp_root->cpudata[cpuid].irq_pending_hi != 0)+	    __adeos_sync_stage(IPIPE_IRQMASK_ANY);++	adeos_put_cpu(flags);+	}++    return 0;+}++/* adeos_unregister_domain() -- Remove a domain from the system. All+   client domains must call this routine to unregister themselves from+   the ADEOS layer. */++int adeos_unregister_domain (adomain_t *adp)++{+    unsigned long flags;+    unsigned event;++    if (adp_current != adp_root)+	{+	printk(KERN_WARNING "Adeos: Only the root domain may unregister a domain.\n");+	return -EPERM;+	}++    if (adp == adp_root)+	{+	printk(KERN_WARNING "Adeos: Cannot unregister the root domain.\n");

⌨️ 快捷键说明

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