|
@@ -120,6 +120,14 @@ static void librm_post_reloc ( void ) {
|
120
|
120
|
/* Point installed_librm back at last known physical location.
|
121
|
121
|
*/
|
122
|
122
|
installed_librm = phys_to_virt ( librm_base );
|
|
123
|
+
|
|
124
|
+ /* Allocate base memory for librm and place a copy there */
|
|
125
|
+ if ( ! allocated_librm ) {
|
|
126
|
+ char *new_librm = alloc_base_memory ( librm_size );
|
|
127
|
+ uninstall_librm ();
|
|
128
|
+ install_librm ( new_librm );
|
|
129
|
+ allocated_librm = 1;
|
|
130
|
+ }
|
123
|
131
|
}
|
124
|
132
|
|
125
|
133
|
INIT_FN ( INIT_LIBRM, librm_init, NULL, uninstall_librm );
|
|
@@ -132,23 +140,9 @@ POST_RELOC_FN ( POST_RELOC_LIBRM, librm_post_reloc );
|
132
|
140
|
*
|
133
|
141
|
*/
|
134
|
142
|
void initialise_via_librm ( struct i386_all_regs *regs ) {
|
135
|
|
- char *new_librm;
|
136
|
|
-
|
137
|
143
|
/* Hand off to initialise() */
|
138
|
144
|
initialise ();
|
139
|
145
|
|
140
|
|
- /* Uninstall current librm (i.e. the one that's part of the
|
141
|
|
- * original, pre-relocation Etherboot image).
|
142
|
|
- */
|
143
|
|
- uninstall_librm();
|
144
|
|
-
|
145
|
|
- /* Allocate space for new librm */
|
146
|
|
- new_librm = alloc_base_memory ( librm_size );
|
147
|
|
- allocated_librm = 1;
|
148
|
|
-
|
149
|
|
- /* Install new librm */
|
150
|
|
- install_librm ( new_librm );
|
151
|
|
-
|
152
|
146
|
/* Point es:di to new librm's entry point. Fortunately, di is
|
153
|
147
|
* already set up by setup16, so all we need to do is point
|
154
|
148
|
* es:0000 to the start of the new librm.
|