ReactOS  0.4.14-dev-293-g2b39b42
machpc.h File Reference
#include "mm.h"
Include dependency graph for machpc.h:

Go to the source code of this file.

Functions

VOID PcMachInit (const char *CmdLine)
 
VOID PcBeep (VOID)
 
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 PcVideoGetFontsFromFirmware (PULONG RomFontPointers)
 
VOID PcVideoSetTextCursorPosition (UCHAR X, UCHAR 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 (VOID)
 
VOID PcPrepareForReactOS (VOID)
 
PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap (ULONG *MemoryMapSize)
 
BOOLEAN PcFindPciBios (PPCI_REGISTRY_INFO BusData)
 
LONG DiskReportError (BOOLEAN bShowError)
 
BOOLEAN DiskResetController (UCHAR DriveNumber)
 
BOOLEAN DiskGetExtendedDriveParameters (UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize)
 
BOOLEAN PcDiskReadLogicalSectors (UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 
BOOLEAN PcDiskGetDriveGeometry (UCHAR DriveNumber, PGEOMETRY DriveGeometry)
 
ULONG PcDiskGetCacheableBlockCount (UCHAR DriveNumber)
 
TIMEINFOPcGetTime (VOID)
 
BOOLEAN PcInitializeBootDevices (VOID)
 
PCONFIGURATION_COMPONENT_DATA PcHwDetect (VOID)
 
VOID PcHwIdle (VOID)
 

Variables

UCHAR FrldrBootDrive
 
ULONG FrldrBootPartition
 
BIOS_MEMORY_MAP PcBiosMemoryMap []
 
ULONG PcBiosMapCount
 

Function Documentation

◆ DiskGetExtendedDriveParameters()

BOOLEAN DiskGetExtendedDriveParameters ( UCHAR  DriveNumber,
PVOID  Buffer,
USHORT  BufferSize 
)

Definition at line 493 of file pcdisk.c.

494 {
495  REGS RegsIn, RegsOut;
497 
498  TRACE("DiskGetExtendedDriveParameters()\n");
499 
500  if (!DiskInt13ExtensionsSupported(DriveNumber))
501  return FALSE;
502 
503  /* Initialize transfer buffer */
504  *Ptr = BufferSize;
505 
506  /*
507  * BIOS Int 13h, function 48h - Get drive parameters
508  * AH = 48h
509  * DL = drive (bit 7 set for hard disk)
510  * DS:SI = result buffer
511  * Return:
512  * CF set on error
513  * AH = status (07h)
514  * CF clear if successful
515  * AH = 00h
516  * DS:SI -> result buffer
517  */
518  RegsIn.b.ah = 0x48;
519  RegsIn.b.dl = DriveNumber;
520  RegsIn.x.ds = BIOSCALLBUFSEGMENT; // DS:SI -> result buffer
521  RegsIn.w.si = BIOSCALLBUFOFFSET;
522 
523  /* Get drive parameters */
524  Int386(0x13, &RegsIn, &RegsOut);
525  if (!INT386_SUCCESS(RegsOut))
526  return FALSE;
527 
529 
530 #if DBG
531  TRACE("size of buffer: %x\n", Ptr[0]);
532  TRACE("information flags: %x\n", Ptr[1]);
533  TRACE("number of physical cylinders on drive: %u\n", *(PULONG)&Ptr[2]);
534  TRACE("number of physical heads on drive: %u\n", *(PULONG)&Ptr[4]);
535  TRACE("number of physical sectors per track: %u\n", *(PULONG)&Ptr[6]);
536  TRACE("total number of sectors on drive: %I64u\n", *(unsigned long long*)&Ptr[8]);
537  TRACE("bytes per sector: %u\n", Ptr[12]);
538  if (Ptr[0] >= 0x1e)
539  {
540  TRACE("EED configuration parameters: %x:%x\n", Ptr[13], Ptr[14]);
541  if (Ptr[13] != 0xffff && Ptr[14] != 0xffff)
542  {
543  PUCHAR SpecPtr = (PUCHAR)(ULONG_PTR)((Ptr[13] << 4) + Ptr[14]);
544  TRACE("SpecPtr: %x\n", SpecPtr);
545  TRACE("physical I/O port base address: %x\n", *(PUSHORT)&SpecPtr[0]);
546  TRACE("disk-drive control port address: %x\n", *(PUSHORT)&SpecPtr[2]);
547  TRACE("drive flags: %x\n", SpecPtr[4]);
548  TRACE("proprietary information: %x\n", SpecPtr[5]);
549  TRACE("IRQ for drive: %u\n", SpecPtr[6]);
550  TRACE("sector count for multi-sector transfers: %u\n", SpecPtr[7]);
551  TRACE("DMA control: %x\n", SpecPtr[8]);
552  TRACE("programmed I/O control: %x\n", SpecPtr[9]);
553  TRACE("drive options: %x\n", *(PUSHORT)&SpecPtr[10]);
554  }
555  }
556  if (Ptr[0] >= 0x42)
557  {
558  TRACE("signature: %x\n", Ptr[15]);
559  }
560 #endif
561 
562  return TRUE;
563 }
#define TRUE
Definition: types.h:120
#define BIOSCALLBUFFER
Definition: x86common.h:12
unsigned char * PUCHAR
Definition: retypes.h:3
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
DWORDREGS x
Definition: pcbios.h:148
unsigned char ah
Definition: pcbios.h:120
uint32_t ULONG_PTR
Definition: typedefs.h:63
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char dl
Definition: pcbios.h:128
#define BIOSCALLBUFSEGMENT
Definition: x86common.h:21
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
#define BufferSize
Definition: classpnp.h:419
#define BIOSCALLBUFOFFSET
Definition: x86common.h:22
BYTEREGS b
Definition: pcbios.h:151
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber)
Definition: pcdisk.c:362
unsigned int * PULONG
Definition: retypes.h:1
unsigned short si
Definition: pcbios.h:104
Definition: pcbios.h:146
unsigned short * PUSHORT
Definition: retypes.h:2
WORDREGS w
Definition: pcbios.h:150
unsigned short ds
Definition: pcbios.h:88

Referenced by PcDiskGetDriveGeometry(), and PcGetHarddiskConfigurationData().

◆ DiskReportError()

LONG DiskReportError ( BOOLEAN  bShowError)

Definition at line 80 of file pcdisk.c.

81 {
82  /* Set the reference count */
83  if (bShowError) ++lReportError;
84  else --lReportError;
85  return lReportError;
86 }
static LONG lReportError
Definition: pcdisk.c:78

Referenced by EnumerateHarddisks(), and GetHarddiskInformation().

◆ DiskResetController()

BOOLEAN DiskResetController ( UCHAR  DriveNumber)

Definition at line 140 of file pcdisk.c.

141 {
142  REGS RegsIn, RegsOut;
143 
144  WARN("DiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
145 
146  /*
147  * BIOS Int 13h, function 0 - Reset disk system
148  * AH = 00h
149  * DL = drive (if bit 7 is set both hard disks and floppy disks reset)
150  * Return:
151  * AH = status
152  * CF clear if successful
153  * CF set on error
154  */
155  RegsIn.b.ah = 0x00;
156  RegsIn.b.dl = DriveNumber;
157 
158  /* Reset the disk controller */
159  Int386(0x13, &RegsIn, &RegsOut);
160 
161  return INT386_SUCCESS(RegsOut);
162 }
#define WARN(fmt,...)
Definition: debug.h:111
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char dl
Definition: pcbios.h:128
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
BYTEREGS b
Definition: pcbios.h:151
Definition: pcbios.h:146

Referenced by DetectBiosFloppyPeripheral(), PcDiskReadLogicalSectorsCHS(), and PcDiskReadLogicalSectorsLBA().

◆ PcBeep()

VOID PcBeep ( VOID  )

Definition at line 25 of file i386rtl.c.

26 {
27  sound(700);
28  delay(200);
29  sound(0);
30 }
void sound(int freq)
Definition: i386rtl.c:75
void delay(unsigned msec)
Definition: i386rtl.c:32

Referenced by PcMachInit(), XboxBeep(), and XboxMachInit().

◆ PcConsGetCh()

int PcConsGetCh ( VOID  )

Definition at line 90 of file pccons.c.

91 {
92  REGS Regs;
93  static BOOLEAN ExtendedKey = FALSE;
94  static char ExtendedScanCode = 0;
95 
96  /* If the last time we were called an
97  * extended key was pressed then return
98  * that keys scan code. */
99  if (ExtendedKey)
100  {
101  ExtendedKey = FALSE;
102  return ExtendedScanCode;
103  }
104 
105  /* Int 16h AH=00h
106  * KEYBOARD - GET KEYSTROKE
107  *
108  * AH = 00h
109  * Return:
110  * AH = BIOS scan code
111  * AL = ASCII character
112  */
113  Regs.b.ah = 0x00;
114  Int386(0x16, &Regs, &Regs);
115 
116  /* Check for an extended keystroke */
117  if (0 == Regs.b.al)
118  {
119  ExtendedKey = TRUE;
120  ExtendedScanCode = Regs.b.ah;
121  }
122 
123  /* Return keystroke */
124  return Regs.b.al;
125 }
#define TRUE
Definition: types.h:120
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char BOOLEAN
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
Definition: pcbios.h:146

Referenced by PcMachInit(), and PcVideoSetDisplayMode().

◆ PcConsKbHit()

BOOLEAN PcConsKbHit ( VOID  )

Definition at line 69 of file pccons.c.

70 {
71  REGS Regs;
72 
73  /* Int 16h AH=01h
74  * KEYBOARD - CHECK FOR KEYSTROKE
75  *
76  * AH = 01h
77  * Return:
78  * ZF set if no keystroke available
79  * ZF clear if keystroke available
80  * AH = BIOS scan code
81  * AL = ASCII character
82  */
83  Regs.b.ah = 0x01;
84  Int386(0x16, &Regs, &Regs);
85 
86  return 0 == (Regs.x.eflags & EFLAGS_ZF);
87 }
DWORDREGS x
Definition: pcbios.h:148
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define EFLAGS_ZF
Definition: ketypes.h:124
BYTEREGS b
Definition: pcbios.h:151
unsigned long eflags
Definition: pcbios.h:93
Definition: pcbios.h:146

Referenced by PcMachInit().

◆ PcConsPutChar()

VOID PcConsPutChar ( int  Ch)

Definition at line 28 of file pccons.c.

29 {
30  REGS Regs;
31 
32  /* If we are displaying a CR '\n' then do a LF also */
33  if ('\n' == Ch)
34  {
35  /* Display the LF */
36  PcConsPutChar('\r');
37  }
38 
39  /* If we are displaying a TAB '\t' then display 8 spaces ' ' */
40  if ('\t' == Ch)
41  {
42  /* Display the 8 spaces ' ' */
43  PcConsPutChar(' ');
44  PcConsPutChar(' ');
45  PcConsPutChar(' ');
46  PcConsPutChar(' ');
47  PcConsPutChar(' ');
48  PcConsPutChar(' ');
49  PcConsPutChar(' ');
50  PcConsPutChar(' ');
51  return;
52  }
53 
54  /* Int 10h AH=0Eh
55  * VIDEO - TELETYPE OUTPUT
56  *
57  * AH = 0Eh
58  * AL = character to write
59  * BH = page number
60  * BL = foreground color (graphics modes only)
61  */
62  Regs.b.ah = 0x0E;
63  Regs.b.al = Ch;
64  Regs.w.bx = 1;
65  Int386(0x10, &Regs, &Regs);
66 }
unsigned char ah
Definition: pcbios.h:120
#define Ch(x, y, z)
Definition: sha2.c:141
int __cdecl Int386(int ivec, REGS *in, REGS *out)
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
unsigned short bx
Definition: pcbios.h:100
Definition: pcbios.h:146
VOID PcConsPutChar(int Ch)
Definition: pccons.c:28
WORDREGS w
Definition: pcbios.h:150

Referenced by PcConsPutChar(), and PcMachInit().

◆ PcDiskGetCacheableBlockCount()

ULONG PcDiskGetCacheableBlockCount ( UCHAR  DriveNumber)

Definition at line 626 of file pcdisk.c.

627 {
628  GEOMETRY Geometry;
629 
630  /* If LBA is supported then the block size will be 64 sectors (32k)
631  * If not then the block size is the size of one track. */
632  if (DiskInt13ExtensionsSupported(DriveNumber))
633  {
634  return 64;
635  }
636  /* Get the disk geometry. If this fails then we will
637  * just return 1 sector to be safe. */
638  else if (!PcDiskGetDriveGeometry(DriveNumber, &Geometry))
639  {
640  return 1;
641  }
642  else
643  {
644  return Geometry.Sectors;
645  }
646 }
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:566
ULONG Sectors
Definition: disk.h:28
static BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber)
Definition: pcdisk.c:362
Definition: disk.h:24

Referenced by PcMachInit().

◆ PcDiskGetDriveGeometry()

BOOLEAN PcDiskGetDriveGeometry ( UCHAR  DriveNumber,
PGEOMETRY  DriveGeometry 
)

Definition at line 566 of file pcdisk.c.

567 {
568  EXTENDED_GEOMETRY ExtGeometry;
569  REGS RegsIn, RegsOut;
570  ULONG Cylinders;
571 
572  TRACE("DiskGetDriveGeometry()\n");
573 
574  /* Try to get the extended geometry first */
575  ExtGeometry.Size = sizeof(ExtGeometry);
576  if (DiskGetExtendedDriveParameters(DriveNumber, &ExtGeometry, ExtGeometry.Size))
577  {
578  Geometry->Cylinders = ExtGeometry.Cylinders;
579  Geometry->Heads = ExtGeometry.Heads;
580  Geometry->Sectors = ExtGeometry.SectorsPerTrack;
581  Geometry->BytesPerSector = ExtGeometry.BytesPerSector;
582  return TRUE;
583  }
584 
585  /*
586  * BIOS Int 13h, function 08h - Get drive parameters
587  * AH = 08h
588  * DL = drive (bit 7 set for hard disk)
589  * ES:DI = 0000h:0000h to guard against BIOS bugs
590  * Return:
591  * CF set on error
592  * AH = status (07h)
593  * CF clear if successful
594  * AH = 00h
595  * AL = 00h on at least some BIOSes
596  * BL = drive type (AT/PS2 floppies only)
597  * CH = low eight bits of maximum cylinder number
598  * CL = maximum sector number (bits 5-0)
599  * high two bits of maximum cylinder number (bits 7-6)
600  * DH = maximum head number
601  * DL = number of drives
602  * ES:DI -> drive parameter table (floppies only)
603  */
604  RegsIn.b.ah = 0x08;
605  RegsIn.b.dl = DriveNumber;
606  RegsIn.w.es = 0x0000;
607  RegsIn.w.di = 0x0000;
608 
609  /* Get drive parameters */
610  Int386(0x13, &RegsIn, &RegsOut);
611  if (!INT386_SUCCESS(RegsOut))
612  return FALSE;
613 
614  Cylinders = (RegsOut.b.cl & 0xC0) << 2;
615  Cylinders += RegsOut.b.ch;
616  Cylinders++;
617  Geometry->Cylinders = Cylinders;
618  Geometry->Heads = RegsOut.b.dh + 1;
619  Geometry->Sectors = RegsOut.b.cl & 0x3F;
620  Geometry->BytesPerSector = 512; /* Just assume 512 bytes per sector */
621 
622  return TRUE;
623 }
#define TRUE
Definition: types.h:120
unsigned short es
Definition: pcbios.h:109
unsigned char ah
Definition: pcbios.h:120
ULONG Cylinders
Definition: disk.h:41
unsigned char dh
Definition: pcbios.h:129
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char dl
Definition: pcbios.h:128
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
ULONG SectorsPerTrack
Definition: disk.h:43
BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize)
Definition: pcdisk.c:493
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char ch
Definition: pcbios.h:126
unsigned char cl
Definition: pcbios.h:125
BYTEREGS b
Definition: pcbios.h:151
USHORT Size
Definition: disk.h:39
USHORT BytesPerSector
Definition: disk.h:45
ULONG Heads
Definition: disk.h:42
unsigned int ULONG
Definition: retypes.h:1
Definition: pcbios.h:146
unsigned short di
Definition: pcbios.h:105
WORDREGS w
Definition: pcbios.h:150

