[syslinux:master] bios: Remove shuffle and boot comapi call

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Thu Feb 13 16:12:07 PST 2014


Commit-ID:  a5727651bb78e7cd1bd90046e24fbcedf4f7dfb9
Gitweb:     http://www.syslinux.org/commit/a5727651bb78e7cd1bd90046e24fbcedf4f7dfb9
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Thu, 13 Feb 2014 16:09:13 -0800
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Thu, 13 Feb 2014 16:09:13 -0800

bios: Remove shuffle and boot comapi call

Remove the shuffle and boot comapi call.  This is the last of the
comapi calls left; we should now be able to completely remove the
comapi support.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>

---
 com32/include/syslinux/boot.h                |  3 +++
 com32/lib/syslinux/{addlist.c => biosboot.c} | 22 ++++++++--------------
 com32/lib/syslinux/shuffle.c                 | 11 +++--------
 core/bcopyxx.inc                             |  8 ++++++++
 core/bios.c                                  | 25 +++++++++++++++++++++++++
 core/cleanup.c                               | 22 +---------------------
 core/comboot.inc                             | 24 +-----------------------
 core/diskboot.inc                            |  1 +
 core/include/bios.h                          |  1 -
 core/isolinux.asm                            |  4 ++++
 core/pxelinux.asm                            |  4 ++++
 11 files changed, 58 insertions(+), 67 deletions(-)

diff --git a/com32/include/syslinux/boot.h b/com32/include/syslinux/boot.h
index 74a311d..6079e7c 100644
--- a/com32/include/syslinux/boot.h
+++ b/com32/include/syslinux/boot.h
@@ -48,6 +48,9 @@ void syslinux_chain_bootstrap(uint16_t flags, const void *bootstrap,
 			      uint32_t bootstrap_len, uint32_t edx,
 			      uint32_t esi, uint16_t ds);
 
