ReactOS  0.4.12-dev-918-g6c6e7b8
mach.c File Reference
#include "freeldr.h"
#include "machine.h"
#include "ppcmmu/mmu.h"
#include "of.h"
#include "prep.h"
#include "compat.h"
Include dependency graph for mach.c:

Go to the source code of this file.

Functions

void BootMain (LPSTR CmdLine)
 
const PCSTR GetFreeLoaderVersionString (VOID)
 
void PpcOfwPutChar (int ch)
 
int PpcFindDevice (int depth, int parent, char *devname, int *nth)
 
BOOLEAN PpcConsKbHit ()
 
int PpcConsGetCh ()
 
void PpcVideoClearScreen (UCHAR Attr)
 
VOID PpcVideoGetDisplaySize (PULONG Width, PULONG Height, PULONG Depth)
 
ULONG PpcVideoGetBufferSize ()
 
VIDEODISPLAYMODE PpcVideoSetDisplayMode (char *DisplayMode, BOOLEAN Init)
 
VOID PpcVideoSetTextCursorPosition (ULONG X, ULONG Y)
 
VOID PpcVideoHideShowTextCursor (BOOLEAN Show)
 
VOID PpcVideoPutChar (int Ch, UCHAR Attr, unsigned X, unsigned Y)
 
VOID PpcVideoCopyOffScreenBufferToVRAM (PVOID Buffer)
 
BOOLEAN PpcVideoIsPaletteFixed ()
 
