|
@@ -34,14 +34,6 @@ extern struct segoff __text16 ( pxe_int_1a_vector );
|
34
|
34
|
/** INT 1A handler */
|
35
|
35
|
extern void pxe_int_1a ( void );
|
36
|
36
|
|
37
|
|
-/** !PXE structure */
|
38
|
|
-extern struct s_PXE __text16 ( pxe );
|
39
|
|
-#define pxe __use_text16 ( pxe )
|
40
|
|
-
|
41
|
|
-/** PXENV+ structure */
|
42
|
|
-extern struct s_PXENV __text16 ( pxenv );
|
43
|
|
-#define pxenv __use_text16 ( pxenv )
|
44
|
|
-
|
45
|
37
|
/** A function pointer to hold any PXE API call
|
46
|
38
|
*
|
47
|
39
|
* Used by pxe_api_call() to avoid large swathes of duplicated code.
|
|
@@ -310,7 +302,7 @@ void pxe_api_call ( struct i386_all_regs *ix86 ) {
|
310
|
302
|
* Hook INT 1A for PXE
|
311
|
303
|
*
|
312
|
304
|
*/
|
313
|
|
-void pxe_hook_int ( void ) {
|
|
305
|
+void pxe_hook_int1a ( void ) {
|
314
|
306
|
hook_bios_interrupt ( 0x1a, ( unsigned int ) pxe_int_1a,
|
315
|
307
|
&pxe_int_1a_vector );
|
316
|
308
|
}
|
|
@@ -320,7 +312,7 @@ void pxe_hook_int ( void ) {
|
320
|
312
|
*
|
321
|
313
|
* @ret rc Return status code
|
322
|
314
|
*/
|
323
|
|
-int pxe_unhook_int ( void ) {
|
|
315
|
+int pxe_unhook_int1a ( void ) {
|
324
|
316
|
return unhook_bios_interrupt ( 0x1a, ( unsigned int ) pxe_int_1a,
|
325
|
317
|
&pxe_int_1a_vector );
|
326
|
318
|
}
|
|
@@ -343,24 +335,24 @@ static uint8_t pxe_checksum ( void *data, size_t size ) {
|
343
|
335
|
}
|
344
|
336
|
|
345
|
337
|
/**
|
346
|
|
- * Initialise PXE stack
|
|
338
|
+ * Initialise !PXE and PXENV+ structures
|
347
|
339
|
*
|
348
|
340
|
*/
|
349
|
|
-void init_pxe ( void ) {
|
|
341
|
+void pxe_init_structures ( void ) {
|
350
|
342
|
uint32_t rm_cs_phys = ( rm_cs << 4 );
|
351
|
343
|
uint32_t rm_ds_phys = ( rm_ds << 4 );
|
352
|
344
|
|
353
|
345
|
/* Fill in missing segment fields */
|
354
|
|
- pxe.EntryPointSP.segment = rm_cs;
|
355
|
|
- pxe.EntryPointESP.segment = rm_cs;
|
356
|
|
- pxe.Stack.segment_address = rm_ds;
|
357
|
|
- pxe.Stack.Physical_address = rm_ds_phys;
|
358
|
|
- pxe.UNDIData.segment_address = rm_ds;
|
359
|
|
- pxe.UNDIData.Physical_address = rm_ds_phys;
|
360
|
|
- pxe.UNDICode.segment_address = rm_cs;
|
361
|
|
- pxe.UNDICode.Physical_address = rm_cs_phys;
|
362
|
|
- pxe.UNDICodeWrite.segment_address = rm_cs;
|
363
|
|
- pxe.UNDICodeWrite.Physical_address = rm_cs_phys;
|
|
346
|
+ ppxe.EntryPointSP.segment = rm_cs;
|
|
347
|
+ ppxe.EntryPointESP.segment = rm_cs;
|
|
348
|
+ ppxe.Stack.segment_address = rm_ds;
|
|
349
|
+ ppxe.Stack.Physical_address = rm_ds_phys;
|
|
350
|
+ ppxe.UNDIData.segment_address = rm_ds;
|
|
351
|
+ ppxe.UNDIData.Physical_address = rm_ds_phys;
|
|
352
|
+ ppxe.UNDICode.segment_address = rm_cs;
|
|
353
|
+ ppxe.UNDICode.Physical_address = rm_cs_phys;
|
|
354
|
+ ppxe.UNDICodeWrite.segment_address = rm_cs;
|
|
355
|
+ ppxe.UNDICodeWrite.Physical_address = rm_cs_phys;
|
364
|
356
|
pxenv.RMEntry.segment = rm_cs;
|
365
|
357
|
pxenv.StackSeg = rm_ds;
|
366
|
358
|
pxenv.UNDIDataSeg = rm_ds;
|
|
@@ -368,34 +360,6 @@ void init_pxe ( void ) {
|
368
|
360
|
pxenv.PXEPtr.segment = rm_cs;
|
369
|
361
|
|
370
|
362
|
/* Update checksums */
|
371
|
|
- pxe.StructCksum -= pxe_checksum ( &pxe, sizeof ( pxe ) );
|
|
363
|
+ ppxe.StructCksum -= pxe_checksum ( &ppxe, sizeof ( ppxe ) );
|
372
|
364
|
pxenv.Checksum -= pxe_checksum ( &pxenv, sizeof ( pxenv ) );
|
373
|
365
|
}
|
374
|
|
-
|
375
|
|
-/**
|
376
|
|
- * Boot via PXE NBP
|
377
|
|
- *
|
378
|
|
- * @ret rc Return status code
|
379
|
|
- */
|
380
|
|
-int pxe_boot ( void ) {
|
381
|
|
- int discard_b, discard_c;
|
382
|
|
- uint16_t rc;
|
383
|
|
-
|
384
|
|
- /* Ensure that PXE stack is ready to use */
|
385
|
|
- init_pxe();
|
386
|
|
- pxe_hook_int();
|
387
|
|
-
|
388
|
|
- /* Far call to PXE NBP */
|
389
|
|
- __asm__ __volatile__ ( REAL_CODE ( "pushw %%cx\n\t"
|
390
|
|
- "pushw %%ax\n\t"
|
391
|
|
- "movw %%cx, %%es\n\t"
|
392
|
|
- "lcall $0, $0x7c00\n\t" )
|
393
|
|
- : "=a" ( rc ), "=b" ( discard_b ),
|
394
|
|
- "=c" ( discard_c )
|
395
|
|
- : "a" ( & __from_text16 ( pxe ) ),
|
396
|
|
- "b" ( & __from_text16 ( pxenv ) ),
|
397
|
|
- "c" ( rm_cs )
|
398
|
|
- : "edx", "esi", "edi", "ebp", "memory" );
|
399
|
|
-
|
400
|
|
- return rc;
|
401
|
|
-}
|