+void bios_do_shuffle_and_boot(uint16_t bootflags, uint32_t descaddr,
+			      const void *descbuf, uint32_t dsize);
+
 struct image_types {
     const char *name;
     uint32_t type;
diff --git a/com32/lib/syslinux/addlist.c b/com32/lib/syslinux/biosboot.c
similarity index 76%
copy from com32/lib/syslinux/addlist.c
copy to com32/lib/syslinux/biosboot.c
index 265cf4a..9bdf84f 100644
--- a/com32/lib/syslinux/addlist.c
+++ b/com32/lib/syslinux/biosboot.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------- *
  *
- *   Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2014 Intel Corporation; author: H. Peter Anvin
  *
  *   Permission is hereby granted, free of charge, to any person
  *   obtaining a copy of this software and associated documentation
@@ -25,21 +25,15 @@
  *
  * ----------------------------------------------------------------------- */
 
-#include <stdlib.h>
+#include <syslinux/boot.h>
 #include <syslinux/movebits.h>
 
-int syslinux_add_movelist(struct syslinux_movelist **list,
-			  addr_t dst, addr_t src, addr_t len)
+void bios_do_shuffle_and_boot(uint16_t bootflags, uint32_t descaddr,
+			      const void *descbuf, uint32_t dsize)
 {
-    struct syslinux_movelist *ml = malloc(sizeof(struct syslinux_movelist));
-    if (!ml)
-	return -1;
+    extern void do_raw_shuffle_and_boot(addr_t, const void *, addr_t);
 
-    ml->dst = dst;
-    ml->src = src;
-    ml->len = len;
-    ml->next = *list;
-
-    *list = ml;
-    return 0;
+    syslinux_final_cleanup(bootflags);
+    do_raw_shuffle_and_boot(descaddr, descbuf, dsize);
+    /* Should not return */
 }
diff --git a/com32/lib/syslinux/shuffle.c b/com32/lib/syslinux/shuffle.c
index ce85a5c..2752c88 100644
--- a/com32/lib/syslinux/shuffle.c
+++ b/com32/lib/syslinux/shuffle.c
@@ -43,6 +43,7 @@
 #include <dprintf.h>
 #include <syslinux/movebits.h>
 #include <klibc/compiler.h>
+#include <syslinux/boot.h>
 
 struct shuffle_descriptor {
     uint32_t dst, src, len;
@@ -78,7 +79,6 @@ int syslinux_do_shuffle(struct syslinux_movelist *fraglist,
     int need_ptrs;
     addr_t desczone, descfree, descaddr;
     int nmoves, nzero;
-    com32sys_t ireg;
 
     descaddr = 0;
     dp = dbuf = NULL;
@@ -224,13 +224,8 @@ bail:
 	return rv;
 
     /* Actually do it... */
-    memset(&ireg, 0, sizeof ireg);
-    ireg.edi.l = descaddr;
-    ireg.esi.l = (addr_t) dbuf;
-    ireg.ecx.l = (addr_t) dp - (addr_t) dbuf;
-    ireg.edx.w[0] = bootflags;
-    ireg.eax.w[0] = 0x0024;
-    __intcall(0x22, &ireg, NULL);
+    bios_do_shuffle_and_boot(bootflags, descaddr, dbuf,
+			     (addr_t)dp - (addr_t)dbuf);
 
     return -1;			/* Shouldn't have returned! */
 }
diff --git a/core/bcopyxx.inc b/core/bcopyxx.inc
index cfdda0b..7a8c649 100644
--- a/core/bcopyxx.inc
+++ b/core/bcopyxx.inc
@@ -207,6 +207,14 @@ pm_bcopy:
 ;
 ;     (*) dst, src, and len are four bytes each
 ;
+; do_raw_shuffle_and_boot is the same entry point, but with a C ABI:
+; do_raw_shuffle_and_boot(safearea, descriptors, bytecount)
+;
+		global do_raw_shuffle_and_boot
+do_raw_shuffle_and_boot:
+		mov edi,eax
+		mov esi,edx
+
 pm_shuffle:
 		cli			; End interrupt service (for good)
 		mov ebx,edi		; EBX <- descriptor list
diff --git a/core/bios.c b/core/bios.c
index ac1f48b..9cfb94b 100644
--- a/core/bios.c
+++ b/core/bios.c
@@ -665,6 +665,31 @@ void bios_init(void)
 	dmi_init();
 }
 
+extern void comboot_cleanup_api(void);
+extern void bios_timer_cleanup(void);
+
+extern uint32_t OrigFDCTabPtr;
+
+static void bios_cleanup_hardware(void)
+{
+	/* Restore the original pointer to the floppy descriptor table */
+	if (OrigFDCTabPtr)
+		*((uint32_t *)(4 * 0x1e)) = OrigFDCTabPtr;
+
+	/*
+	 * Linux wants the floppy motor shut off before starting the
+	 * kernel, at least bootsect.S seems to imply so.  If we don't
+	 * load the floppy driver, this is *definitely* so!
+	 */
+	__intcall(0x13, &zero_regs, NULL);
+
+	call16(comboot_cleanup_api, &zero_regs, NULL);
+	call16(bios_timer_cleanup, &zero_regs, NULL);
+
+	/* If we enabled serial port interrupts, clean them up now */
+	sirq_cleanup();
+}
+
 extern void *bios_malloc(size_t, enum heap, size_t);
 extern void *bios_realloc(void *, size_t);
 extern void bios_free(void *);
diff --git a/core/cleanup.c b/core/cleanup.c
index de318d9..eceb8e9 100644
--- a/core/cleanup.c
+++ b/core/cleanup.c
@@ -15,38 +15,18 @@
 #include <syslinux/memscan.h>
 #include <syslinux/firmware.h>
 
-extern void comboot_cleanup_api(void);
-extern void bios_timer_cleanup(void);
-
 /*
  * cleanup.c
  *
  * Some final tidying before jumping to a kernel or bootsector
  */
 
-void bios_cleanup_hardware(void)
-{
-	/*
-	 * TODO
-	 *
-	 * Linux wants the floppy motor shut off before starting the
-	 * kernel, at least bootsect.S seems to imply so.  If we don't
-	 * load the floppy driver, this is *definitely* so!
-	 */
-	__intcall(0x13, &zero_regs, NULL);
-
-	call16(comboot_cleanup_api, &zero_regs, NULL);
-	call16(bios_timer_cleanup, &zero_regs, NULL);
-
-	/* If we enabled serial port interrupts, clean them up now */
-	sirq_cleanup();
-}
-
 /*
  * cleanup_hardware:
  *
  *	Shut down anything transient.
  */
+
 __export void cleanup_hardware(void)
 {
 	firmware->cleanup();
diff --git a/core/comboot.inc b/core/comboot.inc
index c651483..4b64d08 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -342,28 +342,6 @@ comapi_err:
 		stc
 		ret
 
-;
-; INT 22h AX=0024h	Cleanup, shuffle and boot raw
-;
-comapi_shufraw:
-%if IS_PXELINUX
-		; Unload PXE if requested
-		test dl,3
-		setnz [KeepPXE]
-		sub bp,sp               ; unload_pxe may move the stack around
-		pm_call unload_pxe
-		add bp,sp               ; restore frame pointer...
-%elif IS_SYSLINUX || IS_EXTLINUX
-		; Restore original FDC table
-		mov eax,[OrigFDCTabPtr]
-		mov [fdctab],eax
-%endif
-		pm_call cleanup_hardware
-		mov edi,P_EDI
-		mov esi,P_ESI
-		mov ecx,P_ECX
-		jmp shuffle_and_boot_raw
-
 		section .data16
 
 		alignz 2
@@ -404,7 +382,7 @@ int22_table:
 		dw comapi_err		; 0021 read directory
 		dw comapi_err		; 0022 close directory
 		dw comapi_err		; 0023 query shuffler size
-		dw comapi_shufraw	; 0024 cleanup, shuffle and boot raw
+		dw comapi_err		; 0024 cleanup, shuffle and boot raw
 		dw comapi_err		; 0025 initialize adv structure
 int22_count	equ ($-int22_table)/2
 
diff --git a/core/diskboot.inc b/core/diskboot.inc
index ce75b8c..9dea6f9 100644
--- a/core/diskboot.inc
+++ b/core/diskboot.inc
@@ -29,6 +29,7 @@
 ;
 
 		global StackBuf, PartInfo, Hidden, OrigESDI, DriveNumber
+		global OrigFDCTabPtr
 StackBuf	equ STACK_TOP-44-92	; Start the stack here (grow down - 4K)
 PartInfo	equ StackBuf
 .mbr		equ PartInfo
diff --git a/core/include/bios.h b/core/include/bios.h
index 0a68f5d..a9f4ef1 100644
--- a/core/include/bios.h
+++ b/core/include/bios.h
@@ -88,7 +88,6 @@ extern char *SerialHead;
 extern char *SerialTail;
 
 extern void bios_init(void);
-extern void bios_cleanup_hardware(void);
 
 static inline uint16_t get_serial_port(uint16_t port)
 {
diff --git a/core/isolinux.asm b/core/isolinux.asm
index f151261..94a5b0b 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -1236,3 +1236,7 @@ KernelName	resb FILENAME_MAX	; Mangled name for kernel
 
 		section .data16
 err_disk_image	db 'Cannot load disk image (invalid file)?', CR, LF, 0
+
+		section .bss16
+		global OrigFDCTabPtr
+OrigFDCTabPtr	dd 0			; Keep bios_cleanup_hardware() honest
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index f4c52c2..029e400 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -575,3 +575,7 @@ syslinux_banner	db CR, LF, MY_NAME, ' ', VERSION_STR, ' ', MY_TYPE, ' '
 		section .data16
                 global KeepPXE
 KeepPXE		db 0			; Should PXE be kept around?
+
+		section .bss16
+		global OrigFDCTabPtr
+OrigFDCTabPtr	dd 0			; Keep bios_cleanup_hardware() honest


More information about the Syslinux-commits mailing list