Kaynağa Gözat

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 19 yıl önce
ebeveyn
işleme
87508aa0b2

+ 0
- 21
src/arch/i386/core/hooks.c Dosyayı Görüntüle

1
-#include "stdint.h"
2
-#include "stddef.h"
3
 #include "registers.h"
1
 #include "registers.h"
4
-#include "string.h"
5
-#include "init.h"
6
 #include "main.h"
2
 #include "main.h"
7
 #include "etherboot.h"
3
 #include "etherboot.h"
8
 #include "hooks.h"
4
 #include "hooks.h"
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
  * arch_main() : call main() and then exit via whatever exit mechanism
16
  * arch_main() : call main() and then exit via whatever exit mechanism
35
  * the prefix requested.
17
  * the prefix requested.
44
 	/* Call to main() */
26
 	/* Call to main() */
45
 	regs->eax = main();
27
 	regs->eax = main();
46
 
28
 
47
-	/* Call registered per-object exit functions */
48
-	call_exit_fns ();
49
-
50
 	if ( exit_path ) {
29
 	if ( exit_path ) {
51
 		/* Prefix requested that we use a particular function
30
 		/* Prefix requested that we use a particular function
52
 		 * as the exit path, so we call this function, which
31
 		 * as the exit path, so we call this function, which

+ 6
- 6
src/arch/i386/core/setup.S Dosyayı Görüntüle

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

+ 0
- 1
src/arch/i386/include/hooks.h Dosyayı Görüntüle

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

+ 3
- 3
src/arch/i386/transitions/librm_mgmt.c Dosyayı Görüntüle

126
 POST_RELOC_FN ( POST_RELOC_LIBRM, librm_post_reloc );
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
  * install a copy of librm to allocated base memory and return the
130
  * install a copy of librm to allocated base memory and return the
131
  * pointer to this new librm's entry point via es:di.
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
 	char *new_librm;
135
 	char *new_librm;
136
 
136
 
137
 	/* Hand off to arch_initialise() */
137
 	/* Hand off to arch_initialise() */
138
-	arch_initialise ( regs );
138
+	initialise ( regs );
139
 
139
 
140
 	/* Uninstall current librm (i.e. the one that's part of the
140
 	/* Uninstall current librm (i.e. the one that's part of the
141
 	 * original, pre-relocation Etherboot image).
141
 	 * original, pre-relocation Etherboot image).

+ 21
- 0
src/core/main.c Dosyayı Görüntüle

138
 static int initialized;
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
 MAIN - Kick off routine
159
 MAIN - Kick off routine
143
 **************************************************************************/
160
 **************************************************************************/
164
 		state = main_loop(state);
181
 		state = main_loop(state);
165
 	}
182
 	}
166
 	/* arch_on_exit(exit_status) */
183
 	/* arch_on_exit(exit_status) */
184
+
185
+	/* Call registered per-object exit functions */
186
+	call_exit_fns ();
187
+
167
 	return exit_status;
188
 	return exit_status;
168
 }
189
 }
169
 
190
 

Loading…
İptal
Kaydet