Browse Source

[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 years ago
parent
commit
e84e19d4ed
1 changed files with 38 additions and 0 deletions
  1. 38
    0
      src/arch/i386/prefix/pxeprefix.S

+ 38
- 0
src/arch/i386/prefix/pxeprefix.S View File

5
 #define PXENV_UNDI_GET_IFACE_INFO	0x0013
5
 #define PXENV_UNDI_GET_IFACE_INFO	0x0013
6
 #define	PXENV_STOP_UNDI			0x0015
6
 #define	PXENV_STOP_UNDI			0x0015
7
 #define PXENV_UNLOAD_STACK		0x0070
7
 #define PXENV_UNLOAD_STACK		0x0070
8
+#define PXENV_FILE_CMDLINE		0x00e8
8
 
9
 
9
 #define PXE_HACK_EB54			0x0001
10
 #define PXE_HACK_EB54			0x0001
10
 
11
 
381
 99:	movb	$0x0a, %al
382
 99:	movb	$0x0a, %al
382
 	call	print_character
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
  * Leave NIC in a safe state
417
  * Leave NIC in a safe state
386
  *****************************************************************************
418
  *****************************************************************************
728
 	movw	pxe_ss,	%di
760
 	movw	pxe_ss,	%di
729
 	movl	pxe_esp, %ebp
761
 	movl	pxe_esp, %ebp
730
 
762
 
763
+	/* Retrieve PXE command line, if any */
764
+	movl	pxe_cmdline, %esi
765
+
731
 	/* Jump to .text16 segment with %ds pointing to .data16 */
766
 	/* Jump to .text16 segment with %ds pointing to .data16 */
732
 	movw	%bx, %ds
767
 	movw	%bx, %ds
733
 	pushw	%ax
768
 	pushw	%ax
738
 	/* Update the exit hook */
773
 	/* Update the exit hook */
739
 	movw	%cs, ( pxe_exit_hook + 2 )
774
 	movw	%cs, ( pxe_exit_hook + 2 )
740
 
775
 
776
+	/* Store command-line pointer */
777
+	movl	%esi, cmdline_phys
778
+
741
 	/* Run main program */
779
 	/* Run main program */
742
 	pushl	$main
780
 	pushl	$main
743
 	pushw	%cs
781
 	pushw	%cs

Loading…
Cancel
Save