VOID PpcVideoSetPaletteColor (UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 
VOID PpcVideoGetPaletteColor (UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
 
VOID PpcVideoSync ()
 
VOID PpcInitializeMmu ()
 
ULONG PpcPrepGetMemoryMap (PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
 
ULONG PpcGetMemoryMap (PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
 
BOOLEAN PpcDiskGetBootPath (PCHAR OutBootPath, ULONG Size)
 
BOOLEAN PpcDiskReadLogicalSectors (ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 
BOOLEAN PpcDiskGetDriveGeometry (ULONG DriveNumber, PGEOMETRY DriveGeometry)
 
ULONG PpcDiskGetCacheableBlockCount (ULONG DriveNumber)
 
TIMEINFOPpcGetTime (VOID)
 
VOID NarrowToWide (WCHAR *wide_name, char *name)
 
VOID OfwCopyDeviceTree (PCONFIGURATION_COMPONENT_DATA ParentKey, char *name, int innode, ULONG *BusNumber, ULONG *DiskController, ULONG *DiskNumber)
 
PCONFIGURATION_COMPONENT_DATA PpcHwDetect ()
 
VOID PpcHwIdle (VOID)
 
void PpcDefaultMachVtbl ()
 
void PpcOfwInit ()
 
void PpcInit (of_proxy the_ofproxy)
 
void MachInit (const char *CmdLine)
 
void beep ()
 
UCHAR NTAPI READ_PORT_UCHAR (PUCHAR Address)
 
void WRITE_PORT_UCHAR (PUCHAR Address, UCHAR Value)
 
void DiskStopFloppyMotor ()
 
void BootOldLinuxKernel (unsigned long size)
 
void BootNewLinuxKernel ()
 
void ChainLoadBiosBootSectorCode ()
 
void DbgBreakPoint ()
 

Variables

ULONG CacheSizeLimit
 
of_proxy ofproxy
 
voidPageDirectoryStart
 
voidPageDirectoryEnd
 
static int chosen_package
 
static int stdin_handle
 
static int stdout_handle
 
static int part_handle = -1
 
int mmu_handle = 0
 
int claimed [4]
 
BOOLEAN AcpiPresent = FALSE
 
char BootPath [0x100] = { 0 }
 
char BootPart [0x100] = { 0 }
 
char CmdLine [0x100] = { "bootprep" }
 
jmp_buf jmp
 
volatile charvideo_mem = 0
 
int mmu_initialized = 0
 
int mem_range_end
 

Function Documentation

◆ beep()

void beep ( )

Definition at line 532 of file mach.c.

532  {
533 }

◆ BootMain()

void BootMain ( LPSTR  CmdLine)

◆ BootNewLinuxKernel()

void BootNewLinuxKernel ( )

Definition at line 550 of file mach.c.

550  {
551  ofw_exit();
552 }

◆ BootOldLinuxKernel()

void BootOldLinuxKernel ( unsigned long  size)

Definition at line 546 of file mach.c.

546  {
547  ofw_exit();
548 }

◆ ChainLoadBiosBootSectorCode()

void ChainLoadBiosBootSectorCode ( )

Definition at line 554 of file mach.c.

554  {
555  ofw_exit();
556 }

◆ DbgBreakPoint()

void DbgBreakPoint ( void  )

Definition at line 558 of file mach.c.

558  {
559  __asm__("twi 31,0,0");
560 }
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")

Referenced by __cxa_pure_virtual(), __declspec(), ARPTransmit(), BaseInitializeContext(), CsrApiRequestThread(), CsrCaptureArguments(), CsrIdentifyAlertableThread(), CsrSetPriorityClass(), CsrShutdownProcesses(), CsrValidateMessageBuffer(), DbgUiRemoteBreakin(), DeviceInterfaceChangeCallback(), Dispatch_fnDeviceIoControl(), DriverEntry(), EHCI_InterruptTransfer(), EHCI_QueryEndpointRequirements(), EHCI_SetAsyncEndpointState(), EHCI_SetEndpointStatus(), EHCI_SubmitTransfer(), EHCI_SuspendController(), ExAllocatePoolWithTag(), ExpInsertPoolTracker(), ExpRemovePoolTracker(), ExpWaitForResource(), FatalExit(), FatCompleteRequest_Real(), FatExceptionFilter(), FatMultiAsyncCompletionRoutine(), FatMultiSyncCompletionRoutine(), FatSingleAsyncCompletionRoutine(), FatSingleSyncCompletionRoutine(), HalClearSoftwareInterrupt(), HalpAddDevice(), HalpGetParameters(), HalpOpcodeInvalid(), HalRequestSoftwareInterrupt(), HalReturnToFirmware(), IKsPin_PinStatePropertyHandler(), KeFlushIoBuffers(), KeStartThread(), KeUpdateRunTime(), KiCheckTimerTable(), KiIpiServiceRoutine(), KsPinAttemptProcessing(), KsStreamPointerAdvance(), KsStreamPointerAdvanceOffsets(), KsStreamPointerAdvanceOffsetsAndUnlock(), KsStreamPointerDelete(), KsStreamPointerGetNextClone(), LdrpInitializeProcess(), LdrpRunInitializeRoutines(), MiSubsectionConsistent(), NdisInitializeWrapper(), NtProcessStartup(), ObInsertObject(), OHCI_InsertEndpointInSchedule(), OHCI_PollAsyncEndpoint(), OHCI_QueryEndpointRequirements(), OHCI_RemoveEndpointFromSchedule(), PciBeginStateTransition(), PciDispatchIrp(), PcRegisterSubdevice(), PinPropertyHandler(), PspCatchCriticalBreak(), Reboot(), RtlApplicationVerifierStop(), RtlAssert(), RtlInterlockedPushListSList(), RtlpDphAllocateVm(), RtlpDphEnterCriticalSection(), RtlpDphFreeVm(), RtlpDphPointerFromHandle(), RtlpDphProtectVm(), RtlpDphRemoveFromAvailableList(), RtlpPageHeapAllocate(), RtlpPageHeapDestroy(), RtlpPageHeapFree(), RxAssert(), SetLastError(), SmpAllocateSessionId(), SmpUnhandledExceptionFilter(), SpiParseDeviceInfo(), StreamClassDebugAssert(), UhciInterruptService(), UhciQueryEndpointRequirements(), UhciRHPortResetComplete(), UhciStopController(), USBH_ChangeIndicationWorker(), USBH_CompletePortWakeIrpsWorker(), USBH_DeviceControl(), USBH_FdoIdleNotificationCallback(), USBH_FdoPower(), USBH_FdoQueryBusRelations(), USBH_FdoStartDevice(), USBH_FdoStopDevice(), USBH_FdoWWIrpIoCompletion(), USBH_FlushPortPwrList(), USBH_HubCompleteQueuedPortIdleIrps(), USBH_HubCompleteQueuedPortWakeIrps(), USBH_HubDispatch(), USBH_HubQueuePortIdleIrps(), USBH_HubQueuePortWakeIrps(), USBH_PdoDispatch(), USBH_PdoInternalControl(), USBH_PdoPnP(), USBH_PdoStopDevice(), USBH_PdoUrbFilter(), USBH_PowerIrpCompletion(), USBH_ProcessPortStateChange(), USBH_SelectConfigOrInterfaceComplete(), USBHUB_IrpStub(), USBPORT_AllocateBandwidthUSB2(), USBPORT_Dispatch(), USBPORT_DmaEndpointWorker(), USBPORT_PdoDevicePowerState(), USBPORT_RestoreDevice(), USBPORT_RootHubClassCommand(), USBPORT_RootHubCreateDevice(), USBPORT_SplitBulkInterruptTransfer(), USBPORT_StopDevice(), UserLoadKbdDll(), WdmAudControlOpenMixer(), and wmain().

◆ DiskStopFloppyMotor()

void DiskStopFloppyMotor ( )

Definition at line 543 of file mach.c.

543  {
544 }

◆ GetFreeLoaderVersionString()

const PCSTR GetFreeLoaderVersionString ( VOID  )

Definition at line 32 of file version.c.

33 {
35 }
static const PCSTR FreeLoaderVersionString
Definition: version.c:25

Referenced by PpcOfwInit(), PpcPrepInit(), and TuiDrawBackdrop().

◆ MachInit()

void MachInit ( const char CmdLine)

Definition at line 491 of file mach.c.

491  {
492  int i, len;
493  char *sep;
494 
495  BootPart[0] = 0;
496  BootPath[0] = 0;
497 
498  printf( "Determining boot device: [%s]\n", CmdLine );
499 
500  sep = NULL;
501  for( i = 0; i < strlen(CmdLine); i++ ) {
502  if( strncmp(CmdLine + i, "boot=", 5) == 0) {
503  strcpy(BootPart, CmdLine + i + 5);
504  sep = strchr(BootPart, ',');
505  if( sep )
506  *sep = 0;
507  while(CmdLine[i] && CmdLine[i]!=',') i++;
508  }
509  }
510 
511  if( strlen(BootPart) == 0 ) {
512  if (ofproxy)
513  len = ofw_getprop(chosen_package, "bootpath",
514  BootPath, sizeof(BootPath));
515  else
516  len = 0;
517  if( len < 0 ) len = 0;
518  BootPath[len] = 0;
519  printf( "Boot Path: %s\n", BootPath );
520 
521  sep = strrchr(BootPath, ',');
522 
524  if( sep ) {
525  BootPart[sep - BootPath] = 0;
526  }
527  }
528 
529  printf( "FreeLDR starting (boot partition: %s)\n", BootPart );
530 }
char CmdLine[0x100]
Definition: mach.c:35
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
GLenum GLsizei len
Definition: glext.h:6722
static int chosen_package
Definition: mach.c:31
of_proxy ofproxy
Definition: mach.c:29
char * strchr(const char *String, int ch)
Definition: utclib.c:501
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
char BootPart[0x100]
Definition: mach.c:35
char BootPath[0x100]
Definition: mach.c:35
#define printf
Definition: config.h:203

◆ NarrowToWide()

VOID NarrowToWide ( WCHAR wide_name,
char name 
)

Definition at line 305 of file mach.c.

306 {
307  char *copy_name;
308  WCHAR *wide_name_ptr;
309  for (wide_name_ptr = wide_name, copy_name = name;
310  (*wide_name_ptr = *copy_name);
311  wide_name_ptr++, copy_name++);
312 }
static BOOL copy_name(const char *ptr, char **name)
Definition: reflection.c:154
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: name.c:36

Referenced by OfwCopyDeviceTree().

◆ OfwCopyDeviceTree()

VOID OfwCopyDeviceTree ( PCONFIGURATION_COMPONENT_DATA  ParentKey,
char name,
int  innode,
ULONG BusNumber,
ULONG DiskController,
ULONG DiskNumber 
)

Definition at line 330 of file mach.c.

336 {
337  int proplen = 0, node = innode;
338  char *prev_name, cur_name[64], data[256], *slash, devtype[64];
339  wchar_t wide_name[64];
341 
342  NarrowToWide(wide_name, name);
343 
344  /* Create a key for this device */
346  (ParentKey,
347  AdapterClass,
348  MultiFunctionAdapter,
349  0,
350  0,
351  (ULONG)-1,
352  NULL,
353  NULL,
354  0,
355  &NewKey);
356 
357  /* Add properties */
358  for (prev_name = ""; ofw_nextprop(node, prev_name, cur_name) == 1; )
359  {
360  proplen = ofw_getproplen(node, cur_name);
361  if (proplen > 256 || proplen < 0)
362  {
363  printf("Warning: not getting prop %s (too long: %d)\n",
364  cur_name, proplen);
365  continue;
366  }
367  ofw_getprop(node, cur_name, data, sizeof(data));
368 
369  /* Get device type so we can examine it */
370  if (!strcmp(cur_name, "device_type"))
371  strcpy(devtype, (char *)data);
372 
373  NarrowToWide(wide_name, cur_name);
374  //RegSetValue(NewKey, wide_name, REG_BINARY, data, proplen);
375 
376  strcpy(data, cur_name);
377  prev_name = data;
378  }
379 
380 #if 0
381  /* Special device handling */
382  if (!strcmp(devtype, "ata"))
383  {
384  OfwHandleDiskController(NewKey, node, *DiskController);
385  (*DiskController)++;
386  *DiskNumber = 0;
387  }
388  else if (!strcmp(devtype, "disk"))
389  {
390  OfwHandleDiskObject(NewKey, node, *DiskController, *DiskNumber);
391  (*DiskNumber)++;
392  }
393 #endif
394 
395  /* Subdevices */
396  for (node = ofw_child(node); node; node = ofw_peer(node))
397  {
398  ofw_package_to_path(node, data, sizeof(data));
399  slash = strrchr(data, '/');
400  if (slash) slash++; else continue;
402  (NewKey, slash, node, BusNumber, DiskController, DiskNumber);
403  }
404 }
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
struct node node
VOID OfwCopyDeviceTree(PCONFIGURATION_COMPONENT_DATA ParentKey, char *name, int innode, ULONG *BusNumber, ULONG *DiskController, ULONG *DiskNumber)
Definition: mach.c:330
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
VOID NTAPI FldrCreateComponentKey(IN PCONFIGURATION_COMPONENT_DATA SystemNode, 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)
Definition: archwsup.c:147
VOID NarrowToWide(WCHAR *wide_name, char *name)
Definition: mach.c:305
Definition: name.c:36
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define printf
Definition: config.h:203
Definition: dlist.c:348

Referenced by PpcHwDetect().

◆ PpcConsGetCh()

int PpcConsGetCh ( )

Definition at line 89 of file mach.c.

89  {
90  char buf;
91  ofw_read( stdin_handle, &buf, 1 );
92  return buf;
93 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static int stdin_handle
Definition: mach.c:31

Referenced by PpcDefaultMachVtbl().

◆ PpcConsKbHit()

BOOLEAN PpcConsKbHit ( )

Definition at line 85 of file mach.c.

85  {
86  return FALSE;
87 }

Referenced by PpcDefaultMachVtbl().

◆ PpcDefaultMachVtbl()

void PpcDefaultMachVtbl ( )

Definition at line 423 of file mach.c.

424 {
441 
443 
448 
450 
453 }
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:62
int PpcConsGetCh()
Definition: mach.c:89
BOOLEAN PpcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry)
Definition: mach.c:284
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:75
BOOLEAN(* DiskGetBootPath)(PCHAR BootPath, ULONG Size)
Definition: machine.h:64
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
VOID PpcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: mach.c:153
VOID PpcVideoHideShowTextCursor(BOOLEAN Show)
Definition: mach.c:122
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:53
BOOLEAN PpcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: mach.c:255
PCONFIGURATION_COMPONENT_DATA PpcHwDetect()
Definition: mach.c:406
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:66
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:49
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:70
BOOLEAN PpcDiskGetBootPath(PCHAR OutBootPath, ULONG Size)
Definition: mach.c:250
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:55
VOID PpcVideoSetTextCursorPosition(ULONG X, ULONG Y)
Definition: mach.c:118
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:65
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
TIMEINFO * PpcGetTime(VOID)
Definition: mach.c:298
VOID PpcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: mach.c:130
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:51
VOID PpcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: mach.c:126
void PpcVideoClearScreen(UCHAR Attr)
Definition: mach.c:95
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:54
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
int(* ConsGetCh)(VOID)
Definition: machine.h:43
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:67
BOOLEAN PpcVideoIsPaletteFixed()
Definition: mach.c:149
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
BOOLEAN PpcConsKbHit()
Definition: mach.c:85
ULONG PpcDiskGetCacheableBlockCount(ULONG DriveNumber)
Definition: mach.c:292
VOID(* HwIdle)(VOID)
Definition: machine.h:76
VOID PpcHwIdle(VOID)
Definition: mach.c:418
ULONG PpcVideoGetBufferSize()
Definition: mach.c:104
VOID(* VideoSync)(VOID)
Definition: machine.h:56
VOID PpcVideoSync()
Definition: mach.c:163
void PpcOfwPutChar(int ch)
Definition: mach.c:39
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:52
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
ULONG PpcGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
Definition: mach.c:187
MACHVTBL MachVtbl
Definition: machine.c:21
VIDEODISPLAYMODE PpcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
Definition: mach.c:110
VOID PpcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: mach.c:98
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:50
VOID PpcVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: mach.c:158

Referenced by PpcInit().

◆ PpcDiskGetBootPath()

BOOLEAN PpcDiskGetBootPath ( PCHAR  OutBootPath,
ULONG  Size 
)

Definition at line 250 of file mach.c.

250  {
251  strncpy( OutBootPath, BootPath, Size );
252  return TRUE;
253 }
#define TRUE
Definition: types.h:120
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
char BootPath[0x100]
Definition: mach.c:35

Referenced by PpcDefaultMachVtbl().

◆ PpcDiskGetCacheableBlockCount()

ULONG PpcDiskGetCacheableBlockCount ( ULONG  DriveNumber)

Definition at line 292 of file mach.c.

292  {
293  printf("GetCacheableBlockCount\n");
294  return 1;
295 }
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ PpcDiskGetDriveGeometry()

BOOLEAN PpcDiskGetDriveGeometry ( ULONG  DriveNumber,
PGEOMETRY  DriveGeometry 
)

Definition at line 284 of file mach.c.

284  {
285  printf("GetGeometry(%d)\n", DriveNumber);
286  DriveGeometry->BytesPerSector = 512;
287  DriveGeometry->Heads = 16;
288  DriveGeometry->Sectors = 63;
289  return TRUE;
290 }
#define TRUE
Definition: types.h:120
ULONG Sectors
Definition: disk.h:28
ULONG BytesPerSector
Definition: disk.h:29
#define printf
Definition: config.h:203
ULONG Heads
Definition: disk.h:27

Referenced by PpcDefaultMachVtbl().

◆ PpcDiskReadLogicalSectors()

BOOLEAN PpcDiskReadLogicalSectors ( ULONG  DriveNumber,
ULONGLONG  SectorNumber,
ULONG  SectorCount,
PVOID  Buffer 
)

Definition at line 255 of file mach.c.

256  {
257  int rlen = 0;
258 
259  if( part_handle == -1 ) {
260  part_handle = ofw_open( BootPart );
261 
262  if( part_handle == -1 ) {
263  printf("Could not open any disk devices we know about\n");
264  return FALSE;
265  }
266  }
267 
268  if( part_handle == -1 ) {
269  printf("Got partition handle %x\n", part_handle);
270  return FALSE;
271  }
272 
273  if( ofw_seek( part_handle,
274  (ULONG)(SectorNumber >> 25),
275  (ULONG)((SectorNumber * 512) & 0xffffffff) ) ) {
276  printf("Seek to %x failed\n", (ULONG)(SectorNumber * 512));
277  return FALSE;
278  }
279 
280  rlen = ofw_read( part_handle, Buffer, (ULONG)(SectorCount * 512) );
281  return rlen > 0;
282 }
Definition: bufpool.h:45
ULONG SectorCount
Definition: part_xbox.c:32
unsigned int ULONG
Definition: retypes.h:1
static int part_handle
Definition: mach.c:31
char BootPart[0x100]
Definition: mach.c:35
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ PpcFindDevice()

int PpcFindDevice ( int  depth,
int  parent,
char devname,
int nth 
)

Definition at line 47 of file mach.c.

47  {
48  static char buf[256];
49  int next = 0;
50  int gotname = 0;
51  int match = 0;
52  int i;
53 
54  next = ofw_child( parent );
55 
56  //printf( "next = %x\n", next );
57 
58  gotname = ofw_getprop(parent, "name", buf, 256);
59 
60  //printf( "gotname = %d\n", gotname );
61 
62  match = !strncmp(buf, devname, strlen(devname));
63 
64  if( !nth && match ) return parent;
65 
66  for( i = 0; i < depth; i++ ) PpcOfwPutChar( ' ' );
67 
68  if( depth == 1 ) {
69  if( gotname > 0 ) {
70  printf( "%c Name: %s\n", match ? '*' : ' ', buf );
71  } else {
72  printf( "- No name attribute for %x\n", parent );
73  }
74  }
75 
76  while( !match && next ) {
77  i = PpcFindDevice( depth+1, next, devname, nth );
78  if( i ) return i;
79  next = ofw_peer( next );
80  }
81 
82  return 0;
83 }
int PpcFindDevice(int depth, int parent, char *devname, int *nth)
Definition: mach.c:47
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: match.c:28
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
r parent
Definition: btrfs.c:2659
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
static unsigned __int64 next
Definition: rand_nt.c:6
void PpcOfwPutChar(int ch)
Definition: mach.c:39
#define printf
Definition: config.h:203

◆ PpcGetMemoryMap()

ULONG PpcGetMemoryMap ( PBIOS_MEMORY_MAP  BiosMemoryMap,
ULONG  MaxMemoryMapSize 
)

Definition at line 187 of file mach.c.

188  {
189  int i, memhandle, total = 0, slots = 0, last = 0x40000, allocstart = 0x1000000;
190  int regdata[0x40];
191 
192  printf("PpcGetMemoryMap(%d)\n", MaxMemoryMapSize);
193 
194  memhandle = ofw_finddevice("/memory");
195 
196  ofw_getprop(memhandle, "reg", (char *)regdata, sizeof(regdata));
197 
198  /* Try to claim some memory in usable blocks. Try to get some 8mb bits */
199  for( i = 0; i < sizeof(claimed) / sizeof(claimed[0]); ) {
200  if (!claimed[i])
201  claimed[i] = ofw_claim(allocstart, 8 * 1024 * 1024, 0x1000);
202 
203  allocstart += 8 * 1024 * 1024;
204 
205  if (claimed[i]) {
206  if (last < claimed[i]) {
207  BiosMemoryMap[slots].Type = BiosMemoryAcpiReclaim;
208  BiosMemoryMap[slots].BaseAddress = last;
209  BiosMemoryMap[slots].Length = claimed[i] - last;
210  slots++;
211  }
212 
213  BiosMemoryMap[slots].Type = BiosMemoryUsable;
214  BiosMemoryMap[slots].BaseAddress = claimed[i];
215  BiosMemoryMap[slots].Length = 8 * 1024 * 1024;
216 
217  total += BiosMemoryMap[slots].Length;
218  last =
219  BiosMemoryMap[slots].BaseAddress +
220  BiosMemoryMap[slots].Length;
221  slots++;
222  i++;
223  }
224  }
225 
226  /* Get the rest until the end of the memory object as we see it */
227  if (last < regdata[1]) {
228  BiosMemoryMap[slots].Type = BiosMemoryAcpiReclaim;
229  BiosMemoryMap[slots].BaseAddress = last;
230  BiosMemoryMap[slots].Length = regdata[1] - last;
231  slots++;
232  }
233 
234  for (i = 0; i < slots; i++) {
235  printf("MemoryMap[%d] = (%x:%x)\n",
236  i,
238  (int)BiosMemoryMap[i].Length);
239 
240  }
241 
242  mem_range_end = regdata[1];
243 
244  printf( "Returning memory map (%d entries, %dk free, %dk total ram)\n",
245  slots, total / 1024, regdata[1] / 1024 );
246 
247  return slots;
248 }
POINT last
Definition: font.c:46
PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap
Definition: meminit.c:33
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
int mem_range_end
Definition: mach.c:168
#define printf
Definition: config.h:203
int claimed[4]
Definition: mach.c:33

Referenced by PpcDefaultMachVtbl().

◆ PpcGetTime()

TIMEINFO* PpcGetTime ( VOID  )

Definition at line 298 of file mach.c.

299 {
300  static TIMEINFO TimeInfo;
301  //printf("PpcGetTime\n");
302  return &TimeInfo;
303 }
Definition: fw.h:9

Referenced by PpcDefaultMachVtbl().

◆ PpcHwDetect()

Definition at line 406 of file mach.c.

406  {
408  ULONG BusNumber = 0, DiskController = 0, DiskNumber = 0;
409  int node = ofw_finddevice("/");
410 
412 
414  return RootKey;
415 }
static PMEMKEY RootKey
Definition: registry.c:55
VOID OfwCopyDeviceTree(PCONFIGURATION_COMPONENT_DATA ParentKey, char *name, int innode, ULONG *BusNumber, ULONG *DiskController, ULONG *DiskNumber)
Definition: mach.c:330
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
Definition: dlist.c:348

Referenced by PpcDefaultMachVtbl().

◆ PpcHwIdle()

VOID PpcHwIdle ( VOID  )

Definition at line 418 of file mach.c.

419 {
420  /* UNIMPLEMENTED */
421 }

Referenced by PpcDefaultMachVtbl().

◆ PpcInit()

void PpcInit ( of_proxy  the_ofproxy)

Definition at line 482 of file mach.c.

482  {
483  // Hack to be a bit easier on ram
484  CacheSizeLimit = 64 * 1024;
485  ofproxy = the_ofproxy;
487  if(ofproxy) PpcOfwInit();
488  else PpcPrepInit();
489 }
void PpcOfwInit()
Definition: mach.c:455
void PpcDefaultMachVtbl()
Definition: mach.c:423
void PpcPrepInit()
Definition: prep.c:123
of_proxy ofproxy
Definition: mach.c:29
ULONG CacheSizeLimit
Definition: cache.c:34

◆ PpcInitializeMmu()

VOID PpcInitializeMmu ( )

Definition at line 169 of file mach.c.

170 {
171  if(!mmu_initialized)
172  {
173  MmuInit();
174  MmuDbgInit(0, 0x800003f8);
176  //MmuDbgEnter(0x20);
177  mmu_initialized = 1;
178  }
179 }
static void MmuDbgInit(int deviceType, int devicePort)
Definition: mmu.h:267
#define MmuInit()
Definition: mmu.h:177
int mmu_initialized
Definition: mach.c:167
static void MmuSetMemorySize(paddr_t size)
Definition: mmu.h:232
int mem_range_end
Definition: mach.c:168

◆ PpcOfwInit()

void PpcOfwInit ( )

Definition at line 455 of file mach.c.

456 {
457  chosen_package = ofw_finddevice( "/chosen" );
458 
459  ofw_getprop(chosen_package, "bootargs",
460  CmdLine, sizeof(CmdLine));
461  ofw_getprop( chosen_package, "stdin",
462  (char *)&stdin_handle, sizeof(stdin_handle) );
463  ofw_getprop( chosen_package, "stdout",
464  (char *)&stdout_handle, sizeof(stdout_handle) );
465  ofw_getprop( chosen_package, "mmu",
466  (char *)&mmu_handle, sizeof(mmu_handle) );
467 
468  // Allow forcing prep for broken OFW
469  if(!strncmp(CmdLine, "bootprep", 8))
470  {
471  printf("Going to PREP init...\n");
472  ofproxy = NULL;
473  PpcPrepInit();
474  return;
475  }
476 
477  printf( "FreeLDR version [%s]\n", GetFreeLoaderVersionString() );
478 
479  BootMain( CmdLine );
480 }
char CmdLine[0x100]
Definition: mach.c:35
void BootMain(LPSTR CmdLine)
const PCSTR GetFreeLoaderVersionString(VOID)
Definition: version.c:32
smooth NULL
Definition: ftsmooth.c:416
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
void PpcPrepInit()
Definition: prep.c:123
static int chosen_package
Definition: mach.c:31
of_proxy ofproxy
Definition: mach.c:29
static int stdout_handle
Definition: mach.c:31
static int stdin_handle
Definition: mach.c:31
int mmu_handle
Definition: mach.c:32
#define printf
Definition: config.h:203

Referenced by PpcInit().

◆ PpcOfwPutChar()

void PpcOfwPutChar ( int  ch)

Definition at line 39 of file mach.c.

39  {
40  char buf[3];
41  if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
42  else { buf[0] = ch; buf[1] = 0; }
43  buf[2] = 0;
44  ofw_write(stdout_handle, buf, strlen(buf));
45 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static int stdout_handle
Definition: mach.c:31

Referenced by PpcDefaultMachVtbl(), and PpcFindDevice().

◆ PpcPrepGetMemoryMap()

ULONG PpcPrepGetMemoryMap ( PBIOS_MEMORY_MAP  BiosMemoryMap,
ULONG  MaxMemoryMapSize 
)

Definition at line 67 of file prep.c.

69 {
70  // Probe memory
71  paddr_t physAddr;
72  register int oldStore = 0, newStore = 0, change = 0, oldmsr;
73 
74  __asm__("mfmsr %0\n" : "=r" (oldmsr));
75  change = oldmsr & 0x6fff;
76  __asm__("mtmsr %0\n" : : "r" (change));
77 
78  // Find the last ram address in physical space ... this bypasses mapping
79  // but could run into non-ram objects right above ram. Usually systems
80  // aren't designed like that though.
81  for (physAddr = 0x40000, change = newStore;
82  (physAddr < 0x80000000) && (change == newStore);
83  physAddr += 1 << 12)
84  {
85  oldStore = GetPhys(physAddr);
86  newStore = (physAddr & 0x1000) ? 0x55aa55aa : 0xaa55aa55;
87  SetPhys(physAddr, newStore);
88  change = GetPhys(physAddr);
89  SetPhys(physAddr, oldStore);
90  }
91  // Back off by one page
92  physAddr -= 0x1000;
93  BiosMemoryMap[0].BaseAddress = 0x30000; // End of ppcmmu
95  BiosMemoryMap[0].Length = physAddr - BiosMemoryMap[0].BaseAddress;
96 
97  __asm__("mtmsr %0\n" : : "r" (oldmsr));
98 
99  mem_range_end = physAddr;
100 
101  printf("Actual RAM: %d Mb\n", physAddr >> 20);
102  return 1;
103 }
int mem_range_end
Definition: mach.c:168
PFREELDR_MEMORY_DESCRIPTOR BiosMemoryMap
Definition: meminit.c:33
unsigned long paddr_t
Definition: mmu.h:89
__asm__("\t.globl GetPhys\n" "GetPhys:\t\n" "mflr 0\n\t" "stwu 0,-16(1)\n\t" "mfmsr 5\n\t" "andi. 6,5,0xffef\n\t" "mtmsr 6\n\t" "isync\n\t" "sync\n\t" "lwz 3,0(3)\n\t" "mtmsr 5\n\t" "isync\n\t" "sync\n\t" "lwz 0,0(1)\n\t" "addi 1,1,16\n\t" "mtlr 0\n\t" "blr")
ULONG GetPhys(ULONG Addr)
void SetPhys(ULONG Addr, ULONG Data)
#define printf
Definition: config.h:203

Referenced by PpcPrepInit().

◆ PpcVideoClearScreen()

void PpcVideoClearScreen ( UCHAR  Attr)

Definition at line 95 of file mach.c.

95  {
96 }

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoCopyOffScreenBufferToVRAM()

VOID PpcVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 130 of file mach.c.

130  {
131  int i,j;
132  ULONG w,h,d;
133  PCHAR ChBuf = Buffer;
134  int offset = 0;
135 
136  MachVideoGetDisplaySize( &w, &h, &d );
137 
138  for( i = 0; i < h; i++ ) {
139  for( j = 0; j < w; j++ ) {
140  offset = (j * 2) + (i * w * 2);
141  if( ChBuf[offset] != video_mem[offset] ) {
142  video_mem[offset] = ChBuf[offset];
143  MachVideoPutChar(ChBuf[offset],0,j+1,i+1);
144  }
145  }
146  }
147 }
signed char * PCHAR
Definition: retypes.h:7
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
volatile char * video_mem
Definition: mach.c:37
#define MachVideoGetDisplaySize(W, H, D)
Definition: machine.h:94
GLintptr offset
Definition: glext.h:5920
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MachVideoPutChar(Ch, Attr, X, Y)
Definition: machine.h:102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define d
Definition: ke_i.h:81
unsigned int ULONG
Definition: retypes.h:1
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoGetBufferSize()

ULONG PpcVideoGetBufferSize ( )

Definition at line 104 of file mach.c.

104  {
105  ULONG Width, Height, Depth;
106  MachVideoGetDisplaySize( &Width, &Height, &Depth );
107  return Width * Height * Depth / 8;
108 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
#define MachVideoGetDisplaySize(W, H, D)
Definition: machine.h:94
unsigned int ULONG
Definition: retypes.h:1

Referenced by PpcDefaultMachVtbl(), and PpcVideoSetDisplayMode().

◆ PpcVideoGetDisplaySize()

VOID PpcVideoGetDisplaySize ( PULONG  Width,
PULONG  Height,
PULONG  Depth 
)

Definition at line 98 of file mach.c.

98  {
99  *Width = 80;
100  *Height = 25;
101  *Depth = 16;
102 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoGetPaletteColor()

VOID PpcVideoGetPaletteColor ( UCHAR  Color,
UCHAR Red,
UCHAR Green,
UCHAR Blue 
)

Definition at line 158 of file mach.c.

159  {
160  printf( "GetPaletteColor(%x)\n", Color);
161 }
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoHideShowTextCursor()

VOID PpcVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 122 of file mach.c.

122  {
123  printf("HideShowTextCursor(%s)\n", Show ? "true" : "false");
124 }
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoIsPaletteFixed()

BOOLEAN PpcVideoIsPaletteFixed ( )

Definition at line 149 of file mach.c.

149  {
150  return FALSE;
151 }

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoPutChar()

VOID PpcVideoPutChar ( int  Ch,
UCHAR  Attr,
unsigned  X,
unsigned  Y 
)

Definition at line 126 of file mach.c.

126  {
127  printf( "\033[%d;%dH%c", Y, X, Ch );
128 }
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoSetDisplayMode()

VIDEODISPLAYMODE PpcVideoSetDisplayMode ( char DisplayMode,
BOOLEAN  Init 
)

Definition at line 110 of file mach.c.

110  {
111  //printf( "DisplayMode: %s %s\n", DisplayMode, Init ? "true" : "false" );
112  if( Init && !video_mem ) {
114  }
115  return VideoTextMode;
116 }
volatile char * video_mem
Definition: mach.c:37
PVOID MmAllocateMemory(SIZE_T MemorySize)
ULONG PpcVideoGetBufferSize()
Definition: mach.c:104

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoSetPaletteColor()

VOID PpcVideoSetPaletteColor ( UCHAR  Color,
UCHAR  Red,
UCHAR  Green,
UCHAR  Blue 
)

Definition at line 153 of file mach.c.

154  {
155  printf( "SetPaletteColor(%x,%x,%x,%x)\n", Color, Red, Green, Blue );
156 }
Definition: bl.h:202
Definition: bl.h:199
Definition: bl.h:200
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoSetTextCursorPosition()

VOID PpcVideoSetTextCursorPosition ( ULONG  X,
ULONG  Y 
)

Definition at line 118 of file mach.c.

118  {
119  printf("SetTextCursorPosition(%d,%d)\n", X,Y);
120 }
#define Y(I)
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ PpcVideoSync()

VOID PpcVideoSync ( )

Definition at line 163 of file mach.c.

163  {
164  printf( "Sync\n" );
165 }
#define printf
Definition: config.h:203

Referenced by PpcDefaultMachVtbl().

◆ READ_PORT_UCHAR()

UCHAR NTAPI READ_PORT_UCHAR ( PUCHAR  Address)

Definition at line 535 of file mach.c.

535  {
536  return GetPhysByte(((ULONG)Address)+0x80000000);
537 }
int GetPhysByte(int Addr)
static WCHAR Address[46]
Definition: ping.c:68
unsigned int ULONG
Definition: retypes.h:1

Referenced by AcpiOsReadPort(), ComPortTest1(), ComPortTest2(), CpGetByte(), CpInitialize(), CpReadLsr(), CpSetBaud(), DetectKeyboardDevice(), DetectPS2AuxDevice(), DetectPS2AuxPort(), DetectSerialMouse(), Disable8259AIrq(), DMusMPUInterruptServiceRoutine(), EISA_ELCR_Read(), Get_Byte(), getCx86(), GetExtendedMemoryConfiguration(), GetFloppyCount(), GetFloppyType(), GetSerialMousePnpId(), CUSBHardwareDevice::GlobalReset(), HalHandleNMI(), HalpInitDma(), HalpQueryCMOS(), HalpReadCmos(), HalpReboot(), HalReadDmaCounter(), HwDiskChanged(), HwDumpRegisters(), HwReset(), i8042ReadData(), i8042ReadStatus(), i8042Write(), inb_p(), InitializeSerialPort(), InitMPU(), inportb(), KdpBochsInit(), KdpSysReadIoSpace(), NdisImmediateReadPortUchar(), PcVideoGetPaletteColor(), PcVideoSet480ScanLines(), PcVideoSetDisplayEnd(), PcVideoSync(), PdoWrite(), PS2ControllerWait(), Read8254Timer(), ReadData(), ReadfromSMBus(), CUSBHardwareDevice::ReadRegister8(), ReadWriteMode(), ReadyForRead(), ReadyForWrite(), ScrAcquireOwnership(), ScrIoControl(), ScrSetRegisters(), ScrWrite(), ScsiPortReadPortUchar(), SerialDetectUartType(), SerialInterruptService(), SerialPnpStartDevice(), SerialReceiveByte(), SerialSendByte(), SerialSetBaudRate(), SerialSetLineControl(), sound(), STDMETHODIMP_(), StorPortReadPortUchar(), TryMPU(), UhciInitializeHardware(), VgaInterpretCmdStream(), VgaIsPresent(), WriteMPU(), and WriteToSMBus().

◆ WRITE_PORT_UCHAR()

void WRITE_PORT_UCHAR ( PUCHAR  Address,
UCHAR  Value 
)

Definition at line 539 of file mach.c.

539  {
540  SetPhysByte(((ULONG)Address)+0x80000000, Value);
541 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
static WCHAR Address[46]
Definition: ping.c:68
unsigned int ULONG
Definition: retypes.h:1
void SetPhysByte(ULONG Addr, ULONG Data)

Referenced by AcpiOsWritePort(), CloseBitPlane(), ComPortTest1(), ComPortTest2(), CpEnableFifo(), CpInitialize(), CpPutByte(), CpSetBaud(), DetectKeyboardDevice(), DetectPS2AuxDevice(), DetectPS2AuxPort(), DetectSerialMouse(), DFB_BltFromVGA(), DFB_BltToVGA(), DFB_BltToVGA_Transparent(), DIB_BltFromVGA(), DIB_BltToVGA(), DIB_BltToVGAWithXlate(), Disable8259AIrq(), DisableSMPMode(), DiskStopFloppyMotor(), EnableApicMode(), getCx86(), GetExtendedMemoryConfiguration(), GetFloppyCount(), GetFloppyType(), GetSerialMousePnpId(), CUSBHardwareDevice::GlobalReset(), HalBeginSystemInterrupt(), HalDisableSystemInterrupt(), HalEnableSystemInterrupt(), HalpCalibrateStallExecution(), HalpDmaInitializeEisaAdapter(), HalpEndSystemInterrupt(), HalpInitDma(), HalpInitPICs(), HalpPCIReleaseSynchronizationType2(), HalpPCIReleaseSynchronzationType2(), HalpPCISynchronizeType2(), HalpQueryCMOS(), HalpReadCmos(), HalpReboot(), HalPutCharacter(), HalpWriteCmos(), HalpWriteResetCommand(), HalReadDmaCounter(), HwPowerOff(), HwReset(), HwSetDataRate(), HwTurnOffMotor(), HwTurnOnMotor(), i8042Write(), InitializeSerialPort(), IoFlushAdapterBuffers(), IoMapTransfer(), KdpBochsDebugPrint(), KdpSysWriteIoSpace(), KiSystemService(), NdisImmediateWritePortUchar(), OpenBitPlane(), outb_p(), outportb(), Parallel_putchar(), Parallel_Reset(), PcVideoGetPaletteColor(), PcVideoSet480ScanLines(), PcVideoSetDisplayEnd(), PcVideoSetPaletteColor(), PdoWrite(), Read8254Timer(), ReadfromSMBus(), ScrAcquireOwnership(), ScrIoControl(), ScrSetRegisters(), ScrWrite(), ScsiPortWritePortUchar(), Send_Byte(), SerialDetectUartType(), SerialDeviceControl(), SerialInterruptService(), SerialPnpStartDevice(), SerialReceiveByte(), SerialSendByte(), SerialSetBaudRate(), SerialSetLineControl(), setCx86(), sound(), StorPortWritePortUchar(), UhciInitializeHardware(), VGADDI_BltBrush(), VGADDI_BltFromSavedScreenBits(), VGADDI_BltPointerToVGA(), VGADDI_BltToSavedScreenBits(), VGADDIFillSolid(), vgaGetByte(), vgaHLine(), VgaInterpretCmdStream(), VgaIsPresent(), vgaPutByte(), vgaPutPixel(), vgaReadScan(), vgaVLine(), vgaWriteScan(), VidCleanUp(), WriteAddress(), WriteData(), WriteMPU(), CUSBHardwareDevice::WriteRegister8(), and WriteToSMBus().

Variable Documentation

◆ AcpiPresent

BOOLEAN AcpiPresent = FALSE

Definition at line 34 of file mach.c.

Referenced by WinLdrInitializePhase1().

◆ BootPart

char BootPart[0x100] = { 0 }

Definition at line 35 of file mach.c.

Referenced by MachInit(), and PpcDiskReadLogicalSectors().

◆ BootPath

◆ CacheSizeLimit

ULONG CacheSizeLimit

Definition at line 34 of file cache.c.

Referenced by CacheInternalCheckCacheSizeLimits(), CacheInternalDumpBlockList(), and PpcInit().

◆ chosen_package

int chosen_package
static

Definition at line 31 of file mach.c.

Referenced by MachInit(), and PpcOfwInit().

◆ claimed

int claimed[4]

Definition at line 33 of file mach.c.

Referenced by PpcGetMemoryMap().

◆ CmdLine

char CmdLine[0x100] = { "bootprep" }

◆ jmp

◆ mem_range_end

int mem_range_end

Definition at line 168 of file mach.c.

Referenced by PpcGetMemoryMap(), PpcInitializeMmu(), and PpcPrepGetMemoryMap().

◆ mmu_handle

int mmu_handle = 0

Definition at line 32 of file mach.c.

Referenced by MmuTranslate(), and PpcOfwInit().

◆ mmu_initialized

int mmu_initialized = 0

Definition at line 167 of file mach.c.

Referenced by PpcInitializeMmu().

◆ ofproxy

of_proxy ofproxy

Definition at line 29 of file mach.c.

Referenced by MachInit(), MmuTranslate(), PpcInit(), and PpcOfwInit().

◆ PageDirectoryEnd

void * PageDirectoryEnd

Definition at line 30 of file mach.c.

◆ PageDirectoryStart

void* PageDirectoryStart

Definition at line 30 of file mach.c.

◆ part_handle

int part_handle = -1
static

Definition at line 31 of file mach.c.

Referenced by PpcDiskReadLogicalSectors().

◆ stdin_handle

int stdin_handle
static

Definition at line 31 of file mach.c.

Referenced by PpcConsGetCh(), and PpcOfwInit().

◆ stdout_handle

int stdout_handle
static

Definition at line 31 of file mach.c.

Referenced by PpcOfwInit(), and PpcOfwPutChar().

◆ video_mem

volatile char* video_mem = 0

Definition at line 37 of file mach.c.

Referenced by PpcVideoCopyOffScreenBufferToVRAM(), and PpcVideoSetDisplayMode().