#ifndef __LINUX_H
#define __LINUX_H
-#ifdef __i386__
-#define LINUX_LOADER_TYPE_LILO 0x01
-#define LINUX_LOADER_TYPE_LOADLIN 0x11
-#define LINUX_LOADER_TYPE_BOOTSECT 0x21
-#define LINUX_LOADER_TYPE_SYSLINUX 0x31
-#define LINUX_LOADER_TYPE_ETHERBOOT 0x41
-#define LINUX_LOADER_TYPE_FREELOADER 0x81
+#ifdef _M_IX86
-#define LINUX_COMMAND_LINE_MAGIC 0xA33F
+#define LINUX_LOADER_TYPE_LILO 0x01
+#define LINUX_LOADER_TYPE_LOADLIN 0x11
+#define LINUX_LOADER_TYPE_BOOTSECT 0x21
+#define LINUX_LOADER_TYPE_SYSLINUX 0x31
+#define LINUX_LOADER_TYPE_ETHERBOOT 0x41
+#define LINUX_LOADER_TYPE_FREELOADER 0x81
-#define LINUX_SETUP_HEADER_ID 0x53726448 // 'HdrS'
+#define LINUX_COMMAND_LINE_MAGIC 0xA33F
-#define LINUX_BOOT_SECTOR_MAGIC 0xAA55
+#define LINUX_SETUP_HEADER_ID 0x53726448 // 'HdrS'
-#define LINUX_KERNEL_LOAD_ADDRESS 0x100000
+#define LINUX_BOOT_SECTOR_MAGIC 0xAA55
-#define LINUX_FLAG_LOAD_HIGH 0x01
-#define LINUX_FLAG_CAN_USE_HEAP 0x80
+#define LINUX_KERNEL_LOAD_ADDRESS 0x100000
-#define LINUX_MAX_INITRD_ADDRESS 0x38000000
+#define LINUX_FLAG_LOAD_HIGH 0x01
+#define LINUX_FLAG_CAN_USE_HEAP 0x80
+
+#define LINUX_MAX_INITRD_ADDRESS 0x38000000
#include <pshpack1.h>
typedef struct
{
- UCHAR BootCode1[0x20];
+ UCHAR BootCode1[0x20];
- USHORT CommandLineMagic;
- USHORT CommandLineOffset;
+ USHORT CommandLineMagic;
+ USHORT CommandLineOffset;
- UCHAR BootCode2[0x1CD];
+ UCHAR BootCode2[0x1CD];
- UCHAR SetupSectors;
- USHORT RootFlags;
- USHORT SystemSize;
- USHORT SwapDevice;
- USHORT RamSize;
- USHORT VideoMode;
- USHORT RootDevice;
- USHORT BootFlag; // 0xAA55
+ UCHAR SetupSectors;
+ USHORT RootFlags;
+ USHORT SystemSize;
+ USHORT SwapDevice;
+ USHORT RamSize;
+ USHORT VideoMode;
+ USHORT RootDevice;
+ USHORT BootFlag; // 0xAA55
} LINUX_BOOTSECTOR, *PLINUX_BOOTSECTOR;
typedef struct
{
- UCHAR JumpInstruction[2];
- ULONG SetupHeaderSignature; // Signature for SETUP-header
- USHORT Version; // Version number of header format
- USHORT RealModeSwitch; // Default switch
- USHORT SetupSeg; // SETUPSEG
- USHORT StartSystemSeg;
- USHORT KernelVersion; // Offset to kernel version string
- UCHAR TypeOfLoader; // Loader ID
- // =0, old one (LILO, Loadlin,
- // Bootlin, SYSLX, bootsect...)
- // else it is set by the loader:
- // 0xTV: T=0 for LILO
- // T=1 for Loadlin
- // T=2 for bootsect-loader
- // T=3 for SYSLX
- // T=4 for ETHERBOOT
- // V = version
-
- UCHAR LoadFlags; // flags, unused bits must be zero (RFU)
- // LOADED_HIGH = 1
- // bit within loadflags,
- // if set, then the kernel is loaded high
- // CAN_USE_HEAP = 0x80
- // if set, the loader also has set heap_end_ptr
- // to tell how much space behind setup.S
- // can be used for heap purposes.
- // Only the loader knows what is free!
-
- USHORT SetupMoveSize; // size to move, when we (setup) are not
- // loaded at 0x90000. We will move ourselves
- // to 0x90000 then just before jumping into
- // the kernel. However, only the loader
- // know how much of data behind us also needs
- // to be loaded.
-
- ULONG Code32Start; // here loaders can put a different
- // start address for 32-bit code.
- //
- // 0x1000 = default for zImage
- //
- // 0x100000 = default for big kernel
-
- ULONG RamdiskAddress; // address of loaded ramdisk image
- // Here the loader (or kernel generator) puts
- // the 32-bit address were it loaded the image.
- ULONG RamdiskSize; // its size in bytes
-
- USHORT BootSectKludgeOffset;
- USHORT BootSectKludgeSegment;
- USHORT HeapEnd; // space from here (exclusive) down to
- // end of setup code can be used by setup
- // for local heap purposes.
- USHORT Pad1;
- ULONG CommandLinePointer; // 32-bit pointer to the kernel command line
- ULONG InitrdAddressMax; // Highest legal initrd address
+ UCHAR JumpInstruction[2];
+ ULONG SetupHeaderSignature; // Signature for SETUP-header
+ USHORT Version; // Version number of header format
+ USHORT RealModeSwitch; // Default switch
+ USHORT SetupSeg; // SETUPSEG
+ USHORT StartSystemSeg;
+ USHORT KernelVersion; // Offset to kernel version string
+ UCHAR TypeOfLoader; // Loader ID
+ // =0, old one (LILO, Loadlin,
+ // Bootlin, SYSLX, bootsect...)
+ // else it is set by the loader:
+ // 0xTV: T=0 for LILO
+ // T=1 for Loadlin
+ // T=2 for bootsect-loader
+ // T=3 for SYSLX
+ // T=4 for ETHERBOOT
+ // V = version
+
+ UCHAR LoadFlags; // flags, unused bits must be zero (RFU)
+ // LOADED_HIGH = 1
+ // bit within loadflags,
+ // if set, then the kernel is loaded high
+ // CAN_USE_HEAP = 0x80
+ // if set, the loader also has set heap_end_ptr
+ // to tell how much space behind setup.S
+ // can be used for heap purposes.
+ // Only the loader knows what is free!
+
+ USHORT SetupMoveSize; // size to move, when we (setup) are not
+ // loaded at 0x90000. We will move ourselves
+ // to 0x90000 then just before jumping into
+ // the kernel. However, only the loader
+ // know how much of data behind us also needs
+ // to be loaded.
+
+ ULONG Code32Start; // here loaders can put a different
+ // start address for 32-bit code.
+ //
+ // 0x1000 = default for zImage
+ //
+ // 0x100000 = default for big kernel
+
+ ULONG RamdiskAddress; // address of loaded ramdisk image
+ // Here the loader (or kernel generator) puts
+ // the 32-bit address were it loaded the image.
+ ULONG RamdiskSize; // its size in bytes
+
+ USHORT BootSectKludgeOffset;
+ USHORT BootSectKludgeSegment;
+ USHORT HeapEnd; // space from here (exclusive) down to
+ // end of setup code can be used by setup
+ // for local heap purposes.
+ USHORT Pad1;
+ ULONG CommandLinePointer; // 32-bit pointer to the kernel command line
+ ULONG InitrdAddressMax; // Highest legal initrd address
} LINUX_SETUPSECTOR, *PLINUX_SETUPSECTOR;
#include <poppack.h>
-VOID BootNewLinuxKernel(VOID); // Implemented in linux.S
-VOID BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S
+VOID __cdecl BootNewLinuxKernel(VOID); // Implemented in linux.S
+VOID __cdecl BootOldLinuxKernel(ULONG KernelSize); // Implemented in linux.S
+
+ARC_STATUS
+LoadAndBootLinux(
+ IN ULONG Argc,
+ IN PCHAR Argv[],
+ IN PCHAR Envp[]);
+
+BOOLEAN
+LinuxParseIniSection(
+ IN ULONG Argc,
+ IN PCHAR Argv[]);
-VOID
-LoadAndBootLinux(IN OperatingSystemItem* OperatingSystem,
- IN USHORT OperatingSystemVersion);
+BOOLEAN LinuxReadBootSector(ULONG LinuxKernelFile);
+BOOLEAN LinuxReadSetupSector(ULONG LinuxKernelFile);
+BOOLEAN LinuxReadKernel(ULONG LinuxKernelFile);
+BOOLEAN LinuxCheckKernelVersion(VOID);
+BOOLEAN LinuxReadInitrd(ULONG LinuxInitrdFile);
-BOOLEAN LinuxParseIniSection(PCSTR OperatingSystemName);
-BOOLEAN LinuxReadBootSector(PFILE LinuxKernelFile);
-BOOLEAN LinuxReadSetupSector(PFILE LinuxKernelFile);
-BOOLEAN LinuxReadKernel(PFILE LinuxKernelFile);
-BOOLEAN LinuxCheckKernelVersion(VOID);
-BOOLEAN LinuxReadInitrd(PFILE LinuxInitrdFile);
-#endif /* __i386__ */
+#endif // _M_IX86
#endif // defined __LINUX_H