]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
Cleaner separation of functionality between post_reloc and
authorMichael Brown <mcb30@etherboot.org>
Mon, 11 Apr 2005 09:24:10 +0000 (09:24 +0000)
committerMichael Brown <mcb30@etherboot.org>
Mon, 11 Apr 2005 09:24:10 +0000 (09:24 +0000)
initialise_via_librm.

src/arch/i386/transitions/librm_mgmt.c

index 384fb6733853df160ef801f9703ac5d5f25aef7d..ffd55ff615752f31098cdff68f2c0c118c4e9b11 100644 (file)
@@ -120,6 +120,14 @@ static void librm_post_reloc ( void ) {
        /* Point installed_librm back at last known physical location.
         */
        installed_librm = phys_to_virt ( librm_base );
+
+       /* Allocate base memory for librm and place a copy there */
+       if ( ! allocated_librm ) {
+               char *new_librm = alloc_base_memory ( librm_size );
+               uninstall_librm ();
+               install_librm ( new_librm );
+               allocated_librm = 1;
+       }
 }
 
 INIT_FN ( INIT_LIBRM, librm_init, NULL, uninstall_librm );
@@ -132,23 +140,9 @@ POST_RELOC_FN ( POST_RELOC_LIBRM, librm_post_reloc );
  *
  */
 void initialise_via_librm ( struct i386_all_regs *regs ) {
-       char *new_librm;
-
        /* Hand off to initialise() */
        initialise ();
 
-       /* Uninstall current librm (i.e. the one that's part of the
-        * original, pre-relocation Etherboot image).
-        */
-       uninstall_librm();
-
-       /* Allocate space for new librm */
-       new_librm = alloc_base_memory ( librm_size );
-       allocated_librm = 1;
-       
-       /* Install new librm */
-       install_librm ( new_librm );
-
        /* Point es:di to new librm's entry point.  Fortunately, di is
         * already set up by setup16, so all we need to do is point
         * es:0000 to the start of the new librm.