Mercurial > archived > louis > epitech > mq > rathaxes
view pci_rework_without_explicit_call.patch @ 34:62fba8b9db06
Minor fixes
author | Thomas Sanchez <thomas.sanchz@gmail.com> |
---|---|
date | Sun, 08 Jan 2012 01:02:43 +0100 |
parents | 60a59bf708df |
children |
line wrap: on
line source
# HG changeset patch # Parent c5c98e265bb4cf5c3a9d775e56d6599ca73a4c73 rathaxes: initialize the pci bus in an elegant implicit way diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/lkm.blt --- a/rathaxes/samples/lkm/lkm.blt Sat Jan 07 22:45:07 2012 +0100 +++ b/rathaxes/samples/lkm/lkm.blt Sat Jan 07 23:09:24 2012 +0100 @@ -33,6 +33,7 @@ static int __attribute__((__section__(".init.text"))) rtx_module_init(void) { ${pointcut ::IMPLEMENTATION}; + ${pointcut LKM::init_bus_hook}; return 0; } @@ -48,6 +49,7 @@ static void __attribute__((__section__(".exit.text"))) rtx_module_exit(void) { ${pointcut ::IMPLEMENTATION}; + ${pointcut LKM::deinit_bus_hook}; } module_exit(rtx_module_exit); diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/lkm.rti --- a/rathaxes/samples/lkm/lkm.rti Sat Jan 07 22:45:07 2012 +0100 +++ b/rathaxes/samples/lkm/lkm.rti Sat Jan 07 23:09:24 2012 +0100 @@ -12,12 +12,14 @@ required sequence LKM::init() { - provided chunk LKM::includes; - provided chunk LKM::code; + provided chunk LKM::includes; + provided chunk LKM::code; + provided pointcut LKM::init_bus_hook; } required sequence LKM::exit() { - provided chunk LKM::code; + provided chunk LKM::code; + provided pointcut LKM::deinit_bus_hook; } } diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/lkm.rtx --- a/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 22:45:07 2012 +0100 +++ b/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 23:09:24 2012 +0100 @@ -37,13 +37,13 @@ LKM::init() { Log::info("Hello this is LKM"); - PCI::register(); + // PCI::register(); } LKM::exit() { Log::info("Good bye this was LKM"); - PCI::unregister(); + // PCI::unregister(); } } diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/pci.blt --- a/rathaxes/samples/lkm/pci.blt Sat Jan 07 22:45:07 2012 +0100 +++ b/rathaxes/samples/lkm/pci.blt Sat Jan 07 23:09:24 2012 +0100 @@ -102,7 +102,7 @@ }; } - chunk ::CALL + chunk LKM::init_bus_hook() { /* * So how do we use the return value in the parent context? @@ -116,13 +116,22 @@ return error; } } + + chunk ::CALL() + { + // no implementation, we just need to instrument the lkm::bus_hook + } } template sequence PCI::unregister() { - chunk ::CALL + chunk LKM::deinit_bus_hook() { pci_unregister_driver(&rtx_pci_driver); } + + chunk ::CALL + { + } } } diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/pci.rti --- a/rathaxes/samples/lkm/pci.rti Sat Jan 07 22:45:07 2012 +0100 +++ b/rathaxes/samples/lkm/pci.rti Sat Jan 07 23:09:24 2012 +0100 @@ -7,13 +7,20 @@ provided sequence PCI::register() { + // it is impossible to provide a "dummy" sequence + // which just hook itself. The PCI:register juste + // inject its code in the module_init function + // in order to load the pci driver. + // Everything is done with the configuration. provided chunk ::CALL; provided chunk LKM::data; + provided chunk LKM::init_bus_hook; } provided sequence PCI::unregister() { provided chunk ::CALL; + provided chunk LKM::deinit_bus_hook; } required sequence PCI::probe(PCI::Device)