Przeglądaj źródła

Setup now calls initialise() directly, rather than expecting the

prefix to do it.
tags/v0.9.3
Michael Brown 19 lat temu
rodzic
commit
04682f9838
1 zmienionych plików z 24 dodań i 16 usunięć
  1. 24
    16
      src/arch/i386/core/setup.S

+ 24
- 16
src/arch/i386/core/setup.S Wyświetl plik

84
 	
84
 	
85
 #endif /* CODE16 */
85
 #endif /* CODE16 */
86
 	
86
 	
87
-	/* Preserve flags (including interrupt status) */
87
+	/* Preserve flags (including interrupt status) and registers */
88
 	pushfl
88
 	pushfl
89
+	pushl	%ebp
89
 
90
 
90
 	/* Switch to (uninitialised) internal environment.  This will
91
 	/* Switch to (uninitialised) internal environment.  This will
91
 	 * preserve the external environment for when we call
92
 	 * preserve the external environment for when we call
100
 	 * after the code segment.
101
 	 * after the code segment.
101
 	 */
102
 	 */
102
 	pushw	%ax
103
 	pushw	%ax
103
-	pushw	%bx
104
 	movw	%cs, %ax
104
 	movw	%cs, %ax
105
-	movw	%ds, %bx
106
-	cmpw	%ax, %bx
105
+	movw	%ds, %bp
106
+	cmpw	%ax, %bp
107
 	jne	1f
107
 	jne	1f
108
 	addw	$_text_load_size_pgh, %ax
108
 	addw	$_text_load_size_pgh, %ax
109
 	movw	%ax, %ds
109
 	movw	%ax, %ds
110
-1:	popw	%bx
111
-	popw	%ax
110
+1:	popw	%ax
112
 		
111
 		
113
 	/* Switch to internal stack */
112
 	/* Switch to internal stack */
114
 	pushw	%ds
113
 	pushw	%ds
117
 
116
 
118
 #else /* CODE16 && KEEP_IT_REAL */
117
 #else /* CODE16 && KEEP_IT_REAL */
119
 
118
 
120
-	/* Work out where we're running */
119
+	/* Work out where we're running and switch to internal pmode
120
+	 * stack
121
+	 */
121
 	call	1f
122
 	call	1f
122
 1:	popl	%ebp
123
 1:	popl	%ebp
123
-
124
-	/* Switch to internal pmode stack */
125
 	leal	(_estack-1b)(%ebp), %esp
124
 	leal	(_estack-1b)(%ebp), %esp
126
 
125
 
127
 	/* Set up GDT for virtual addressing */
126
 	/* Set up GDT for virtual addressing */
134
 	 */
133
 	 */
135
 	RETURN_TO_EXTERNAL
134
 	RETURN_TO_EXTERNAL
136
 
135
 
137
-	/* Pass pointer to entry-point function back to prefix.  %es
138
-	 * may, by now, have been destroyed, so we re-initialise it
139
-	 * from %cs.
136
+	/* Set %es:[e]di to point to entry-point function.
140
 	 */
137
 	 */
141
-	pushw	%cs
142
-	popw	%es
138
+	push	%cs
139
+	pop	%es
143
 	mov	$ENTRY_POINT, %ENTRY_POINT_REGISTER
140
 	mov	$ENTRY_POINT, %ENTRY_POINT_REGISTER
141
+
142
+	/* Far call to arch_initialise via the entry-point function.
143
+	 * arch_initialise() (or the entry-point function itself) may
144
+	 * update %es:[e]di to point to a new entry-point function for
145
+	 * subsequent calls.  librm will use this facility, since
146
+	 * arch_initialise() causes librm to be relocated.
147
+	 */
148
+	pushl	$arch_initialise
149
+	push	%cs		/* lcall %es:[x]di == %cs:[x]di */
150
+	call	*%ENTRY_POINT_REGISTER
151
+	popl	%ebp /* discard */
144
 	
152
 	
145
-	/* Restore flags (including interrupt status) */
153
+	/* Restore flags (including interrupt status) and return */
154
+	popl	%ebp
146
 	popfl
155
 	popfl
147
-	
148
 	lret
156
 	lret
149
 
157
 
150
 /****************************************************************************
158
 /****************************************************************************

Ładowanie…
Anuluj
Zapisz