Referenced by PcDiskGetCacheableBlockCount(), PcDiskReadLogicalSectorsCHS(), PcGetHarddiskConfigurationData(), and PcMachInit().

◆ PcDiskReadLogicalSectors()

BOOLEAN PcDiskReadLogicalSectors ( UCHAR  DriveNumber,
ULONGLONG  SectorNumber,
ULONG  SectorCount,
PVOID  Buffer 
)

Definition at line 456 of file pcdisk.c.

457 {
458  BOOLEAN ExtensionsSupported;
459 
460  TRACE("PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n",
461  DriveNumber, SectorNumber, SectorCount, Buffer);
462 
463  /*
464  * Check to see if it is a fixed disk drive.
465  * If so then check to see if Int13 extensions work.
466  * If they do then use them, otherwise default back to BIOS calls.
467  */
468  ExtensionsSupported = DiskInt13ExtensionsSupported(DriveNumber);
469 
470  if ((DriveNumber >= 0x80) && ExtensionsSupported)
471  {
472  TRACE("Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, ExtensionsSupported ? "TRUE" : "FALSE");
473 
474  /* LBA is easy, nothing to calculate. Just do the read. */
475  return PcDiskReadLogicalSectorsLBA(DriveNumber, SectorNumber, SectorCount, Buffer);
476  }
477  else
478  {
479  /* LBA is not supported default to the CHS calls */
480  return PcDiskReadLogicalSectorsCHS(DriveNumber, SectorNumber, SectorCount, Buffer);
481  }
482 
483  return TRUE;
484 }
#define TRUE
Definition: types.h:120
static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: pcdisk.c:164
unsigned char BOOLEAN
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
static BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber)
Definition: pcdisk.c:362
ULONG SectorCount
Definition: part_xbox.c:32
static BOOLEAN PcDiskReadLogicalSectorsCHS(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: pcdisk.c:230

Referenced by PcMachInit().

◆ PcFindPciBios()

BOOLEAN PcFindPciBios ( PPCI_REGISTRY_INFO  BusData)

Definition at line 80 of file hwpci.c.

81 {
82  REGS RegsIn;
83  REGS RegsOut;
84 
85  RegsIn.b.ah = 0xB1; /* Subfunction B1h */
86  RegsIn.b.al = 0x01; /* PCI BIOS present */
87 
88  Int386(0x1A, &RegsIn, &RegsOut);
89 
90  if (INT386_SUCCESS(RegsOut) &&
91  (RegsOut.d.edx == ' ICP') &&
92  (RegsOut.b.ah == 0))
93  {
94  TRACE("Found PCI bios\n");
95 
96  TRACE("AL: %x\n", RegsOut.b.al);
97  TRACE("BH: %x\n", RegsOut.b.bh);
98  TRACE("BL: %x\n", RegsOut.b.bl);
99  TRACE("CL: %x\n", RegsOut.b.cl);
100 
101  BusData->NoBuses = RegsOut.b.cl + 1;
102  BusData->MajorRevision = RegsOut.b.bh;
103  BusData->MinorRevision = RegsOut.b.bl;
104  BusData->HardwareMechanism = RegsOut.b.al;
105 
106  return TRUE;
107  }
108 
109  TRACE("No PCI bios found\n");
110 
111  return FALSE;
112 }
#define TRUE
Definition: types.h:120
UCHAR HardwareMechanism
Definition: pci.h:110
unsigned char ah
Definition: pcbios.h:120
UCHAR MinorRevision
Definition: pci.h:108
int __cdecl Int386(int ivec, REGS *in, REGS *out)
UCHAR MajorRevision
Definition: pci.h:107
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
#define TRACE(s)
Definition: solgame.cpp:4
unsigned char bl
Definition: pcbios.h:122
unsigned char cl
Definition: pcbios.h:125
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
DWORDREGS d
Definition: pcbios.h:149
unsigned char bh
Definition: pcbios.h:123
UCHAR NoBuses
Definition: pci.h:109
Definition: pcbios.h:146
unsigned long edx
Definition: pcbios.h:82

Referenced by PcHwDetect().

◆ PcGetTime()

TIMEINFO* PcGetTime ( VOID  )

Definition at line 24 of file pcrtc.c.

25 {
26  static TIMEINFO TimeInfo;
27  REGS Regs;
28 
29  for (;;)
30  {
31  /* Some BIOSes, such as the 1998/07/25 system ROM
32  * in the Compaq Deskpro EP/SB, leave CF unchanged
33  * if successful, so CF should be cleared before
34  * calling this function. */
35  Regs.x.eflags = 0;
36 // __writeeflags(__readeflags() & ~EFLAGS_CF);
37 
38  /* Int 1Ah AH=04h
39  * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
40  *
41  * AH = 04h
42  * CF clear to avoid bug
43  * Return:
44  * CF clear if successful
45  * CH = century (BCD)
46  * CL = year (BCD)
47  * DH = month (BCD)
48  * DL = day (BCD)
49  * CF set on error
50  */
51  Regs.b.ah = 0x04;
52  Int386(0x1A, &Regs, &Regs);
53 
54  if (!INT386_SUCCESS(Regs)) continue;
55 
56  TimeInfo.Year = 100 * BCD_INT(Regs.b.ch) + BCD_INT(Regs.b.cl);
57  TimeInfo.Month = BCD_INT(Regs.b.dh);
58  TimeInfo.Day = BCD_INT(Regs.b.dl);
59 
60  /* Some BIOSes leave CF unchanged if successful,
61  * so CF should be cleared before calling this function. */
62  Regs.x.eflags = 0;
63 // __writeeflags(__readeflags() & ~EFLAGS_CF);
64 
65  /* Int 1Ah AH=02h
66  * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
67  *
68  * AH = 02h
69  * CF clear to avoid bug
70  * Return:
71  * CF clear if successful
72  * CH = hour (BCD)
73  * CL = minutes (BCD)
74  * DH = seconds (BCD)
75  * DL = daylight savings flag (00h standard time, 01h daylight time)
76  * CF set on error (i.e. clock not running or in middle of update)
77  */
78  Regs.b.ah = 0x02;
79  Int386(0x1A, &Regs, &Regs);
80 
81  if (!INT386_SUCCESS(Regs)) continue;
82 
83  TimeInfo.Hour = BCD_INT(Regs.b.ch);
84  TimeInfo.Minute = BCD_INT(Regs.b.cl);
85  TimeInfo.Second = BCD_INT(Regs.b.dh);
86 
87  break;
88  }
89  return &TimeInfo;
90 }
#define BCD_INT(bcd)
Definition: pcrtc.c:21
DWORDREGS x
Definition: pcbios.h:148
unsigned char ah
Definition: pcbios.h:120
USHORT Second
Definition: fw.h:16
USHORT Month
Definition: fw.h:12
unsigned char dh
Definition: pcbios.h:129
int __cdecl Int386(int ivec, REGS *in, REGS *out)
USHORT Minute
Definition: fw.h:15
unsigned char dl
Definition: pcbios.h:128
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
Definition: fw.h:9
USHORT Year
Definition: fw.h:11
unsigned char ch
Definition: pcbios.h:126
unsigned char cl
Definition: pcbios.h:125
BYTEREGS b
Definition: pcbios.h:151
unsigned long eflags
Definition: pcbios.h:93
USHORT Hour
Definition: fw.h:14
Definition: pcbios.h:146
USHORT Day
Definition: fw.h:13

Referenced by PcMachInit().

◆ PcHwDetect()

Definition at line 1351 of file machpc.c.

1352 {
1354  ULONG BusNumber = 0;
1355 
1356  TRACE("DetectHardware()\n");
1357 
1358  /* Create the 'System' key */
1359  FldrCreateSystemKey(&SystemKey);
1360  // TODO: Discover and set the machine type as the Component->Identifier
1361 
1364 
1365  /* Detect buses */
1366  DetectPciBios(SystemKey, &BusNumber);
1367  DetectApmBios(SystemKey, &BusNumber);
1368  DetectPnpBios(SystemKey, &BusNumber);
1369  DetectIsaBios(SystemKey, &BusNumber); // TODO: Detect first EISA or MCA, before ISA
1370  DetectAcpiBios(SystemKey, &BusNumber);
1371 
1372  // TODO: Collect the ROM blocks from 0xC0000 to 0xF0000 and append their
1373  // CM_ROM_BLOCK data into the 'System' key's configuration data.
1374 
1375  TRACE("DetectHardware() Done\n");
1376  return SystemKey;
1377 }
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: hardware.c:40
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
static PCM_PARTIAL_RESOURCE_LIST PcGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machpc.c:104
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define TRACE(s)
Definition: solgame.cpp:4
static VOID DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machpc.c:179
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwacpi.c:54
static VOID DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machpc.c:1290
BOOLEAN PcFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: hwpci.c:80
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwapm.c:57

Referenced by PcMachInit().

◆ PcHwIdle()

VOID PcHwIdle ( VOID  )

Definition at line 1380 of file machpc.c.

1381 {
1382  REGS Regs;
1383 
1384  /* Select APM 1.0+ function */
1385  Regs.b.ah = 0x53;
1386 
1387  /* Function 05h: CPU idle */
1388  Regs.b.al = 0x05;
1389 
1390  /* Call INT 15h */
1391  Int386(0x15, &Regs, &Regs);
1392 
1393  /* Check if successfull (CF set on error) */
1394  if (INT386_SUCCESS(Regs))
1395  return;
1396 
1397  /*
1398  * No futher processing here.
1399  * Optionally implement HLT instruction handling.
1400  */
1401 }
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
#define INT386_SUCCESS(regs)
Definition: pcbios.h:167
BYTEREGS b
Definition: pcbios.h:151
unsigned char al
Definition: pcbios.h:119
Definition: pcbios.h:146

Referenced by PcMachInit().

◆ PcInitializeBootDevices()

BOOLEAN PcInitializeBootDevices ( VOID  )

Definition at line 468 of file hwdisk.c.

469 {
470  UCHAR DiskCount;
471  BOOLEAN BootDriveReported = FALSE;
472  ULONG i;
473 
474  DiskCount = EnumerateHarddisks(&BootDriveReported);
475 
476  /* Initialize FrLdrBootPath, the boot path we're booting from (the "SystemPartition") */
478 
479  /* Add it, if it's a floppy or cdrom */
480  if ((FrldrBootDrive >= 0x80 && !BootDriveReported) ||
482  {
483  /* TODO: Check if it's really a CDROM drive */
484 
486  PULONG Buffer;
487  ULONG Checksum = 0;
489 
490  /* Read the MBR */
492  {
493  ERR("Reading MBR failed\n");
494  return FALSE;
495  }
496 
499 
500  Signature = Mbr->Signature;
501  TRACE("Signature: %x\n", Signature);
502 
503  /* Calculate the MBR checksum */
504  for (i = 0; i < 2048 / sizeof(ULONG); i++)
505  {
506  Checksum += Buffer[i];
507  }
508  Checksum = ~Checksum + 1;
509  TRACE("Checksum: %x\n", Checksum);
510 
511  /* Fill out the ARC disk block */
513 
515  DiskCount++; // This is not accounted for in the number of pre-enumerated BIOS drives!
516  TRACE("Additional boot drive detected: 0x%02X\n", (int)FrldrBootDrive);
517  }
518 
519  return (DiskCount != 0);
520 }
ULONG Signature
Definition: disk.h:75
#define MachDiskReadLogicalSectors(Drive, Start, Count, Buf)
Definition: machine.h:126
#define TRUE
Definition: types.h:120
BOOLEAN PxeInit(VOID)
Definition: pxe.c:373
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
unsigned char BOOLEAN
Definition: bufpool.h:45
#define ULL(a, b)
Definition: format_msg.c:27
static BOOLEAN DiskGetBootPath(BOOLEAN IsPxe)
Definition: hwdisk.c:415
static BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber)
Definition: hwdisk.c:400
#define TRACE(s)
Definition: solgame.cpp:4
UCHAR FrldrBootDrive
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID FsRegisterDevice(CHAR *Prefix, const DEVVTBL *FuncTable)
Definition: fs.c:383
PVOID DiskReadBuffer
Definition: hwdisk.c:46
VOID AddReactOSArcDiskInfo(IN PSTR ArcName, IN ULONG Signature, IN ULONG Checksum, IN BOOLEAN ValidPartitionTable)
Definition: archwsup.c:29
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int * PULONG
Definition: retypes.h:1
struct _MASTER_BOOT_RECORD * PMASTER_BOOT_RECORD
unsigned int ULONG
Definition: retypes.h:1
CHAR FrLdrBootPath[MAX_PATH]
Definition: mach.c:34
static UCHAR EnumerateHarddisks(OUT PBOOLEAN BootDriveReported)
Definition: hwdisk.c:342
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
static const WCHAR Signature[]
Definition: parser.c:141
static const DEVVTBL DiskVtbl
Definition: hwdisk.c:238

Referenced by PcMachInit(), and XboxMachInit().

◆ PcMachInit()

VOID PcMachInit ( const char CmdLine)

Definition at line 1407 of file machpc.c.

1408 {
1409  /* Setup vtbl */
1426  MachVtbl.Beep = PcBeep;
1438 }
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID PcVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pcvideo.c:974
VOID PcVideoSync(VOID)
Definition: pcvideo.c:1136
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:77
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: pcdisk.c:626
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:468
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1033
VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pcvideo.c:1008
VOID PcGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machpc.c:80
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
VOID PcVideoClearScreen(UCHAR Attr)
Definition: pcvideo.c:1087
BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pcdisk.c:566
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap(ULONG *MemoryMapSize)
Definition: pcmem.c:594
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: pcdisk.c:456
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
Definition: pcvideo.c:886
BOOLEAN PcConsKbHit(VOID)
Definition: pccons.c:69
BOOLEAN PcVideoIsPaletteFixed(VOID)
Definition: pcvideo.c:1112
VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pcvideo.c:1118
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID)
Definition: machpc.c:1351
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: pcvideo.c:1103
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
VOID PcBeep(VOID)
Definition: i386rtl.c:25
VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pcvideo.c:944
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
int(* ConsGetCh)(VOID)
Definition: machine.h:43
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
MACHVTBL MachVtbl
Definition: arcemul.c:21
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID PcHwIdle(VOID)
Definition: machpc.c:1380
static UCHAR PcGetFloppyCount(VOID)
Definition: machpc.c:1340
VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pcvideo.c:1046
VOID(* VideoSync)(VOID)
Definition: machine.h:57
VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pcvideo.c:1127
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
TIMEINFO * PcGetTime(VOID)
Definition: pcrtc.c:24
VOID(* Beep)(VOID)
Definition: machine.h:58
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:968
int PcConsGetCh(void)
Definition: pccons.c:90
VOID PcPrepareForReactOS(VOID)
Definition: machpc.c:1441
VOID PcConsPutChar(int Ch)
Definition: pccons.c:28
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51

