Bläddra i källkod

[pxeprefix] Fetch command line (if any) via PXENV_FILE_CMDLINE

Use PXENV_FILE_CMDLINE to retrieve the command line (if any) provided
by the invoking PXE stack.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 år sedan
förälder
incheckning
e84e19d4ed
1 ändrade filer med 38 tillägg och 0 borttagningar
  1. 38
    0
      src/arch/i386/prefix/pxeprefix.S

+ 38
- 0
src/arch/i386/prefix/pxeprefix.S Visa fil

@@ -5,6 +5,7 @@ FILE_LICENCE ( GPL2_OR_LATER )
5 5
 #define PXENV_UNDI_GET_IFACE_INFO	0x0013
6 6
 #define	PXENV_STOP_UNDI			0x0015
7 7
 #define PXENV_UNLOAD_STACK		0x0070
8
+#define PXENV_FILE_CMDLINE		0x00e8
8 9
 
9 10
 #define PXE_HACK_EB54			0x0001
10 11
 
@@ -381,6 +382,37 @@ get_iface_type:
381 382
 99:	movb	$0x0a, %al
382 383
 	call	print_character
383 384
 
385
+
386
+/*****************************************************************************
387
+ * Check for a command line
388
+ *****************************************************************************
389
+ */
390
+get_cmdline:
391
+	/* Issue PXENV_FILE_CMDLINE */
392
+	xorl	%esi, %esi
393
+	movw	%ss, %si
394
+	movw	%si, ( pxe_parameter_structure + 0x06 )
395
+	movw	$PREFIX_STACK_SIZE, ( pxe_parameter_structure + 0x04 )
396
+	movw	$0xffff, ( pxe_parameter_structure + 0x02 )
397
+	movw	$PXENV_FILE_CMDLINE, %bx
398
+	call	pxe_call
399
+	jnc	1f
400
+	call	print_pxe_error
401
+	jmp	99f
402
+1:	/* Check for non-NULL command line */
403
+	movw	( pxe_parameter_structure + 0x02 ), %ax
404
+	testw	%ax, %ax
405
+	jz	99f
406
+	/* Record command line */
407
+	shll	$4, %esi
408
+	addl	$PREFIX_STACK_SIZE, %esi
409
+	movl	%esi, pxe_cmdline
410
+99:
411
+	.section ".prefix.data", "aw", @progbits
412
+pxe_cmdline:
413
+	.long	0
414
+	.previous
415
+
384 416
 /*****************************************************************************
385 417
  * Leave NIC in a safe state
386 418
  *****************************************************************************
@@ -728,6 +760,9 @@ run_ipxe:
728 760
 	movw	pxe_ss,	%di
729 761
 	movl	pxe_esp, %ebp
730 762
 
763
+	/* Retrieve PXE command line, if any */
764
+	movl	pxe_cmdline, %esi
765
+
731 766
 	/* Jump to .text16 segment with %ds pointing to .data16 */
732 767
 	movw	%bx, %ds
733 768
 	pushw	%ax
@@ -738,6 +773,9 @@ run_ipxe:
738 773
 	/* Update the exit hook */
739 774
 	movw	%cs, ( pxe_exit_hook + 2 )
740 775
 
776
+	/* Store command-line pointer */
777
+	movl	%esi, cmdline_phys
778
+
741 779
 	/* Run main program */
742 780
 	pushl	$main
743 781
 	pushw	%cs

Laddar…
Avbryt
Spara