void __constructor __syslinux_get_derivative_info(void)
{
- com32sys_t *const r = &__syslinux_derivative_info.rr.r;
-
- r->eax.w[0] = 0x000A;
- __intcall(0x22, r, r);
-
- __syslinux_derivative_info.r.esbx = MK_PTR(r->es, r->ebx.w[0]);
- __syslinux_derivative_info.r.fssi = MK_PTR(r->fs, r->esi.w[0]);
- __syslinux_derivative_info.r.gsdi = MK_PTR(r->gs, r->edi.w[0]);
+ get_derivative_info(&__syslinux_derivative_info);
}
COBJ := $(patsubst %.c,%.o,$(CSRC))
SOBJ := $(patsubst %.S,%.o,$(SSRC))
-# Don't include console objects
-COBJS = $(filter-out rawcon.o plaincon.o,$(COBJ))
+# Don't include derivative-specific objects
+COBJS = $(filter-out rawcon.o plaincon.o pxelinux-c.o ldlinux-c.o isolinux-c.o,$(COBJ))
LIB = libcom32.a
LIBS = $(LIB) --whole-archive $(com32)/lib/libcom32core.a
$(OBJDUMP) -h $@ > $(@:.elf=.sec)
$(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst)
-libisolinux.a: rawcon.o
+libisolinux.a: rawcon.o isolinux-c.o
rm -f $@
$(AR) cq $@ $^
$(RANLIB) $@
libisolinux-debug.a: libisolinux.a
cp $^ $@
-libpxelinux.a: libisolinux.a
- cp $^ $@
+libpxelinux.a: rawcon.o pxelinux-c.o
+ rm -f $@
+ $(AR) cq $@ $^
+ $(RANLIB) $@
-libldlinux.a: plaincon.o
+libldlinux.a: plaincon.o ldlinux-c.o
rm -f $@
$(AR) cq $@ $^
$(RANLIB) $@
%endif
;
-; INT 22h AX=000Ah Get Derivative-Specific Info
-;
-comapi_derinfo:
- mov P_AL,my_id
-%if IS_PXELINUX
- mov ax,[APIVer]
- mov P_DX,ax
- mov ax,[StrucPtr]
- mov P_BX,ax
- mov ax,[StrucPtr+2]
- mov P_ES,ax
- mov ax,[InitStack]
- mov P_SI,ax
- mov ax,[InitStack+2]
- mov P_FS,ax
- mov eax,[IPInfo.MyIP]
- mov P_ECX,eax
- mov P_GS,0
- mov P_DI,IPInfo
-%else
- ; Physical medium...
-
- mov al,[SectorShift]
- mov P_CL,al
- mov al,[DriveNumber]
- mov P_DL,al
- mov P_FS,cs
- mov P_SI,OrigESDI
- mov P_GS,cs
- mov P_DI,Hidden
-%if IS_SYSLINUX || IS_EXTLINUX
- mov P_ES,cs
- mov P_BX,PartInfo
-%elif IS_ISOLINUX
- mov P_ES,cs
- mov P_BX,spec_packet
- mov ax,[BIOSType]
- sub ax,bios_cdrom
- shr ax,2
- mov P_CH,al ; Mode (el torito/cbios/ebios)
-%endif
-%endif
- clc
- ret
-
-;
; INT 22h AX=000Bh Get Serial Console Configuration
;
comapi_serialcfg:
dw comapi_read ; 0007 read file
dw comapi_close ; 0008 close file
dw comapi_pxecall ; 0009 call PXE stack
- dw comapi_derinfo ; 000A derivative-specific info
+ dw comapi_err ; 000A derivative-specific info
dw comapi_serialcfg ; 000B get serial port config
dw comapi_cleanup ; 000C perform final cleanup
dw comapi_err ; 000D clean up then bootstrap
; reduce the code size...
;
- global StackBuf
+ global StackBuf, PartInfo, Hidden, OrigESDI, DriveNumber
StackBuf equ STACK_TOP-44-92 ; Start the stack here (grow down - 4K)
PartInfo equ StackBuf
.mbr equ PartInfo
const struct bootp_t *dhcp = (const struct bootp_t *)pkt;
int opt_len;
- IPInfo.ipv4 = 4; /* This is IPv4 only for now... */
+ IPInfo.ipver = 4; /* This is IPv4 only for now... */
over_load = 0;
if (ip_ok(dhcp->yip))
#define PXE_H
#include <syslinux/pxe_api.h>
+#include <syslinux/config.h>
#include "fs.h" /* For MAX_OPEN, should go away */
/*
#define PVT(i) ((struct pxe_pvt_inode *)((i)->pvt))
/*
- * Network boot information
- */
-struct ip_info {
- uint32_t ipv4;
- uint32_t myip;
- uint32_t serverip;
- uint32_t gateway;
- uint32_t netmask;
-};
-
-/*
* Variable externs
*/
-extern struct ip_info IPInfo;
+extern struct syslinux_ipinfo IPInfo;
extern uint8_t MAC[];
extern char BOOTIFStr[];
void pm_close_file(com32sys_t *);
int open_config(void);
+extern uint16_t SectorShift;
+
/* chdir.c */
void pm_realpath(com32sys_t *regs);
size_t realpath(char *dst, const char *src, size_t bufsize);
--- /dev/null
+#include <syslinux/config.h>
+#include <com32.h>
+#include <fs.h>
+
+extern far_ptr_t OrigESDI;
+extern uint64_t Hidden;
+extern uint16_t BIOSType;
+extern uint16_t bios_cdrom;
+extern uint8_t DriveNumber;
+extern uint8_t spec_packet;
+
+void get_derivative_info(union syslinux_derivative_info *di)
+{
+ di->iso.filesystem = SYSLINUX_FS_ISOLINUX;
+ di->iso.sector_shift = SectorShift;
+ di->iso.drive_number = DriveNumber;
+ di->iso.cd_mode = (BIOSType - bios_cdrom >> 2);
+
+ di->iso.spec_packet = spec_packet;
+ di->iso.esdi_ptr = GET_PTR(OrigESDI);
+ di->iso.partoffset = Hidden;
+}
GetlinsecPtr resw 1 ; The sector-read pointer
BIOSName resw 1 ; Display string for BIOS type
%define HAVE_BIOSNAME 1
+ global BIOSType
BIOSType resw 1
DiskError resb 1 ; Error code for disk I/O
+ global DriveNumber
DriveNumber resb 1 ; CD-ROM BIOS drive number
ISOFlags resb 1 ; Flags for ISO directory search
RetryCount resb 1 ; Used for disk access retries
alignb 8
+ global Hidden
Hidden resq 1 ; Used in hybrid mode
bsSecPerTrack resw 1 ; Used in hybrid mode
bsHeads resw 1 ; Used in hybrid mode
alignb 8
_spec_start equ $
+ global spec_packet
spec_packet: resb 1 ; Size of packet
sp_media: resb 1 ; Media type
sp_drive: resb 1 ; Drive number
StackBuf equ STACK_TOP-44 ; 44 bytes needed for
; the bootsector chainloading
; code!
+ global OrigESDI
OrigESDI equ StackBuf-4 ; The high dword on the stack
StackHome equ OrigESDI
%endif
alignz 4
+ global bios_cdrom
bios_cdrom: dw getlinsec_cdrom, bios_cdrom_str
%ifndef DEBUG_MESSAGES
bios_cbios: dw getlinsec_cbios, bios_cbios_str
--- /dev/null
+#include <syslinux/config.h>
+#include <com32.h>
+#include <fs.h>
+
+extern uint8_t DriveNumber;
+extern far_ptr_t PartInfo;
+extern far_ptr_t OrigESDI;
+extern uint64_t Hidden;
+
+void get_derivative_info(union syslinux_derivative_info *di)
+{
+ di->disk.filesystem = SYSLINUX_FS_SYSLINUX;
+ di->disk.sector_shift = SectorShift;
+ di->disk.drive_number = DriveNumber;
+
+ di->disk.ptab_ptr = GET_PTR(PartInfo);
+ di->disk.esdi_ptr = GET_PTR(OrigESDI);
+ di->disk.partoffset = Hidden;
+}
--- /dev/null
+#include <syslinux/config.h>
+#include <com32.h>
+
+extern far_ptr_t StrucPtr;
+extern far_ptr_t InitStack;
+
+/*
+ * IP information. Note that the field are in the same order as the
+ * Linux kernel expects in the ip= option.
+ */
+struct syslinux_ipinfo IPInfo;
+uint16_t APIVer; /* PXE API version found */
+
+void get_derivative_info(union syslinux_derivative_info *di)
+{
+ di->pxe.filesystem = SYSLINUX_FS_PXELINUX;
+ di->pxe.apiver = APIVer;
+ di->pxe.pxenvptr = GET_PTR(StrucPtr);
+ di->pxe.stack = GET_PTR(InitStack);
+ di->pxe.ipinfo = &IPInfo;
+ di->pxe.myip = IPInfo.myip;
+}
PXEStack resd 1 ; Saved stack during PXE call
alignb 4
- global DHCPMagic, RebootTime, APIVer
+ global DHCPMagic, RebootTime, StrucPtr
RebootTime resd 1 ; Reboot timeout, if set by option
StrucPtr resw 2 ; Pointer to PXENV+ or !PXE structure
-APIVer resw 1 ; PXE API version found
LocalBootType resw 1 ; Local boot return code
DHCPMagic resb 1 ; PXELINUX magic flags
section .data16
global KeepPXE
KeepPXE db 0 ; Should PXE be kept around?
-
-;
-; IP information. Note that the field are in the same order as the
-; Linux kernel expects in the ip= option.
-;
- section .bss16
- alignb 4
- global IPInfo
-IPInfo:
-.IPv4 resd 1 ; IPv4 information
-.MyIP resd 1 ; My IP address
-.ServerIP resd 1
-.GatewayIP resd 1
-.Netmask resd 1
# Don't include console objects
CORE_OBJS = $(filter-out $(core)/hello.o $(core)/rawcon.o \
$(core)/plaincon.o $(core)/strcasecmp.o $(core)/bios.o \
- $(core)/fs/diskio_bios.o,$(CORE_COBJ))
+ $(core)/fs/diskio_bios.o $(core)/ldlinux-c.o $(core)/isolinux-c.o \
+ $(core)/pxelinux-c.o,$(CORE_COBJ))
LIB_OBJS = $(addprefix $(com32)/lib/,$(CORELIBOBJS))
CSRC = $(wildcard *.c)
--- /dev/null
+/*
+ * We don't have separate boot loader derivatives under EFI, rather,
+ * the derivative info reflects the capabilities of the machine. For
+ * instance, if we have the PXE Base Code Protocol, then we support
+ * PXELINUX, if we have the Disk I/O Protocol, we support SYSLINUX,
+ * etc.
+ */
+#include <syslinux/config.h>
+
+/*
+ * IP information. Note that the field are in the same order as the
+ * Linux kernel expects in the ip= option.
+ */
+struct syslinux_ipinfo IPInfo;
+uint16_t APIVer; /* PXE API version found */
+
+void get_derivative_info(union syslinux_derivative_info *di)
+{
+ di->disk.filesystem = SYSLINUX_FS_SYSLINUX;
+}
uint32_t reserved[10]; /* Currently unused */
} iso_boot_info;
-struct ip_info {
- uint32_t ipv4;
- uint32_t myip;
- uint32_t serverip;
- uint32_t gateway;
- uint32_t netmask;
-} IPInfo;
-
uint8_t DHCPMagic;
uint32_t RebootTime;
uint16_t BIOS_fbm = 1;
far_ptr_t InitStack;
char StackBuf[4096];
-uint16_t APIVer;
far_ptr_t PXEEntry;
unsigned int __bcopyxx_len = 0;