Referenced by MachInit().

◆ PcMemGetMemoryMap()

PFREELDR_MEMORY_DESCRIPTOR PcMemGetMemoryMap ( ULONG MemoryMapSize)

Definition at line 594 of file pcmem.c.

595 {
596  ULONG EntryCount;
597  ULONG ExtendedMemorySizeAtOneMB;
598  ULONG ExtendedMemorySizeAtSixteenMB;
599  ULONG EbdaBase, EbdaSize;
600 
601  TRACE("PcMemGetMemoryMap()\n");
602 
604 
606 
607  /* If the BIOS didn't provide a memory map, synthesize one */
608  if (EntryCount == 0)
609  {
610  GetExtendedMemoryConfiguration(&ExtendedMemorySizeAtOneMB,
611  &ExtendedMemorySizeAtSixteenMB);
612 
613  /* Conventional memory */
616  0,
618  LoaderFree);
619 
620  /* Extended memory */
623  1024 * 1024 / PAGE_SIZE,
624  ExtendedMemorySizeAtOneMB * 1024 / PAGE_SIZE,
625  LoaderFree);
626 
627  if (ExtendedMemorySizeAtSixteenMB != 0)
628  {
629  /* Extended memory at 16MB */
632  0x1000000 / PAGE_SIZE,
633  ExtendedMemorySizeAtSixteenMB * 64 * 1024 / PAGE_SIZE,
634  LoaderFree);
635  }
636 
637  /* Check if we have an EBDA and get it's location */
638  if (GetEbdaLocation(&EbdaBase, &EbdaSize))
639  {
640  /* Add the descriptor */
643  (EbdaBase / PAGE_SIZE),
644  ADDRESS_AND_SIZE_TO_SPAN_PAGES(EbdaBase, EbdaSize),
646  }
647  }
648 
649  /* Setup some protected ranges */
650  SetMemory(PcMemoryMap, 0x000000, 0x01000, LoaderFirmwarePermanent); // Realmode IVT / BDA
651  SetMemory(PcMemoryMap, 0x0A0000, 0x50000, LoaderFirmwarePermanent); // Video memory
652  SetMemory(PcMemoryMap, 0x0F0000, 0x10000, LoaderSpecialMemory); // ROM
653  SetMemory(PcMemoryMap, 0xFFF000, 0x01000, LoaderSpecialMemory); // unusable memory (do we really need this?)
654 
655  *MemoryMapSize = PcMemFinalizeMemoryMap(PcMemoryMap);
656  return PcMemoryMap;
657 }
ULONG PcMapCount
Definition: pcmem.c:41
#define MAX_BIOS_DESCRIPTORS
Definition: pcbios.h:12
static BOOLEAN GetEbdaLocation(PULONG BaseAddress, PULONG Size)
Definition: pcmem.c:175
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
#define TRACE(s)
Definition: solgame.cpp:4
static BOOLEAN GetExtendedMemoryConfiguration(ULONG *pMemoryAtOneMB, ULONG *pMemoryAtSixteenMB)
Definition: pcmem.c:53
static ULONG PcMemGetBiosMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG MaxMemoryMapSize)
Definition: pcmem.c:235
#define PAGE_SIZE
Definition: env_spec_w32.h:49
ULONG AddMemoryDescriptor(IN OUT PFREELDR_MEMORY_DESCRIPTOR List, IN ULONG MaxCount, IN PFN_NUMBER BasePage, IN PFN_NUMBER PageCount, IN TYPE_OF_MEMORY MemoryType)
Definition: meminit.c:102
FREELDR_MEMORY_DESCRIPTOR PcMemoryMap[MAX_BIOS_DESCRIPTORS+1]
Definition: pcmem.c:40
ULONG PcMemFinalizeMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap)
Definition: pcmem.c:542
VOID SetMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType)
Definition: pcmem.c:522
static ULONG PcMemGetConventionalMemorySize(VOID)
Definition: pcmem.c:149
unsigned int ULONG
Definition: retypes.h:1
static VOID PcMemCheckUsableMemorySize(VOID)
Definition: pcmem.c:209

