Browse Source

arch_initialise() is now sufficiently generic that we may as well just

call it initialise() and place it in main.c.  :)
tags/v0.9.3
Michael Brown 20 years ago
parent
commit
87508aa0b2

+ 0
- 21
src/arch/i386/core/hooks.c View File

@@ -1,8 +1,4 @@
1
-#include "stdint.h"
2
-#include "stddef.h"
3 1
 #include "registers.h"
4
-#include "string.h"
5
-#include "init.h"
6 2
 #include "main.h"
7 3
 #include "etherboot.h"
8 4
 #include "hooks.h"
@@ -16,20 +12,6 @@ extern char _bss[], _ebss[];
16 12
  *
17 13
  */
18 14
 
19
-/*
20
- * arch_initialise(): perform any required initialisation such as
21
- * setting up the console device and relocating to high memory.
22
- *
23
- */
24
-void arch_initialise ( struct i386_all_regs *regs __unused ) {
25
-	/* Zero the BSS */
26
-	memset ( _bss, 0, _ebss - _bss );
27
-
28
-	/* Call all registered initialisation functions.
29
-	 */
30
-	call_init_fns ();
31
-}
32
-
33 15
 /*
34 16
  * arch_main() : call main() and then exit via whatever exit mechanism
35 17
  * the prefix requested.
@@ -44,9 +26,6 @@ void arch_main ( struct i386_all_regs *regs ) {
44 26
 	/* Call to main() */
45 27
 	regs->eax = main();
46 28
 
47
-	/* Call registered per-object exit functions */
48
-	call_exit_fns ();
49
-
50 29
 	if ( exit_path ) {
51 30
 		/* Prefix requested that we use a particular function
52 31
 		 * as the exit path, so we call this function, which

+ 6
- 6
src/arch/i386/core/setup.S View File

@@ -40,7 +40,7 @@
40 40
 #define RETURN_TO_EXTERNAL call kir_to_ext
41 41
 #define ENTRY_POINT kir_call
42 42
 #define ENTRY_POINT_REGISTER di	 
43
-#define INIT_FUNC arch_initialise
43
+#define INIT_FUNC initialise
44 44
 
45 45
 #else /* KEEP_IT_REAL */
46 46
 
@@ -53,7 +53,7 @@
53 53
 	.code16
54 54
 #define ENTRY_POINT _prot_call /* _prot_call = OFFSET ( prot_call ) in librm */
55 55
 #define ENTRY_POINT_REGISTER di	 
56
-#define INIT_FUNC librm_arch_initialise
56
+#define INIT_FUNC initialise_via_librm
57 57
 
58 58
 #endif /* KEEP_IT_REAL */
59 59
 	
@@ -78,7 +78,7 @@ setup16:
78 78
 #define RETURN_TO_EXTERNAL call int_to_ext
79 79
 #define ENTRY_POINT int_call
80 80
 #define ENTRY_POINT_REGISTER edi
81
-#define INIT_FUNC arch_initialise
81
+#define INIT_FUNC initialise
82 82
 		
83 83
 	.section ".text"
84 84
 	.code32
@@ -142,11 +142,11 @@ setup:
142 142
 	pop	%es
143 143
 	mov	$ENTRY_POINT, %ENTRY_POINT_REGISTER
144 144
 
145
-	/* Far call to arch_initialise via the entry-point function.
146
-	 * arch_initialise() (or the entry-point function itself) may
145
+	/* Far call to initialise via the entry-point function.
146
+	 * initialise() (or the entry-point function itself) may
147 147
 	 * update %es:[e]di to point to a new entry-point function for
148 148
 	 * subsequent calls.  librm will use this facility, since
149
-	 * arch_initialise() causes librm to be relocated.
149
+	 * initialise() causes librm to be relocated.
150 150
 	 */
151 151
 	pushl	$INIT_FUNC
152 152
 	push	%cs		/* lcall %es:[x]di == %cs:[x]di */

+ 0
- 1
src/arch/i386/include/hooks.h View File

@@ -1,7 +1,6 @@
1 1
 #ifndef HOOKS_H
2 2
 #define HOOKS_H
3 3
 
4
-extern void arch_initialise ( struct i386_all_regs *regs );
5 4
 extern void arch_main ( struct i386_all_regs *regs );
6 5
 
7 6
 #endif /* HOOKS_H */

+ 3
- 3
src/arch/i386/transitions/librm_mgmt.c View File

@@ -126,16 +126,16 @@ INIT_FN ( INIT_LIBRM, librm_init, NULL, uninstall_librm );
126 126
 POST_RELOC_FN ( POST_RELOC_LIBRM, librm_post_reloc );
127 127
 
128 128
 /*
129
- * Wrapper for arch_initialise() when librm is being used.  We have to
129
+ * Wrapper for initialise() when librm is being used.  We have to
130 130
  * install a copy of librm to allocated base memory and return the
131 131
  * pointer to this new librm's entry point via es:di.
132 132
  *
133 133
  */
134
-void librm_arch_initialise ( struct i386_all_regs *regs ) {
134
+void initialise_via_librm ( struct i386_all_regs *regs ) {
135 135
 	char *new_librm;
136 136
 
137 137
 	/* Hand off to arch_initialise() */
138
-	arch_initialise ( regs );
138
+	initialise ( regs );
139 139
 
140 140
 	/* Uninstall current librm (i.e. the one that's part of the
141 141
 	 * original, pre-relocation Etherboot image).

+ 21
- 0
src/core/main.c View File

@@ -138,6 +138,23 @@ static int exit_status;
138 138
 static int initialized;
139 139
 
140 140
 
141
+/**************************************************************************
142
+ * initialise() - perform any C-level initialisation
143
+ *
144
+ * This does not include initialising the NIC, but it does include
145
+ * e.g. getting the memory map, relocating to high memory,
146
+ * initialising the console, etc.
147
+ **************************************************************************
148
+ */
149
+void initialise ( void ) {
150
+	/* Zero the BSS */
151
+	memset ( _bss, 0, _ebss - _bss );
152
+
153
+	/* Call all registered initialisation functions.
154
+	 */
155
+	call_init_fns ();
156
+}
157
+
141 158
 /**************************************************************************
142 159
 MAIN - Kick off routine
143 160
 **************************************************************************/
@@ -164,6 +181,10 @@ int main ( void ) {
164 181
 		state = main_loop(state);
165 182
 	}
166 183
 	/* arch_on_exit(exit_status) */
184
+
185
+	/* Call registered per-object exit functions */
186
+	call_exit_fns ();
187
+
167 188
 	return exit_status;
168 189
 }
169 190
 

Loading…
Cancel
Save