diff options
Diffstat (limited to 'Private')
| -rw-r--r-- | Private/EFIKit/EFI.hxx | 77 | ||||
| -rw-r--r-- | Private/FSKit/NewFS.hxx | 8 | ||||
| -rw-r--r-- | Private/KernelKit/Framebuffer.hpp | 16 | ||||
| -rw-r--r-- | Private/NewBoot/BootKit/BootKit.hxx | 13 | ||||
| -rw-r--r-- | Private/NewBoot/Source/Entrypoint.cxx | 19 | ||||
| -rw-r--r-- | Private/NewBoot/Source/ImageReader.cxx | 2 |
6 files changed, 131 insertions, 4 deletions
diff --git a/Private/EFIKit/EFI.hxx b/Private/EFIKit/EFI.hxx index cc4f5581..b11164de 100644 --- a/Private/EFIKit/EFI.hxx +++ b/Private/EFIKit/EFI.hxx @@ -35,6 +35,8 @@ struct EfiSystemTable; struct EfiGUID; struct EfiFileDevicePathProtocol; struct EfiHandle; +struct EfiGraphicsOutputProtocol; +struct EfiBitmask; /// @brief Core Handle Type /// This is like NT's Win32 HANDLE type. @@ -247,6 +249,13 @@ typedef struct EfiTableHeader { } \ } +#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \ + { \ + 0x9042a9de, 0x23dc, 0x4a38, { \ + 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a \ + } \ + } + #define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000 #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \ @@ -272,6 +281,74 @@ typedef struct EfiTableHeader { typedef UInt64(EfiImageUnload)(EfiHandlePtr ImageHandle); +enum { + kPixelRedGreenBlueReserved8BitPerColor, + kPixelBlueGreenRedReserved8BitPerColor, + kPixelBitMask, + kPixelBltOnly, + kPixelFormatMax +}; + +typedef struct EfiBitmask { + UInt32 RedMask; + UInt32 GreenMask; + UInt32 BlueMask; + UInt32 ReservedMask; +} EfiBitmask; + +typedef struct { + UInt8 Blue; + UInt8 Green; + UInt8 Red; + UInt8 Reserved; +} EfiGraphicsOutputBltPixel; + +typedef enum EfiGraphicsOutputProtocolBltOperation { + EfiBltVideoFill, + EfiBltVideoToBltBuffer, + EfiBltBufferToVideo, + EfiBltVideoToVideo, + EfiGraphicsOutputBltOperationMax +} EfiGraphicsOutputProtocolBltOperation; + +typedef struct EfiGraphicsOutputProtocolModeInformation { + UInt32 Version; + UInt32 HorizontalResolution; + UInt32 VerticalResolution; + UInt32 PixelFormat; + EfiBitmask PixelInformation; + UInt32 PixelsPerScanLine; +} EfiGraphicsOutputProtocolModeInformation; + +typedef UInt64(EFI_API *EfiGraphicsOutputProtocolQueryMode)( + EfiGraphicsOutputProtocol *This, UInt32 ModeNumber, UInt32 *SizeOfInfo, + EfiGraphicsOutputProtocolModeInformation **Info); + +typedef UInt64(EFI_API *EfiGraphicsOutputProtocolSetMode)(EfiGraphicsOutputProtocol *This, + UInt32 ModeNumber); + +typedef UInt64(EFI_API *EfiGraphicsOutputProtocolBlt)( + EfiGraphicsOutputProtocol *This, EfiGraphicsOutputBltPixel *BltBuffer, + EfiGraphicsOutputProtocolBltOperation BltOperation, UInt32 SourceX, + UInt32 SourceY, UInt32 DestinationX, UInt32 DestinationY, UInt32 Width, + UInt32 Height, UInt32 Delta); + +typedef struct { + UInt32 MaxMode; + UInt32 Mode; + EfiGraphicsOutputProtocolModeInformation *Info; + UInt32 SizeOfInfo; + UIntPtr FrameBufferBase; + UInt32 FrameBufferSize; +} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE; + +typedef struct EfiGraphicsOutputProtocol { + EfiGraphicsOutputProtocolQueryMode QueryMode; + EfiGraphicsOutputProtocolSetMode SetMode; + EfiGraphicsOutputProtocolBlt Blt; + EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode; +} EfiGraphicsOutputProtocol; + typedef struct EfiLoadImageProtocol { UInt32 Revision; EfiHandlePtr ParentHandle; diff --git a/Private/FSKit/NewFS.hxx b/Private/FSKit/NewFS.hxx index 28187b09..8aace190 100644 --- a/Private/FSKit/NewFS.hxx +++ b/Private/FSKit/NewFS.hxx @@ -188,5 +188,9 @@ class MeFilesystemHelper final { #define kNewFSAddressAsLba 1024 -// FSControl() syscall -// FSOpen, FSClose, FSWhereAt, FSSetCursor, FSNodeSize, FSWrite, FSRead syscalls +enum { + kNewFSPartGPT, + kNewFSPartEPM, + kNewFSPartUDF, + kNewFSPartCount, +}; diff --git a/Private/KernelKit/Framebuffer.hpp b/Private/KernelKit/Framebuffer.hpp index feb34d3a..124cba4f 100644 --- a/Private/KernelKit/Framebuffer.hpp +++ b/Private/KernelKit/Framebuffer.hpp @@ -52,6 +52,22 @@ class Framebuffer final { Ref<FramebufferContext *> m_FrameBufferAddr; FramebufferColorKind m_Colour; }; + +/***********************************************************************************/ +/// Framebuffer utils. +/***********************************************************************************/ + +const UInt32 kRgbRed = 0x000000FF; +const UInt32 kRgbGreen = 0x0000FF00; +const UInt32 kRgbBlue = 0x00FF0000; +const UInt32 kRgbBlack = 0x00000000; +const UInt32 kRgbWhite = 0x00FFFFFF; } // namespace HCore +/***********************************************************************************/ +/// Framebuffer macros. +/***********************************************************************************/ + +#define RGB(R, G, B) (UInt32)(0x##R##G##B) + #endif /* ifndef __INC_FB_HPP__ */ diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx index 766749bd..6fdbacaf 100644 --- a/Private/NewBoot/BootKit/BootKit.hxx +++ b/Private/NewBoot/BootKit/BootKit.hxx @@ -86,6 +86,7 @@ class BImageReader final { CharacterType mPath[kPathLen]; BTextWriter mWriter; BATADevice mDevice; + bool mCached{false}; }; /***********************************************************************************/ @@ -134,4 +135,16 @@ inline UInt32 In32(UInt16 port) { return value; } +/***********************************************************************************/ +/// Framebuffer. +/***********************************************************************************/ + +#define RGB(R, G, B) (UInt32)(0x##R##G##B) + +const UInt32 kRgbRed = 0x000000FF; +const UInt32 kRgbGreen = 0x0000FF00; +const UInt32 kRgbBlue = 0x00FF0000; +const UInt32 kRgbBlack = 0x00000000; +const UInt32 kRgbWhite = 0x00FFFFFF; + #endif // __EFI_x86_64__ diff --git a/Private/NewBoot/Source/Entrypoint.cxx b/Private/NewBoot/Source/Entrypoint.cxx index 6a778143..ff118f8a 100644 --- a/Private/NewBoot/Source/Entrypoint.cxx +++ b/Private/NewBoot/Source/Entrypoint.cxx @@ -7,6 +7,7 @@ * ======================================================== */ +#include "EFIKit/EFI.hxx" #define __BOOTLOADER__ 1 #include <BootKit/BootKit.hxx> @@ -14,11 +15,25 @@ #include <KernelKit/PE.hpp> #include <NewKit/Ref.hpp> -// don't remove EfiGUID, it will call initializer_list! +STATIC Void DrawBackground() { + EfiGUID gopGuid = EfiGUID(EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID); + EfiGraphicsOutputProtocol* gop = nullptr; -EFI_EXTERN_C int EfiMain(EfiHandlePtr ImageHandle, + BS->LocateProtocol(&gopGuid, nullptr, (void**)&gop); + + for (int w = 0; w < gop->Mode->Info->VerticalResolution; ++w) { + for (int h = 0; h < gop->Mode->Info->HorizontalResolution; ++h) { + *((UInt32*)(gop->Mode->FrameBufferBase + + 4 * gop->Mode->Info->PixelsPerScanLine * w + 4 * h)) = + RGB(20, 20, 20); + } + } +} + +EFI_EXTERN_C Int EfiMain(EfiHandlePtr ImageHandle, EfiSystemTable* SystemTable) { InitEFI(SystemTable); + DrawBackground(); BTextWriter writer; diff --git a/Private/NewBoot/Source/ImageReader.cxx b/Private/NewBoot/Source/ImageReader.cxx index b714c21f..98e025a8 100644 --- a/Private/NewBoot/Source/ImageReader.cxx +++ b/Private/NewBoot/Source/ImageReader.cxx @@ -66,5 +66,7 @@ HCore::VoidPtr BImageReader::Fetch(SizeT &size) { /// get file catalog with mPath inside it. + this->mCached = true; + return nullptr; } |
