mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 16:26:02 +00:00
[FREELDR]
Major header cleanup svn path=/trunk/; revision=52175
This commit is contained in:
parent
1e26146dfd
commit
a3dee99b18
15 changed files with 217 additions and 408 deletions
|
@ -20,8 +20,7 @@
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
#define HEX(y) 0x##y
|
#define HEX(y) 0x##y
|
||||||
|
|
||||||
#define ASM
|
#include <arch/pc/x86common.h>
|
||||||
#include <arch.h>
|
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
|
|
||||||
.code16
|
.code16
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
.text
|
.text
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
#define ASM
|
#include <arch/pc/x86common.h>
|
||||||
#include <arch.h>
|
|
||||||
|
|
||||||
/* Only these flags are propagated into Int386() */
|
/* Only these flags are propagated into Int386() */
|
||||||
#define FLAGS_PROP (I386FLAG_CF | \
|
#define FLAGS_PROP (I386FLAG_CF | \
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#include <ntoskrnl.h>
|
#include <ntoskrnl.h>
|
||||||
#define NDEBUG
|
|
||||||
#include <arch.h>
|
/* For KeStallExecutionProcessor */
|
||||||
|
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||||
|
#include <arch/pc/pcbios.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -75,6 +78,7 @@ NTAPI
|
||||||
KeStallExecutionProcessor(
|
KeStallExecutionProcessor(
|
||||||
IN ULONG MicroSeconds)
|
IN ULONG MicroSeconds)
|
||||||
{
|
{
|
||||||
|
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||||
REGS Regs;
|
REGS Regs;
|
||||||
ULONG usec_this;
|
ULONG usec_this;
|
||||||
|
|
||||||
|
@ -111,4 +115,7 @@ KeStallExecutionProcessor(
|
||||||
|
|
||||||
MicroSeconds -= usec_this;
|
MicroSeconds -= usec_this;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#error unimplemented
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,181 +0,0 @@
|
||||||
/*
|
|
||||||
* FreeLoader
|
|
||||||
* Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ASM__
|
|
||||||
#pragma once
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HEX
|
|
||||||
#define HEX(y) 0x##y
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _M_AMD64
|
|
||||||
#include <arch/amd64/amd64.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined (_M_IX86)
|
|
||||||
/* Defines needed for switching between real and protected mode */
|
|
||||||
#define NULL_DESC HEX(00) /* NULL descriptor */
|
|
||||||
#define PMODE_CS HEX(08) /* PMode code selector, base 0 limit 4g */
|
|
||||||
#define PMODE_DS HEX(10) /* PMode data selector, base 0 limit 4g */
|
|
||||||
#define RMODE_CS HEX(18) /* RMode code selector, base 0 limit 64k */
|
|
||||||
#define RMODE_DS HEX(20) /* RMode data selector, base 0 limit 64k */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CR0_PE_SET HEX(00000001) /* OR this value with CR0 to enable pmode */
|
|
||||||
#define CR0_PE_CLR HEX(FFFFFFFE) /* AND this value with CR0 to disable pmode */
|
|
||||||
|
|
||||||
#define STACK16ADDR HEX(7000) /* The 16-bit stack top will be at 0000:7000 */
|
|
||||||
#define STACK32ADDR HEX(78000) /* The 32-bit stack top will be at 7000:8000, or 0x78000 */
|
|
||||||
|
|
||||||
#if defined (_M_IX86) || defined (_M_AMD64)
|
|
||||||
#define BIOSCALLBUFFER 0x78000 /* Buffer to store temporary data for any Int386() call */
|
|
||||||
#define BIOSCALLBUFSEGMENT 0x7800 /* Buffer to store temporary data for any Int386() call */
|
|
||||||
#define BIOSCALLBUFOFFSET 0x0000 /* Buffer to store temporary data for any Int386() call */
|
|
||||||
#define FILESYSBUFFER 0x80000 /* Buffer to store file system data (e.g. cluster buffer for FAT) */
|
|
||||||
#define DISKREADBUFFER 0x90000 /* Buffer to store data read in from the disk via the BIOS */
|
|
||||||
#define DISKREADBUFFER_SIZE 512
|
|
||||||
#elif defined(_M_PPC) || defined(_M_MIPS)
|
|
||||||
#define DISKREADBUFFER 0x80000000
|
|
||||||
#define FILESYSBUFFER 0x80000000
|
|
||||||
#elif defined(_M_ARM)
|
|
||||||
extern ULONG gDiskReadBuffer, gFileSysBuffer;
|
|
||||||
#define DISKREADBUFFER gDiskReadBuffer
|
|
||||||
#define FILESYSBUFFER gFileSysBuffer
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Makes "x" a global variable or label */
|
|
||||||
#define EXTERN(x) .global x; x:
|
|
||||||
|
|
||||||
|
|
||||||
// Flag Masks
|
|
||||||
#define I386FLAG_CF HEX(0001) // Carry Flag
|
|
||||||
#define I386FLAG_RESV1 HEX(0002) // Reserved - Must be 1
|
|
||||||
#define I386FLAG_PF HEX(0004) // Parity Flag
|
|
||||||
#define I386FLAG_RESV2 HEX(0008) // Reserved - Must be 0
|
|
||||||
#define I386FLAG_AF HEX(0010) // Auxiliary Flag
|
|
||||||
#define I386FLAG_RESV3 HEX(0020) // Reserved - Must be 0
|
|
||||||
#define I386FLAG_ZF HEX(0040) // Zero Flag
|
|
||||||
#define I386FLAG_SF HEX(0080) // Sign Flag
|
|
||||||
#define I386FLAG_TF HEX(0100) // Trap Flag (Single Step)
|
|
||||||
#define I386FLAG_IF HEX(0200) // Interrupt Flag
|
|
||||||
#define I386FLAG_DF HEX(0400) // Direction Flag
|
|
||||||
#define I386FLAG_OF HEX(0800) // Overflow Flag
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef __ASM__
|
|
||||||
|
|
||||||
#include <pshpack1.h>
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned long eax;
|
|
||||||
unsigned long ebx;
|
|
||||||
unsigned long ecx;
|
|
||||||
unsigned long edx;
|
|
||||||
|
|
||||||
unsigned long esi;
|
|
||||||
unsigned long edi;
|
|
||||||
|
|
||||||
unsigned short ds;
|
|
||||||
unsigned short es;
|
|
||||||
unsigned short fs;
|
|
||||||
unsigned short gs;
|
|
||||||
|
|
||||||
unsigned long eflags;
|
|
||||||
|
|
||||||
} DWORDREGS;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned short ax, _upper_ax;
|
|
||||||
unsigned short bx, _upper_bx;
|
|
||||||
unsigned short cx, _upper_cx;
|
|
||||||
unsigned short dx, _upper_dx;
|
|
||||||
|
|
||||||
unsigned short si, _upper_si;
|
|
||||||
unsigned short di, _upper_di;
|
|
||||||
|
|
||||||
unsigned short ds;
|
|
||||||
unsigned short es;
|
|
||||||
unsigned short fs;
|
|
||||||
unsigned short gs;
|
|
||||||
|
|
||||||
unsigned short flags, _upper_flags;
|
|
||||||
|
|
||||||
} WORDREGS;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned char al;
|
|
||||||
unsigned char ah;
|
|
||||||
unsigned short _upper_ax;
|
|
||||||
unsigned char bl;
|
|
||||||
unsigned char bh;
|
|
||||||
unsigned short _upper_bx;
|
|
||||||
unsigned char cl;
|
|
||||||
unsigned char ch;
|
|
||||||
unsigned short _upper_cx;
|
|
||||||
unsigned char dl;
|
|
||||||
unsigned char dh;
|
|
||||||
unsigned short _upper_dx;
|
|
||||||
|
|
||||||
unsigned short si, _upper_si;
|
|
||||||
unsigned short di, _upper_di;
|
|
||||||
|
|
||||||
unsigned short ds;
|
|
||||||
unsigned short es;
|
|
||||||
unsigned short fs;
|
|
||||||
unsigned short gs;
|
|
||||||
|
|
||||||
unsigned short flags, _upper_flags;
|
|
||||||
|
|
||||||
} BYTEREGS;
|
|
||||||
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
DWORDREGS x;
|
|
||||||
DWORDREGS d;
|
|
||||||
WORDREGS w;
|
|
||||||
BYTEREGS b;
|
|
||||||
} REGS;
|
|
||||||
#include <poppack.h>
|
|
||||||
|
|
||||||
// Int386()
|
|
||||||
//
|
|
||||||
// Real mode interrupt vector interface
|
|
||||||
//
|
|
||||||
// (E)FLAGS can *only* be returned by this function, not set.
|
|
||||||
// Make sure all memory pointers are in SEG:OFFS format and
|
|
||||||
// not linear addresses, unless the interrupt handler
|
|
||||||
// specifically handles linear addresses.
|
|
||||||
int Int386(int ivec, REGS* in, REGS* out);
|
|
||||||
|
|
||||||
// This macro tests the Carry Flag
|
|
||||||
// If CF is set then the call failed (usually)
|
|
||||||
#define INT386_SUCCESS(regs) ((regs.x.eflags & I386FLAG_CF) == 0)
|
|
||||||
|
|
||||||
void EnableA20(void);
|
|
||||||
|
|
||||||
VOID ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S
|
|
||||||
VOID SoftReboot(VOID); // Implemented in boot.S
|
|
||||||
|
|
||||||
VOID DetectHardware(VOID); // Implemented in hardware.c
|
|
||||||
|
|
||||||
#endif /* ! __ASM__ */
|
|
|
@ -56,11 +56,7 @@
|
||||||
#ifndef ASM
|
#ifndef ASM
|
||||||
|
|
||||||
VOID FrLdrSetupGdtIdt(VOID);
|
VOID FrLdrSetupGdtIdt(VOID);
|
||||||
|
#define MachInit PcMachInit
|
||||||
#include <arch/i386/realmode.h>
|
|
||||||
#define FrldrBootDrive *((PULONG)BSS_BootDrive)
|
|
||||||
#define FrldrBootPartition *((PULONG)BSS_BootPartition)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
* FreeLoader
|
|
||||||
*
|
|
||||||
* Copyright (C) 2003 Eric Kohl
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef __REGISTRY_H
|
|
||||||
#include "../../reactos/registry.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CONFIG_CMD(bus, dev_fn, where) \
|
|
||||||
(0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Static heap for ARC Hardware Component Tree
|
|
||||||
// 16KB oughta be enough for anyone.
|
|
||||||
//
|
|
||||||
#define HW_MAX_ARC_HEAP_SIZE 16 * 1024
|
|
||||||
|
|
||||||
//
|
|
||||||
// ARC Component Configuration Routines
|
|
||||||
//
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
FldrCreateSystemKey(
|
|
||||||
OUT PCONFIGURATION_COMPONENT_DATA *SystemKey
|
|
||||||
);
|
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
FldrCreateComponentKey(
|
|
||||||
IN PCONFIGURATION_COMPONENT_DATA SystemKey,
|
|
||||||
IN CONFIGURATION_CLASS Class,
|
|
||||||
IN CONFIGURATION_TYPE Type,
|
|
||||||
IN IDENTIFIER_FLAG Flags,
|
|
||||||
IN ULONG Key,
|
|
||||||
IN ULONG Affinity,
|
|
||||||
IN PCHAR IdentifierString,
|
|
||||||
IN PCM_PARTIAL_RESOURCE_LIST ResourceList,
|
|
||||||
IN ULONG Size,
|
|
||||||
OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey
|
|
||||||
);
|
|
||||||
|
|
||||||
/* PROTOTYPES ***************************************************************/
|
|
||||||
|
|
||||||
/* hardware.c */
|
|
||||||
|
|
||||||
VOID StallExecutionProcessor(ULONG Microseconds);
|
|
||||||
|
|
||||||
VOID HalpCalibrateStallExecution(VOID);
|
|
||||||
|
|
||||||
/* hwacpi.c */
|
|
||||||
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
|
|
||||||
|
|
||||||
/* hwapm.c */
|
|
||||||
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
|
|
||||||
|
|
||||||
/* hwpci.c */
|
|
||||||
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber);
|
|
||||||
|
|
||||||
/* i386cpu.S */
|
|
||||||
ULONG CpuidSupported(VOID);
|
|
||||||
VOID GetCpuid(ULONG Level,
|
|
||||||
ULONG *eax,
|
|
||||||
ULONG *ebx,
|
|
||||||
ULONG *ecx,
|
|
||||||
ULONG *edx);
|
|
||||||
ULONGLONG RDTSC(VOID);
|
|
||||||
|
|
||||||
/* i386pnp.S */
|
|
||||||
ULONG_PTR PnpBiosSupported(VOID);
|
|
||||||
ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize,
|
|
||||||
ULONG *NodeCount);
|
|
||||||
ULONG PnpBiosGetDeviceNode(UCHAR *NodeId,
|
|
||||||
UCHAR *NodeBuffer);
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -1,62 +0,0 @@
|
||||||
/* $Id: machpc.h 32135 2008-02-05 11:13:17Z ros-arm-bringup $
|
|
||||||
*
|
|
||||||
* FreeLoader
|
|
||||||
*
|
|
||||||
* Copyright (C) 2003 Eric Kohl
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef __MEMORY_H
|
|
||||||
#include "mm.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MachInit PcMachInit
|
|
||||||
VOID PcMachInit(const char *CmdLine);
|
|
||||||
|
|
||||||
VOID PcConsPutChar(int Ch);
|
|
||||||
BOOLEAN PcConsKbHit(VOID);
|
|
||||||
int PcConsGetCh(VOID);
|
|
||||||
|
|
||||||
VOID PcVideoClearScreen(UCHAR Attr);
|
|
||||||
VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init);
|
|
||||||
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth);
|
|
||||||
ULONG PcVideoGetBufferSize(VOID);
|
|
||||||
VOID PcVideoSetTextCursorPosition(ULONG X, ULONG Y);
|
|
||||||
VOID PcVideoHideShowTextCursor(BOOLEAN Show);
|
|
||||||
VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y);
|
|
||||||
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer);
|
|
||||||
BOOLEAN PcVideoIsPaletteFixed(VOID);
|
|
||||||
VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue);
|
|
||||||
VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue);
|
|
||||||
VOID PcVideoSync(VOID);
|
|
||||||
VOID PcVideoPrepareForReactOS(IN BOOLEAN Setup);
|
|
||||||
VOID PcPrepareForReactOS(IN BOOLEAN Setup);
|
|
||||||
|
|
||||||
ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize);
|
|
||||||
|
|
||||||
BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size);
|
|
||||||
BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer);
|
|
||||||
BOOLEAN PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry);
|
|
||||||
BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry);
|
|
||||||
ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber);
|
|
||||||
|
|
||||||
TIMEINFO* PcGetTime(VOID);
|
|
||||||
|
|
||||||
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID);
|
|
||||||
|
|
||||||
/* EOF */
|
|
|
@ -35,3 +35,7 @@ extern ULONG SecondLevelDcacheSize;
|
||||||
extern ULONG SecondLevelDcacheFillSize;
|
extern ULONG SecondLevelDcacheFillSize;
|
||||||
extern ULONG SecondLevelIcacheSize;
|
extern ULONG SecondLevelIcacheSize;
|
||||||
extern ULONG SecondLevelIcacheFillSize;
|
extern ULONG SecondLevelIcacheFillSize;
|
||||||
|
|
||||||
|
extern ULONG gDiskReadBuffer, gFileSysBuffer;
|
||||||
|
#define DISKREADBUFFER gDiskReadBuffer
|
||||||
|
#define FILESYSBUFFER gFileSysBuffer
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
/* These addresses specify the realmode "BSS section" */
|
|
||||||
#define BSS_START HEX(7000)
|
|
||||||
#define BSS_CallbackAddress BSS_START + 0
|
|
||||||
#define BSS_CallbackReturn BSS_START + 8
|
|
||||||
#define BSS_BootDrive BSS_START + 16
|
|
||||||
#define BSS_BootPartition BSS_START + 20
|
|
||||||
|
|
||||||
#define PE_LOAD_BASE HEX(9000)
|
|
||||||
#define IMAGE_DOS_HEADER_e_lfanew 36
|
|
||||||
#define IMAGE_FILE_HEADER_SIZE 20
|
|
||||||
#define IMAGE_OPTIONAL_HEADER_AddressOfEntryPoint 16
|
|
|
@ -20,10 +20,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef __REGISTRY_H
|
|
||||||
#include "../../reactos/registry.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CONFIG_CMD(bus, dev_fn, where) \
|
#define CONFIG_CMD(bus, dev_fn, where) \
|
||||||
(0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
|
(0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3))
|
||||||
|
|
||||||
|
@ -85,7 +81,7 @@ VOID GetCpuid(ULONG Level,
|
||||||
ULONGLONG RDTSC(VOID);
|
ULONGLONG RDTSC(VOID);
|
||||||
|
|
||||||
/* i386pnp.S */
|
/* i386pnp.S */
|
||||||
ULONG PnpBiosSupported(VOID);
|
ULONG_PTR PnpBiosSupported(VOID);
|
||||||
ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize,
|
ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize,
|
||||||
ULONG *NodeCount);
|
ULONG *NodeCount);
|
||||||
ULONG PnpBiosGetDeviceNode(UCHAR *NodeId,
|
ULONG PnpBiosGetDeviceNode(UCHAR *NodeId,
|
98
reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h
Normal file
98
reactos/boot/freeldr/freeldr/include/arch/pc/pcbios.h
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
#ifndef __ASM__
|
||||||
|
|
||||||
|
#include <pshpack1.h>
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned long eax;
|
||||||
|
unsigned long ebx;
|
||||||
|
unsigned long ecx;
|
||||||
|
unsigned long edx;
|
||||||
|
|
||||||
|
unsigned long esi;
|
||||||
|
unsigned long edi;
|
||||||
|
|
||||||
|
unsigned short ds;
|
||||||
|
unsigned short es;
|
||||||
|
unsigned short fs;
|
||||||
|
unsigned short gs;
|
||||||
|
|
||||||
|
unsigned long eflags;
|
||||||
|
|
||||||
|
} DWORDREGS;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned short ax, _upper_ax;
|
||||||
|
unsigned short bx, _upper_bx;
|
||||||
|
unsigned short cx, _upper_cx;
|
||||||
|
unsigned short dx, _upper_dx;
|
||||||
|
|
||||||
|
unsigned short si, _upper_si;
|
||||||
|
unsigned short di, _upper_di;
|
||||||
|
|
||||||
|
unsigned short ds;
|
||||||
|
unsigned short es;
|
||||||
|
unsigned short fs;
|
||||||
|
unsigned short gs;
|
||||||
|
|
||||||
|
unsigned short flags, _upper_flags;
|
||||||
|
|
||||||
|
} WORDREGS;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
unsigned char al;
|
||||||
|
unsigned char ah;
|
||||||
|
unsigned short _upper_ax;
|
||||||
|
unsigned char bl;
|
||||||
|
unsigned char bh;
|
||||||
|
unsigned short _upper_bx;
|
||||||
|
unsigned char cl;
|
||||||
|
unsigned char ch;
|
||||||
|
unsigned short _upper_cx;
|
||||||
|
unsigned char dl;
|
||||||
|
unsigned char dh;
|
||||||
|
unsigned short _upper_dx;
|
||||||
|
|
||||||
|
unsigned short si, _upper_si;
|
||||||
|
unsigned short di, _upper_di;
|
||||||
|
|
||||||
|
unsigned short ds;
|
||||||
|
unsigned short es;
|
||||||
|
unsigned short fs;
|
||||||
|
unsigned short gs;
|
||||||
|
|
||||||
|
unsigned short flags, _upper_flags;
|
||||||
|
|
||||||
|
} BYTEREGS;
|
||||||
|
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
DWORDREGS x;
|
||||||
|
DWORDREGS d;
|
||||||
|
WORDREGS w;
|
||||||
|
BYTEREGS b;
|
||||||
|
} REGS;
|
||||||
|
#include <poppack.h>
|
||||||
|
|
||||||
|
// Int386()
|
||||||
|
//
|
||||||
|
// Real mode interrupt vector interface
|
||||||
|
//
|
||||||
|
// (E)FLAGS can *only* be returned by this function, not set.
|
||||||
|
// Make sure all memory pointers are in SEG:OFFS format and
|
||||||
|
// not linear addresses, unless the interrupt handler
|
||||||
|
// specifically handles linear addresses.
|
||||||
|
int Int386(int ivec, REGS* in, REGS* out);
|
||||||
|
|
||||||
|
// This macro tests the Carry Flag
|
||||||
|
// If CF is set then the call failed (usually)
|
||||||
|
#define INT386_SUCCESS(regs) ((regs.x.eflags & I386FLAG_CF) == 0)
|
||||||
|
|
||||||
|
void EnableA20(void);
|
||||||
|
VOID ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S
|
||||||
|
VOID SoftReboot(VOID); // Implemented in boot.S
|
||||||
|
VOID DetectHardware(VOID); // Implemented in hardware.c
|
||||||
|
|
||||||
|
#endif /* ! __ASM__ */
|
57
reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
Normal file
57
reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
#ifndef HEX
|
||||||
|
#define HEX(y) 0x##y
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Memory layout */
|
||||||
|
#define STACK16ADDR HEX(7000) /* The 16-bit stack top will be at 0000:7000 */
|
||||||
|
#define BSS_START HEX(7000)
|
||||||
|
#define FREELDR_BASE HEX(8000)
|
||||||
|
#define FREELDR_PE_BASE HEX(9000)
|
||||||
|
#define STACK32ADDR HEX(78000) /* The 32-bit stack top will be at 7000:8000, or 0x78000 */
|
||||||
|
#define BIOSCALLBUFFER HEX(78000) /* Buffer to store temporary data for any Int386() call */
|
||||||
|
#define BIOSCALLBUFSEGMENT HEX(7800) /* Buffer to store temporary data for any Int386() call */
|
||||||
|
#define BIOSCALLBUFOFFSET HEX(0000) /* Buffer to store temporary data for any Int386() call */
|
||||||
|
#define FILESYSBUFFER HEX(80000) /* Buffer to store file system data (e.g. cluster buffer for FAT) */
|
||||||
|
#define DISKREADBUFFER HEX(90000) /* Buffer to store data read in from the disk via the BIOS */
|
||||||
|
#define DISKREADBUFFER_SIZE 512
|
||||||
|
|
||||||
|
/* These addresses specify the realmode "BSS section" layout */
|
||||||
|
#define BSS_CallbackAddress BSS_START + 0
|
||||||
|
#define BSS_CallbackReturn BSS_START + 8
|
||||||
|
#define BSS_BootDrive BSS_START + 16
|
||||||
|
#define BSS_BootPartition BSS_START + 20
|
||||||
|
|
||||||
|
#ifdef _M_AMD64
|
||||||
|
#define FrldrBootDrive *((PULONG)BSS_BootDrive)
|
||||||
|
#define FrldrBootPartition *((PULONG)BSS_BootPartition)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Flag Masks
|
||||||
|
#define I386FLAG_CF HEX(0001) // Carry Flag
|
||||||
|
#define I386FLAG_RESV1 HEX(0002) // Reserved - Must be 1
|
||||||
|
#define I386FLAG_PF HEX(0004) // Parity Flag
|
||||||
|
#define I386FLAG_RESV2 HEX(0008) // Reserved - Must be 0
|
||||||
|
#define I386FLAG_AF HEX(0010) // Auxiliary Flag
|
||||||
|
#define I386FLAG_RESV3 HEX(0020) // Reserved - Must be 0
|
||||||
|
#define I386FLAG_ZF HEX(0040) // Zero Flag
|
||||||
|
#define I386FLAG_SF HEX(0080) // Sign Flag
|
||||||
|
#define I386FLAG_TF HEX(0100) // Trap Flag (Single Step)
|
||||||
|
#define I386FLAG_IF HEX(0200) // Interrupt Flag
|
||||||
|
#define I386FLAG_DF HEX(0400) // Direction Flag
|
||||||
|
#define I386FLAG_OF HEX(0800) // Overflow Flag
|
||||||
|
|
||||||
|
#define CR0_PE_SET HEX(00000001) /* OR this value with CR0 to enable pmode */
|
||||||
|
#define CR0_PE_CLR HEX(FFFFFFFE) /* AND this value with CR0 to disable pmode */
|
||||||
|
|
||||||
|
/* Defines needed for switching between real and protected mode */
|
||||||
|
#ifdef _M_IX86
|
||||||
|
#define NULL_DESC HEX(00) /* NULL descriptor */
|
||||||
|
#define PMODE_CS HEX(08) /* PMode code selector, base 0 limit 4g */
|
||||||
|
#define PMODE_DS HEX(10) /* PMode data selector, base 0 limit 4g */
|
||||||
|
#define RMODE_CS HEX(18) /* RMode code selector, base 0 limit 64k */
|
||||||
|
#define RMODE_DS HEX(20) /* RMode data selector, base 0 limit 64k */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Makes "x" a global variable or label */
|
||||||
|
#define EXTERN(x) .global x; x:
|
|
@ -29,6 +29,7 @@
|
||||||
#define ROUND_UP(n, align) \
|
#define ROUND_UP(n, align) \
|
||||||
ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
|
ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
|
||||||
|
|
||||||
|
/* public headers */
|
||||||
#define NTOSAPI
|
#define NTOSAPI
|
||||||
#define printf TuiPrintf
|
#define printf TuiPrintf
|
||||||
#include <ntddk.h>
|
#include <ntddk.h>
|
||||||
|
@ -45,78 +46,80 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <rosldr.h>
|
#include <rosldr.h>
|
||||||
#include <arcemul.h>
|
|
||||||
#include <arch.h>
|
|
||||||
#include <rtl.h>
|
#include <rtl.h>
|
||||||
|
#include <ntdddisk.h>
|
||||||
|
#include <internal/hal.h>
|
||||||
|
#include <drivers/pci/pci.h>
|
||||||
|
#include <reactos/buildno.h>
|
||||||
|
#include <winerror.h>
|
||||||
|
|
||||||
|
/* internal headers */
|
||||||
|
#include <arcemul.h>
|
||||||
|
#include <bytesex.h>
|
||||||
|
#include <bget.h>
|
||||||
|
#include <cache.h>
|
||||||
|
#include <cmdline.h>
|
||||||
|
#include <comm.h>
|
||||||
#include <disk.h>
|
#include <disk.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <ui.h>
|
|
||||||
#include <multiboot.h>
|
|
||||||
#include <mm.h>
|
|
||||||
#include <cache.h>
|
|
||||||
#include <machine.h>
|
|
||||||
#include <inifile.h>
|
|
||||||
#include <inffile.h>
|
#include <inffile.h>
|
||||||
#include <video.h>
|
#include <inifile.h>
|
||||||
|
#include <keycodes.h>
|
||||||
|
#include <linux.h>
|
||||||
|
#include <machine.h>
|
||||||
|
#include <mm.h>
|
||||||
|
#include <multiboot.h>
|
||||||
|
#include <options.h>
|
||||||
|
#include <oslist.h>
|
||||||
#include <ramdisk.h>
|
#include <ramdisk.h>
|
||||||
#include <reactos.h>
|
#include <reactos.h>
|
||||||
#include <registry.h>
|
#include <registry.h>
|
||||||
|
#include <ui.h>
|
||||||
|
#include <ver.h>
|
||||||
|
#include <video.h>
|
||||||
#include <winldr.h>
|
#include <winldr.h>
|
||||||
#include <ntdddisk.h>
|
|
||||||
#include <internal/hal.h>
|
|
||||||
/* file system headers */
|
/* file system headers */
|
||||||
#include <fs/ext2.h>
|
#include <fs/ext2.h>
|
||||||
#include <fs/fat.h>
|
#include <fs/fat.h>
|
||||||
#include <fs/ntfs.h>
|
#include <fs/ntfs.h>
|
||||||
#include <fs/iso.h>
|
#include <fs/iso.h>
|
||||||
#include <fs/pxe.h>
|
#include <fs/pxe.h>
|
||||||
|
|
||||||
/* ui support */
|
/* ui support */
|
||||||
#include <ui/gui.h>
|
#include <ui/gui.h>
|
||||||
#include <ui/minitui.h>
|
#include <ui/minitui.h>
|
||||||
#include <ui/noui.h>
|
#include <ui/noui.h>
|
||||||
#include <ui/tui.h>
|
#include <ui/tui.h>
|
||||||
/* arch files */
|
|
||||||
|
/* arch specific includes */
|
||||||
#if defined(_M_IX86)
|
#if defined(_M_IX86)
|
||||||
#include <arch/i386/custom.h>
|
#include <arch/i386/custom.h>
|
||||||
#include <arch/i386/drivemap.h>
|
#include <arch/i386/drivemap.h>
|
||||||
#include <arch/i386/hardware.h>
|
|
||||||
#include <arch/i386/i386.h>
|
#include <arch/i386/i386.h>
|
||||||
#include <arch/i386/machpc.h>
|
|
||||||
#include <arch/i386/machxbox.h>
|
#include <arch/i386/machxbox.h>
|
||||||
#include <arch/i386/miscboot.h>
|
#include <arch/i386/miscboot.h>
|
||||||
#include <arch/i386/pxe.h>
|
#include <arch/pc/hardware.h>
|
||||||
|
#include <arch/pc/machpc.h>
|
||||||
|
#include <arch/pc/x86common.h>
|
||||||
|
#include <arch/pc/pcbios.h>
|
||||||
|
#include <arch/pc/pxe.h>
|
||||||
#include <internal/i386/intrin_i.h>
|
#include <internal/i386/intrin_i.h>
|
||||||
|
#elif defined(_M_AMD64)
|
||||||
|
#include <arch/amd64/amd64.h>
|
||||||
|
#include <arch/pc/hardware.h>
|
||||||
|
#include <arch/pc/machpc.h>
|
||||||
|
#include <arch/pc/x86common.h>
|
||||||
|
#include <arch/pc/pcbios.h>
|
||||||
|
#include <arch/pc/pxe.h>
|
||||||
|
#include <internal/amd64/intrin_i.h>
|
||||||
#elif defined(_M_PPC)
|
#elif defined(_M_PPC)
|
||||||
#include <arch/powerpc/hardware.h>
|
#include <arch/powerpc/hardware.h>
|
||||||
#elif defined(_M_ARM)
|
#elif defined(_M_ARM)
|
||||||
#include <arch/arm/hardware.h>
|
#include <arch/arm/hardware.h>
|
||||||
#elif defined(_M_MIPS)
|
#elif defined(_M_MIPS)
|
||||||
#include <arch/mips/arcbios.h>
|
#include <arch/mips/arcbios.h>
|
||||||
#elif defined(_M_AMD64)
|
|
||||||
#include <arch/amd64/hardware.h>
|
|
||||||
#include <arch/amd64/machpc.h>
|
|
||||||
#include <arch/i386/pxe.h>
|
|
||||||
#include <internal/amd64/intrin_i.h>
|
|
||||||
#endif
|
#endif
|
||||||
/* misc files */
|
|
||||||
#include <keycodes.h>
|
|
||||||
#include <ver.h>
|
|
||||||
#include <cmdline.h>
|
|
||||||
#include <bget.h>
|
|
||||||
#include <winerror.h>
|
|
||||||
/* Needed by boot manager */
|
|
||||||
#include <oslist.h>
|
|
||||||
#include <options.h>
|
|
||||||
#include <linux.h>
|
|
||||||
/* Externals */
|
|
||||||
#include <reactos/rossym.h>
|
|
||||||
#include <reactos/buildno.h>
|
|
||||||
/* Needed if debuging is enabled */
|
|
||||||
#include <comm.h>
|
|
||||||
/* Swap */
|
|
||||||
#include <bytesex.h>
|
|
||||||
/* Internal shared PCI header */
|
|
||||||
#include <drivers/pci/pci.h>
|
|
||||||
|
|
||||||
VOID BootMain(LPSTR CmdLine);
|
VOID BootMain(LPSTR CmdLine);
|
||||||
VOID RunLoader(VOID);
|
VOID RunLoader(VOID);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue