aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules
diff options
context:
space:
mode:
authorErwan Velu <erwan.velu@free.fr>2009-11-29 15:20:33 +0100
committerErwan Velu <erwan.velu@free.fr>2009-12-04 10:11:15 +0100
commit2221e0b8b5900d4f3d753ee3ee1bd552db187892 (patch)
treef41b06952185ce2982a2b58e19ec099bc3423af6 /com32/modules
parentadbc06e2c0d4e65b13492a80a6ebc0f3c855cfba (diff)
downloadsyslinux.git-2221e0b8b5900d4f3d753ee3ee1bd552db187892.tar.gz
syslinux.git-2221e0b8b5900d4f3d753ee3ee1bd552db187892.tar.xz
syslinux.git-2221e0b8b5900d4f3d753ee3ee1bd552db187892.zip
com32: Avoid gpxe detection code duplication
Impact: avoid code duplication This will make code more generic, hdt will need it ;)
Diffstat (limited to 'com32/modules')
-rw-r--r--com32/modules/gpxecmd.c53
-rw-r--r--com32/modules/sanboot.c53
2 files changed, 2 insertions, 104 deletions
diff --git a/com32/modules/gpxecmd.c b/com32/modules/gpxecmd.c
index de6ffb21..057659bd 100644
--- a/com32/modules/gpxecmd.c
+++ b/com32/modules/gpxecmd.c
@@ -21,64 +21,13 @@
#include <stdio.h>
#include <console.h>
#include <com32.h>
-#include <stdbool.h>
#include <string.h>
-#include <syslinux/config.h>
+#include <sys/gpxe.h>
struct segoff16 {
uint16_t offs, seg;
};
-struct s_PXENV_FILE_CHECK_API {
- uint16_t Status;
- uint16_t Size;
- uint32_t Magic;
- uint32_t Provider;
- uint32_t APIMask;
- uint32_t Flags;
-};
-
-static bool is_gpxe(void)
-{
- const struct syslinux_version *sv;
- com32sys_t reg;
- struct s_PXENV_FILE_CHECK_API *fca;
-
- sv = syslinux_version();
- if (sv->filesystem != SYSLINUX_FS_PXELINUX)
- return false; /* Not PXELINUX */
-
- fca = __com32.cs_bounce;
- memset(fca, 0, sizeof *fca);
- fca->Size = sizeof *fca;
- fca->Magic = 0x91d447b2;
-
- memset(&reg, 0, sizeof reg);
- reg.eax.w[0] = 0x0009;
- reg.ebx.w[0] = 0x00e6; /* PXENV_FILE_API_CHECK */
- reg.edi.w[0] = OFFS(fca);
- reg.es = SEG(fca);
-
- __intcall(0x22, &reg, &reg);
-
- if (reg.eflags.l & EFLAGS_CF)
- return false; /* Cannot invoke PXE stack */
-
- if (reg.eax.w[0] || fca->Status)
- return false; /* PXE failure */
-
- if (fca->Magic != 0xe9c17b20)
- return false; /* Incorrect magic */
-
- if (fca->Size < sizeof *fca)
- return false; /* Short return */
-
- if (!(fca->APIMask & (1 << 5)))
- return false; /* No FILE EXEC */
-
- return true;
-}
-
struct s_PXENV_FILE_EXEC {
uint16_t Status;
struct segoff16 Command;
diff --git a/com32/modules/sanboot.c b/com32/modules/sanboot.c
index eee9f44c..46df6bc3 100644
--- a/com32/modules/sanboot.c
+++ b/com32/modules/sanboot.c
@@ -21,64 +21,13 @@
#include <stdio.h>
#include <console.h>
#include <com32.h>
-#include <stdbool.h>
#include <string.h>
-#include <syslinux/config.h>
+#include <sys/gpxe.h>
struct segoff16 {
uint16_t offs, seg;
};
-struct s_PXENV_FILE_CHECK_API {
- uint16_t Status;
- uint16_t Size;
- uint32_t Magic;
- uint32_t Provider;
- uint32_t APIMask;
- uint32_t Flags;
-};
-
-static bool is_gpxe(void)
-{
- const struct syslinux_version *sv;
- com32sys_t reg;
- struct s_PXENV_FILE_CHECK_API *fca;
-
- sv = syslinux_version();
- if (sv->filesystem != SYSLINUX_FS_PXELINUX)
- return false; /* Not PXELINUX */
-
- fca = __com32.cs_bounce;
- memset(fca, 0, sizeof *fca);
- fca->Size = sizeof *fca;
- fca->Magic = 0x91d447b2;
-
- memset(&reg, 0, sizeof reg);
- reg.eax.w[0] = 0x0009;
- reg.ebx.w[0] = 0x00e6; /* PXENV_FILE_API_CHECK */
- reg.edi.w[0] = OFFS(fca);
- reg.es = SEG(fca);
-
- __intcall(0x22, &reg, &reg);
-
- if (reg.eflags.l & EFLAGS_CF)
- return false; /* Cannot invoke PXE stack */
-
- if (reg.eax.w[0] || fca->Status)
- return false; /* PXE failure */
-
- if (fca->Magic != 0xe9c17b20)
- return false; /* Incorrect magic */
-
- if (fca->Size < sizeof *fca)
- return false; /* Short return */
-
- if (!(fca->APIMask & (1 << 5)))
- return false; /* No FILE EXEC */
-
- return true;
-}
-
struct s_PXENV_FILE_EXEC {
uint16_t Status;
struct segoff16 Command;