Stefan Reinauer ([email protected]) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2787

-gerrit

commit 0419e53ce6e0d08e34559ea70f5c85001b5ad400
Author: Aaron Durbin <[email protected]>
Date:   Thu Feb 7 02:13:50 2013 -0600

    rmodule: add bss clearing option to API
    
    There are circumstances where the loader should not clear the bss. For
    example, the ramstage clears its own bss. There is no sense in clearing
    the bss twice. Therefore, allow the loader to optionally clear the bss
    by adding a function that does not clear the bss.
    
    Change-Id: Ic0a3f439b6289c680d3c3afc17e866d935c9f29f
    Signed-off-by: Aaron Durbin <[email protected]>
---
 src/include/rmodule.h |  1 +
 src/lib/rmodule.c     | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/include/rmodule.h b/src/include/rmodule.h
index 5300c63..89310c9 100644
--- a/src/include/rmodule.h
+++ b/src/include/rmodule.h
@@ -39,6 +39,7 @@ void *rmodule_entry(const struct rmodule *m);
 int rmodule_entry_offset(const struct rmodule *m);
 int rmodule_memory_size(const struct rmodule *m);
 int rmodule_load(void *loc, struct rmodule *m);
+int rmodule_load_no_clear_bss(void *base, struct rmodule *m);
 int rmodule_load_alignment(const struct rmodule *m);
 
 #define FIELD_ENTRY(x_) ((u32)&x_)
diff --git a/src/lib/rmodule.c b/src/lib/rmodule.c
index 56d7c6d..6da7a6e 100644
--- a/src/lib/rmodule.c
+++ b/src/lib/rmodule.c
@@ -228,7 +228,7 @@ int rmodule_load_alignment(const struct rmodule *module)
        return module->header->module_link_start_address;
 }
 
-int rmodule_load(void *base, struct rmodule *module)
+static int __rmodule_load(void *base, struct rmodule *module, int clear_bss)
 {
        /*
         * In order to load the module at a given address, the following steps
@@ -239,7 +239,17 @@ int rmodule_load(void *base, struct rmodule *module)
         */
        module->location = base;
        rmodule_copy_payload(module);
-       rmodule_clear_bss(module);
+       if (clear_bss)
+               rmodule_clear_bss(module);
        return rmodule_relocate(module);
 }
 
+int rmodule_load(void *base, struct rmodule *module)
+{
+       return __rmodule_load(base, module, 1);
+}
+
+int rmodule_load_no_clear_bss(void *base, struct rmodule *module)
+{
+       return __rmodule_load(base, module, 0);
+}

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to