Referenced by PcMachInit().

◆ PcPrepareForReactOS()

VOID PcPrepareForReactOS ( VOID  )

Definition at line 1441 of file machpc.c.

1442 {
1443  /* On PC, prepare video and turn off the floppy motor */
1445  DiskStopFloppyMotor();
1446 }
VOID PcVideoPrepareForReactOS(VOID)
Definition: pcvideo.c:1159

Referenced by PcMachInit().

◆ PcVideoClearScreen()

VOID PcVideoClearScreen ( UCHAR  Attr)

Definition at line 1087 of file pcvideo.c.

1088 {
1089  USHORT AttrChar;
1090  USHORT *BufPtr;
1091 
1092  AttrChar = ((USHORT) Attr << 8) | ' ';
1093  for (BufPtr = (USHORT *) VIDEOTEXT_MEM_ADDRESS;
1095  BufPtr++)
1096  {
1098  *BufPtr = AttrChar;
1099  }
1100 }
#define VIDEOTEXT_MEM_SIZE
Definition: pcvideo.c:32
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
#define __WARNING_DEREF_NULL_PTR
Definition: suppress.h:32
unsigned short USHORT
Definition: pedump.c:61
#define _PRAGMA_WARNING_SUPPRESS(x)
Definition: suppress.h:28

