|
|
@@ -37,6 +37,9 @@ extern struct segoff __text16 ( pxe_int_1a_vector );
|
|
37
|
37
|
/** INT 1A handler */
|
|
38
|
38
|
extern void pxe_int_1a ( void );
|
|
39
|
39
|
|
|
|
40
|
+/** INT 1A hooked flag */
|
|
|
41
|
+static int int_1a_hooked = 0;
|
|
|
42
|
+
|
|
40
|
43
|
/** A function pointer to hold any PXE API call
|
|
41
|
44
|
*
|
|
42
|
45
|
* Used by pxe_api_call() to avoid large swathes of duplicated code.
|
|
|
@@ -364,25 +367,6 @@ __asmcall void pxe_loader_call ( struct i386_all_regs *ix86 ) {
|
|
364
|
367
|
ix86->regs.ax = ret;
|
|
365
|
368
|
}
|
|
366
|
369
|
|
|
367
|
|
-/**
|
|
368
|
|
- * Hook INT 1A for PXE
|
|
369
|
|
- *
|
|
370
|
|
- */
|
|
371
|
|
-void pxe_hook_int1a ( void ) {
|
|
372
|
|
- hook_bios_interrupt ( 0x1a, ( unsigned int ) pxe_int_1a,
|
|
373
|
|
- &pxe_int_1a_vector );
|
|
374
|
|
-}
|
|
375
|
|
-
|
|
376
|
|
-/**
|
|
377
|
|
- * Unhook INT 1A for PXE
|
|
378
|
|
- *
|
|
379
|
|
- * @ret rc Return status code
|
|
380
|
|
- */
|
|
381
|
|
-int pxe_unhook_int1a ( void ) {
|
|
382
|
|
- return unhook_bios_interrupt ( 0x1a, ( unsigned int ) pxe_int_1a,
|
|
383
|
|
- &pxe_int_1a_vector );
|
|
384
|
|
-}
|
|
385
|
|
-
|
|
386
|
370
|
/**
|
|
387
|
371
|
* Calculate byte checksum as used by PXE
|
|
388
|
372
|
*
|
|
|
@@ -435,6 +419,50 @@ struct init_fn pxe_init_fn __init_fn ( INIT_NORMAL ) = {
|
|
435
|
419
|
.initialise = pxe_init_structures,
|
|
436
|
420
|
};
|
|
437
|
421
|
|
|
|
422
|
+/**
|
|
|
423
|
+ * Activate PXE stack
|
|
|
424
|
+ *
|
|
|
425
|
+ * @v netdev Net device to use as PXE net device
|
|
|
426
|
+ */
|
|
|
427
|
+void pxe_activate ( struct net_device *netdev ) {
|
|
|
428
|
+
|
|
|
429
|
+ /* Ensure INT 1A is hooked */
|
|
|
430
|
+ if ( ! int_1a_hooked ) {
|
|
|
431
|
+ hook_bios_interrupt ( 0x1a, ( unsigned int ) pxe_int_1a,
|
|
|
432
|
+ &pxe_int_1a_vector );
|
|
|
433
|
+ int_1a_hooked = 1;
|
|
|
434
|
+ }
|
|
|
435
|
+
|
|
|
436
|
+ /* Set PXE network device */
|
|
|
437
|
+ pxe_set_netdev ( netdev );
|
|
|
438
|
+}
|
|
|
439
|
+
|
|
|
440
|
+/**
|
|
|
441
|
+ * Deactivate PXE stack
|
|
|
442
|
+ *
|
|
|
443
|
+ * @ret rc Return status code
|
|
|
444
|
+ */
|
|
|
445
|
+int pxe_deactivate ( void ) {
|
|
|
446
|
+ int rc;
|
|
|
447
|
+
|
|
|
448
|
+ /* Clear PXE network device */
|
|
|
449
|
+ pxe_set_netdev ( NULL );
|
|
|
450
|
+
|
|
|
451
|
+ /* Ensure INT 1A is unhooked, if possible */
|
|
|
452
|
+ if ( int_1a_hooked ) {
|
|
|
453
|
+ if ( ( rc = unhook_bios_interrupt ( 0x1a,
|
|
|
454
|
+ (unsigned int) pxe_int_1a,
|
|
|
455
|
+ &pxe_int_1a_vector ))!= 0){
|
|
|
456
|
+ DBG ( "Could not unhook INT 1A: %s\n",
|
|
|
457
|
+ strerror ( rc ) );
|
|
|
458
|
+ return rc;
|
|
|
459
|
+ }
|
|
|
460
|
+ int_1a_hooked = 0;
|
|
|
461
|
+ }
|
|
|
462
|
+
|
|
|
463
|
+ return 0;
|
|
|
464
|
+}
|
|
|
465
|
+
|
|
438
|
466
|
/**
|
|
439
|
467
|
* Start PXE NBP at 0000:7c00
|
|
440
|
468
|
*
|