--- /dev/null
+#ifndef _GPXE_H
+#define _GPXE_H
+
+#include <com32.h>
+
+struct s_PXENV_FILE_CHECK_API {
+ uint16_t Status;
+ uint16_t Size;
+ uint32_t Magic;
+ uint32_t Provider;
+ uint32_t APIMask;
+ uint32_t Flags;
+};
+
+bool is_gpxe(void);
+#endif
\
sys/libansi.o \
\
+ sys/gpxe.o \
+ \
sys/ansicon_write.o sys/ansiserial_write.o \
\
sys/vesacon_write.o sys/vesaserial_write.o \
--- /dev/null
+#include <sys/gpxe.h>
+#include <syslinux/config.h>
+#include <string.h>
+
+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(®, 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, ®, ®);
+
+ 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;
+}
+
#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(®, 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, ®, ®);
-
- 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;
#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(®, 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, ®, ®);
-
- 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;