Referenced by PcMachInit().

◆ PcVideoCopyOffScreenBufferToVRAM()

VOID PcVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 1046 of file pcvideo.c.

1047 {
1048  USHORT BanksToCopy;
1049  ULONG BytesInLastBank;
1050  USHORT CurrentBank;
1051  ULONG BankSize;
1052 
1053  /* PcVideoWaitForVerticalRetrace(); */
1054 
1055  /* Text mode (BIOS or VESA) */
1056  if (VideoTextMode == DisplayMode)
1057  {
1059  }
1060  /* VESA graphics mode */
1062  {
1066 
1067  /* Copy all the banks but the last one because
1068  * it is probably a partial bank */
1069  for (CurrentBank = 0; CurrentBank < BanksToCopy; CurrentBank++)
1070  {
1071  PcVideoSetMemoryBank(CurrentBank);
1072  RtlCopyMemory((PVOID) VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BankSize);
1073  }
1074 
1075  /* Copy the remaining bytes into the last bank */
1076  PcVideoSetMemoryBank(CurrentBank);
1077  RtlCopyMemory((PVOID)VIDEOVGA_MEM_ADDRESS, (char *) Buffer + CurrentBank * BankSize, BytesInLastBank);
1078  }
1079  /* BIOS graphics mode */
1080  else
1081  {
1082  UNIMPLEMENTED;
1083  }
1084 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:117
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:116
#define VIDEOVGA_MEM_ADDRESS
Definition: pcvideo.c:30
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
static VOID PcVideoSetMemoryBank(USHORT BankNumber)
Definition: pcvideo.c:848
Definition: bufpool.h:45
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
USHORT BytesPerScanLine
Definition: pcvideo.c:65
unsigned short USHORT
Definition: pedump.c:61
USHORT WindowGranularity
Definition: pcvideo.c:60
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
USHORT HeightInPixels
Definition: pcvideo.c:68
ULONG PcVideoGetBufferSize(VOID)
Definition: pcvideo.c:968

Referenced by PcMachInit().

◆ PcVideoGetBufferSize()

ULONG PcVideoGetBufferSize ( VOID  )

Definition at line 968 of file pcvideo.c.

969 {
971 }
static ULONG ScreenHeight
Definition: pcvideo.c:113
static ULONG BytesPerScanLine
Definition: pcvideo.c:114

Referenced by PcMachInit(), and PcVideoCopyOffScreenBufferToVRAM().

◆ PcVideoGetDisplaySize()

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

Definition at line 944 of file pcvideo.c.

945 {
946  *Width = ScreenWidth;
947  *Height = ScreenHeight;
949  {
951  {
952  /* 16-bit color modes give green an extra bit (5:6:5)
953  * 15-bit color modes have just 5:5:5 for R:G:B */
954  *Depth = (6 == VesaVideoModeInformation.GreenMaskSize ? 16 : 15);
955  }
956  else
957  {
959  }
960  }
961  else
962  {
963  *Depth = 0;
964  }
965 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
static SVGA_MODE_INFORMATION VesaVideoModeInformation
Definition: pcvideo.c:117
static BOOLEAN VesaVideoMode
Definition: pcvideo.c:116
static ULONG ScreenHeight
Definition: pcvideo.c:113
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
static ULONG ScreenWidth
Definition: pcvideo.c:112

Referenced by PcMachInit().

◆ PcVideoGetFontsFromFirmware()

VOID PcVideoGetFontsFromFirmware ( PULONG  RomFontPointers)

Definition at line 974 of file pcvideo.c.

975 {
976  REGS BiosRegs;
977 
978  /* Get the address of the BIOS ROM fonts.
979  Int 10h, AX=1130h, BH = pointer specifier
980  returns: es:bp = address */
981  BiosRegs.d.eax = 0x1130;
982  BiosRegs.b.bh = ROM_8x14CharacterFont;
983  Int386(0x10, &BiosRegs, &BiosRegs);
984  RomFontPointers[0] = BiosRegs.w.es << 4 | BiosRegs.w.bp;
985 
986  BiosRegs.b.bh = ROM_8x8DoubleDotFontLo;
987  Int386(0x10, &BiosRegs, &BiosRegs);
988  RomFontPointers[1] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
989 
990  BiosRegs.b.bh = ROM_8x8DoubleDotFontHi;
991  Int386(0x10, &BiosRegs, &BiosRegs);
992  RomFontPointers[2] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
993 
994  BiosRegs.b.bh = ROM_AlphaAlternate;
995  Int386(0x10, &BiosRegs, &BiosRegs);
996  RomFontPointers[3] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
997 
998  BiosRegs.b.bh = ROM_8x16Font;
999  Int386(0x10, &BiosRegs, &BiosRegs);
1000  RomFontPointers[4] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1001 
1002  BiosRegs.b.bh = ROM_Alternate9x16Font;
1003  Int386(0x10, &BiosRegs, &BiosRegs);
1004  RomFontPointers[5] = BiosRegs.w.es << 16 | BiosRegs.w.bp;
1005 }
unsigned long eax
Definition: pcbios.h:79
unsigned short es
Definition: pcbios.h:109
int __cdecl Int386(int ivec, REGS *in, REGS *out)
BYTEREGS b
Definition: pcbios.h:151
DWORDREGS d
Definition: pcbios.h:149
unsigned char bh
Definition: pcbios.h:123
#define RomFontPointers
Definition: winldr.c:422
unsigned short bp
Definition: pcbios.h:106
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

Referenced by PcMachInit().

◆ PcVideoGetPaletteColor()

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

Definition at line 1127 of file pcvideo.c.

1128 {
1133 }
Definition: bl.h:202
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
#define VIDEOPORT_PALETTE_READ
Definition: pcvideo.c:25
Definition: bl.h:199
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:27
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by PcMachInit().

◆ PcVideoHideShowTextCursor()

VOID PcVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 1033 of file pcvideo.c.

1034 {
1035  if (Show)
1036  {
1037  PcVideoDefineCursor(0x0D, 0x0E);
1038  }
1039  else
1040  {
1041  PcVideoDefineCursor(0x20, 0x00);
1042  }
1043 }
static VOID PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine)
Definition: pcvideo.c:315

Referenced by PcMachInit(), and PcVideoPrepareForReactOS().

◆ PcVideoIsPaletteFixed()

BOOLEAN PcVideoIsPaletteFixed ( VOID  )

Definition at line 1112 of file pcvideo.c.

1113 {
1114  return FALSE;
1115 }

Referenced by PcMachInit().

◆ PcVideoPrepareForReactOS()

VOID PcVideoPrepareForReactOS ( VOID  )

Definition at line 1159 of file pcvideo.c.

1160 {
1161  // PcVideoSetMode80x50_80x43();
1164 }
static BOOLEAN PcVideoSetMode80x25(VOID)
Definition: pcvideo.c:601
VOID PcVideoHideShowTextCursor(BOOLEAN Show)
Definition: pcvideo.c:1033

Referenced by PcPrepareForReactOS().

◆ PcVideoPutChar()

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

Definition at line 1103 of file pcvideo.c.

1104 {
1105  USHORT *BufPtr;
1106 
1107  BufPtr = (USHORT *) (ULONG_PTR)(VIDEOTEXT_MEM_ADDRESS + Y * BytesPerScanLine + X * 2);
1108  *BufPtr = ((USHORT) Attr << 8) | (Ch & 0xff);
1109 }
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
static ULONG BytesPerScanLine
Definition: pcvideo.c:114
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define VIDEOTEXT_MEM_ADDRESS
Definition: pcvideo.c:31
unsigned short USHORT
Definition: pedump.c:61

Referenced by PcMachInit().

◆ PcVideoSetDisplayMode()

VIDEODISPLAYMODE PcVideoSetDisplayMode ( char DisplayMode,
BOOLEAN  Init 
)

Definition at line 886 of file pcvideo.c.

887 {
889 
890  if (NULL == DisplayModeName || '\0' == *DisplayModeName)
891  {
893  return DisplayMode;
894  }
895 
897  {
898  TRACE("CGA or other display adapter detected.\n");
899  printf("CGA or other display adapter detected.\n");
900  printf("Using 80x25 text mode.\n");
902  }
904  {
905  TRACE("EGA display adapter detected.\n");
906  printf("EGA display adapter detected.\n");
907  printf("Using 80x25 text mode.\n");
909  }
910  else /* if (VIDEOCARD_VGA == PcVideoDetectVideoCard()) */
911  {
912  TRACE("VGA display adapter detected.\n");
913 
914  if (0 == _stricmp(DisplayModeName, "NORMAL_VGA"))
915  {
917  }
918  else if (0 == _stricmp(DisplayModeName, "EXTENDED_VGA"))
919  {
921  }
922  else
923  {
924  VideoMode = (USHORT)strtoul(DisplayModeName, NULL, 0);
925  }
926  }
927 
928  if (! PcVideoSetMode(VideoMode))
929  {
930  printf("Error: unable to set video display mode 0x%x\n", (int) VideoMode);
931  printf("Defaulting to 80x25 text mode.\n");
932  printf("Press any key to continue.\n");
933  PcConsGetCh();
934 
936  }
937 
939 
940  return DisplayMode;
941 }
#define VIDEOCARD_CGA_OR_OTHER
Definition: pcvideo.c:34
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
static BOOLEAN PcVideoSetMode(USHORT NewMode)
Definition: pcvideo.c:715
#define VIDEOMODE_EXTENDED_TEXT
Definition: pcvideo.c:39
#define VIDEOMODE_NORMAL_TEXT
Definition: pcvideo.c:38
#define _stricmp
Definition: cat.c:22
smooth NULL
Definition: ftsmooth.c:416
static VOID PcVideoSetBlinkBit(BOOLEAN Enable)
Definition: pcvideo.c:823
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG PcVideoDetectVideoCard(VOID)
Definition: pcvideo.c:135
static VIDEODISPLAYMODE DisplayMode
Definition: pcvideo.c:115
#define VIDEOCARD_EGA
Definition: pcvideo.c:35
unsigned short USHORT
Definition: pedump.c:61
int PcConsGetCh(void)
Definition: pccons.c:90
#define printf
Definition: config.h:203

Referenced by PcMachInit().

◆ PcVideoSetPaletteColor()

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

Definition at line 1118 of file pcvideo.c.

1119 {
1124 }
Definition: bl.h:202
Definition: bl.h:199
Definition: bl.h:200
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_PALETTE_WRITE
Definition: pcvideo.c:26
#define VIDEOPORT_PALETTE_DATA
Definition: pcvideo.c:27
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by PcMachInit().

◆ PcVideoSetTextCursorPosition()

VOID PcVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 1008 of file pcvideo.c.

1009 {
1010  REGS Regs;
1011 
1012  /* Int 10h AH=02h
1013  * VIDEO - SET CURSOR POSITION
1014  *
1015  * AH = 02h
1016  * BH = page number
1017  * 0-3 in modes 2&3
1018  * 0-7 in modes 0&1
1019  * 0 in graphics modes
1020  * DH = row (00h is top)
1021  * DL = column (00h is left)
1022  * Return:
1023  * Nothing
1024  */
1025  Regs.b.ah = 0x02;
1026  Regs.b.bh = 0x00;
1027  Regs.b.dh = Y;
1028  Regs.b.dl = X;
1029  Int386(0x10, &Regs, &Regs);
1030 }
#define Y(I)
unsigned char ah
Definition: pcbios.h:120
unsigned char dh
Definition: pcbios.h:129
int __cdecl Int386(int ivec, REGS *in, REGS *out)
unsigned char dl
Definition: pcbios.h:128
BYTEREGS b
Definition: pcbios.h:151
unsigned char bh
Definition: pcbios.h:123
Definition: pcbios.h:146
#define X(b, s)

Referenced by PcMachInit().

◆ PcVideoSync()

VOID PcVideoSync ( VOID  )

Definition at line 1136 of file pcvideo.c.

1137 {
1139  {
1140  /*
1141  * Keep reading the port until bit 3 is clear
1142  * This waits for the current retrace to end and
1143  * we can catch the next one so we know we are
1144  * getting a full retrace.
1145  */
1146  }
1147 
1148  while (!(READ_PORT_UCHAR((UCHAR*)VIDEOPORT_VERTICAL_RETRACE) & 0x08))
1149  {
1150  /*
1151  * Keep reading the port until bit 3 is set
1152  * Now that we know we aren't doing a vertical
1153  * retrace we need to wait for the next one.
1154  */
1155  }
1156 }
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
unsigned char UCHAR
Definition: xmlstorage.h:181
#define VIDEOPORT_VERTICAL_RETRACE
Definition: pcvideo.c:28

Referenced by PcMachInit().

Variable Documentation

◆ FrldrBootDrive

◆ FrldrBootPartition

ULONG FrldrBootPartition

◆ PcBiosMapCount

ULONG PcBiosMapCount

Definition at line 38 of file pcmem.c.

Referenced by DetectAcpiBios(), and PcMemGetBiosMemoryMap().

◆ PcBiosMemoryMap

BIOS_MEMORY_MAP PcBiosMemoryMap[]

Definition at line 37 of file pcmem.c.

Referenced by DetectAcpiBios(), and PcMemGetBiosMemoryMap().