Use the ADV to support boot-once
authorH. Peter Anvin <hpa@zytor.com>
Mon, 15 Oct 2007 23:20:32 +0000 (16:20 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 13 Dec 2007 21:55:54 +0000 (13:55 -0800)
Define ADV tag 1 as boot-once; overrides DEFAULT once only

adv.inc
ui.inc

diff --git a/adv.inc b/adv.inc
index 19ea45f..42b36b1 100644 (file)
--- a/adv.inc
+++ b/adv.inc
 ;; has no special meaning.
 ;;
 
+;;
+;; List of ADV tags...
+;;
+ADV_BOOTONCE   equ 1
+
+;;
+;; Other ADV data...
+;;
 ADV_MAGIC1     equ 0x5a2d2fa5                  ; Head signature
 ADV_MAGIC2     equ 0xa3041767                  ; Total checksum
 ADV_MAGIC3     equ 0xdd28bf64                  ; Tail signature
diff --git a/ui.inc b/ui.inc
index 956caa4..8df0633 100644 (file)
--- a/ui.inc
+++ b/ui.inc
@@ -18,6 +18,31 @@ load_config_file:
 no_config_file:
 
                call adv_init
+;
+; Check for an ADV boot-once entry
+;
+               mov dl,ADV_BOOTONCE
+               call adv_get
+               jcxz .no_bootonce
+
+.have_bootone:
+               ; We apparently have a boot-once set; clear it and
+               ; then execute the boot-once...
+
+               ; Save the boot-once data; SI = data, CX = length
+               mov di,command_line
+               rep movsb
+               xor ax,ax
+               stosb
+
+               ; Clear the boot-once data from the ADV
+               xor cx,cx                       ; Set to zero = delete
+               call adv_set
+               jc .err
+               call adv_write
+.err:          jmp load_kernel
+
+.no_bootonce:
 
 ;
 ; Check whether or not we are supposed to display the boot prompt.