Browse Source

Use the global load_buffer, and the boot_image function.

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
a5a14dc05d
1 changed files with 11 additions and 6 deletions
  1. 11
    6
      src/core/main.c

+ 11
- 6
src/core/main.c View File

162
 MAIN - Kick off routine
162
 MAIN - Kick off routine
163
 **************************************************************************/
163
 **************************************************************************/
164
 int main ( void ) {
164
 int main ( void ) {
165
-	struct buffer buffer;
166
 	int skip = 0;
165
 	int skip = 0;
167
 
166
 
168
 	/* Print out configuration */
167
 	/* Print out configuration */
215
 		}
214
 		}
216
 
215
 
217
 		/* Load boot file from the device */
216
 		/* Load boot file from the device */
218
-		init_buffer ( &buffer, 0x7c00, 0x100 );
219
-		if ( ! load ( &dev, &buffer ) ) {
220
-			/* Load (e.g. TFTP failed) */
217
+		init_buffer ( &load_buffer );
218
+		if ( ! load ( &dev, &load_buffer ) ) {
219
+			/* Load (e.g. TFTP) failed */
221
 			printf ( "...load failed\n" );
220
 			printf ( "...load failed\n" );
222
 			continue;
221
 			continue;
223
 		}
222
 		}
224
 
223
 
225
-		printf ( "Loaded file of size %d\n", buffer.fill );
226
-
224
+		/* Boot the loaded image */
225
+		if ( ! boot_image ( &load_buffer ) ) {
226
+			/* Boot failed (e.g. invalid image) */
227
+			printf ( "...boot failed\n" );
228
+			continue;
229
+		}
230
+		
231
+		/* Image returned */
227
 	}
232
 	}
228
 
233
 
229
 	/* Call registered per-object exit functions */
234
 	/* Call registered per-object exit functions */

Loading…
Cancel
Save