Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2020-03-26 17:25:49 +03:00
commit 9b85ac2a5b
57 changed files with 2095 additions and 532 deletions

View File

@ -10,7 +10,7 @@
#include <stdarg.h>
#include <stddef.h> // for size_t
#include "printf_lite-conf.h"
#include <printf_lite-conf.h>
#if defined(__cplusplus)
extern "C"

View File

@ -20,6 +20,8 @@
GenericIch.h
printf_lite.h
printf_lite.c
../../Include/Library/printf_lite.h
../../Include/Library/printf_lite-conf.h
[Packages]
MdePkg/MdePkg.dec

View File

@ -466,13 +466,13 @@ __attribute__((noinline, section(".printf_lite")))
#endif
static void print_string(const char* s, PrintfParams* printfParams)
{
while ( *s ) print_char(*s++, printfParams);
if ( s ) while ( *s ) print_char(*s++, printfParams);
}
#if PRINTF_UNICODE_OUTPUT_SUPPORT
static void wprint_string(const wchar_t* s, PrintfParams* printfParams)
{
while ( *s ) print_wchar(*s++, printfParams);
if ( s ) while ( *s ) print_wchar(*s++, printfParams);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,7 @@ edk2config="DEBUG_XCODE8" # configuration name of edk2 build script (ie DEB
echo edk2config=$edk2config
#parameter 4
libname=""$SCRIPT_DIR"/DerivedData/CloverX64/Build/Products/Debug/libCloverX64.a" # lib name generated by Xcode
libname="$1" # lib name generated by Xcode
echo libname=$libname
#parameter 5

View File

@ -91,6 +91,7 @@
9ACAB117242623EE00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
9ACAB1192426255C00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
9ACAB11A2426255C00BDB3CF /* printf_lite.c in Sources */ = {isa = PBXBuildFile; fileRef = 9ACAB116242623EE00BDB3CF /* printf_lite.c */; };
9AF41576242CBE7600D2644C /* poolprint-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41571242CBE7600D2644C /* poolprint-test.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -146,7 +147,6 @@
9A0B08642403144C00E2B470 /* global_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = global_test.cpp; sourceTree = "<group>"; };
9A0B08862403B08400E2B470 /* cpp_tests UTF32 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "cpp_tests UTF32"; sourceTree = BUILT_PRODUCTS_DIR; };
9A1A3FDC2424BC22008C89EB /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = printf_lite.h; sourceTree = "<group>"; };
9A1A3FE52424BC51008C89EB /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
9A28CD05241B8DD400F3D247 /* strncmp_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strncmp_test.cpp; sourceTree = "<group>"; };
9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strcmp_test.cpp; sourceTree = "<group>"; };
9A28CD07241B8DD400F3D247 /* strcmp_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strcmp_test.h; sourceTree = "<group>"; };
@ -186,6 +186,18 @@
9AC780A62417DD2F005CDD5C /* panic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = panic.h; sourceTree = "<group>"; };
9ACAB116242623EE00BDB3CF /* printf_lite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf_lite.c; sourceTree = "<group>"; };
9ACAB1182426240C00BDB3CF /* printf_lite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = printf_lite.h; path = ../../Include/Library/printf_lite.h; sourceTree = "<group>"; };
9AF4156B242CBB5600D2644C /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF4156D242CBC4900D2644C /* printf_lite-conf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "printf_lite-conf.h"; path = "../../Include/Library/printf_lite-conf.h"; sourceTree = "<group>"; };
9AF4156E242CBC6000D2644C /* printf_lite-conf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "printf_lite-conf.h"; sourceTree = "<group>"; };
9AF4156F242CBE7500D2644C /* printlib-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test.h"; sourceTree = "<group>"; };
9AF41570242CBE7500D2644C /* printlib-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF41571242CBE7600D2644C /* poolprint-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "poolprint-test.cpp"; sourceTree = "<group>"; };
9AF41572242CBE7600D2644C /* poolprint-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprint-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF41573242CBE7600D2644C /* printlib-test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "printlib-test.cpp"; sourceTree = "<group>"; };
9AF41574242CBE7600D2644C /* printf_lite-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printf_lite-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF41575242CBE7600D2644C /* poolprint-test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprint-test.h"; sourceTree = "<group>"; };
9AF41578242CBED700D2644C /* poolprint-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "poolprint-test-cpp_conf.h"; sourceTree = "<group>"; };
9AF41579242CBED700D2644C /* printlib-test-cpp_conf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "printlib-test-cpp_conf.h"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -244,9 +256,15 @@
9A0B08542402FE9B00E2B470 /* all_tests.h */,
9A0B08642403144C00E2B470 /* global_test.cpp */,
9A57C20A2418A1FD0029A39F /* global_test.h */,
9A1A3FE52424BC51008C89EB /* printf_lite-test-cpp_conf.h */,
9AF41572242CBE7600D2644C /* poolprint-test-cpp_conf.h */,
9AF41571242CBE7600D2644C /* poolprint-test.cpp */,
9AF41575242CBE7600D2644C /* poolprint-test.h */,
9AF41574242CBE7600D2644C /* printf_lite-test-cpp_conf.h */,
9AA045892425F94D000D6970 /* printf_lite-test.cpp */,
9AA045882425F94D000D6970 /* printf_lite-test.h */,
9AF41570242CBE7500D2644C /* printlib-test-cpp_conf.h */,
9AF41573242CBE7600D2644C /* printlib-test.cpp */,
9AF4156F242CBE7500D2644C /* printlib-test.h */,
9A28CD06241B8DD400F3D247 /* strcmp_test.cpp */,
9A28CD07241B8DD400F3D247 /* strcmp_test.h */,
9A28CD15241BACBB00F3D247 /* strlen_test.cpp */,
@ -275,6 +293,7 @@
9A1A3FD82424BC22008C89EB /* MemLogLibDefault */ = {
isa = PBXGroup;
children = (
9AF4156D242CBC4900D2644C /* printf_lite-conf.h */,
9ACAB1182426240C00BDB3CF /* printf_lite.h */,
9ACAB116242623EE00BDB3CF /* printf_lite.c */,
9A1A3FDC2424BC22008C89EB /* printf_lite.h */,
@ -328,13 +347,17 @@
9A92232F2402FD1000483CBA /* Main */ = {
isa = PBXGroup;
children = (
9AA045782425D44D000D6970 /* PoolPrint */,
9AF41578242CBED700D2644C /* poolprint-test-cpp_conf.h */,
9AF41579242CBED700D2644C /* printlib-test-cpp_conf.h */,
9A9223302402FD1000483CBA /* main.cpp */,
9A92234D2402FD9500483CBA /* Platform.h */,
9A0B085D240300E000E2B470 /* Platform.cpp */,
9A92234D2402FD9500483CBA /* Platform.h */,
9AA045782425D44D000D6970 /* PoolPrint */,
9A28CD13241B9FEE00F3D247 /* posix.h */,
9A28CD49241F437C00F3D247 /* xcode_utf16.h */,
9AF4156E242CBC6000D2644C /* printf_lite-conf.h */,
9AF4156B242CBB5600D2644C /* printf_lite-test-cpp_conf.h */,
9A28CD4A241F4CCE00F3D247 /* xcode_utf16.cpp */,
9A28CD49241F437C00F3D247 /* xcode_utf16.h */,
);
name = Main;
path = src;
@ -534,6 +557,7 @@
9A28CD0C241B8DD400F3D247 /* strcmp_test.cpp in Sources */,
9A28CD09241B8DD400F3D247 /* strncmp_test.cpp in Sources */,
9AA05BB7240FC78D008EA4F8 /* utf8Conversion.cpp in Sources */,
9AF41576242CBE7600D2644C /* poolprint-test.cpp in Sources */,
9AC780AE2417DD2F005CDD5C /* panic.cpp in Sources */,
9A0B085F240308E400E2B470 /* XStringW.cpp in Sources */,
9A0B08592402FF8200E2B470 /* all_tests.cpp in Sources */,

View File

@ -0,0 +1,12 @@
#define F(x) x
#define LF(x) L##x
#define PRIF "%a"
#define PRILF "%s"
#define loggf(...) DebugLog(2, __VA_ARGS__)
//#define loggf(...) printf(__VA_ARGS__)
#define DISPLAY_ONLY_FAILED
//#define DISPLAY_START_INFO

View File

@ -0,0 +1,135 @@
//
// main.cpp
// Printf-UnitTests
//
// Created by Jief on 29/08/17.
// Copyright © 2017 Jief. All rights reserved.
//
#include <Platform.h>
#include <limits.h>
#include "unicode_conversions.h"
#include <poolprint-test-cpp_conf.h>
#include "poolprint-test.h"
static int nbTestFailed = 0;
#ifdef DISPLAY_ONLY_FAILED
static bool displayOnlyFailed = true;
#else
static bool displayOnlyFailed = false;
#endif
/*
* Print wchar string as a utf8 string.
* This eliminate all problems about wprintf and compilation with short-wchar or long-wchar I had on macOs (2020-03)
*/
static void print_wchar_string(const wchar_t* s)
{
// char utf8[wchar_len(s)*4+1];
// some compiler doesn't like variable length array.
// use a fixed length instead.
char utf8[200];
utf8_string_from_wchar_string(utf8, sizeof(utf8), s);
if ( strlen(utf8) > sizeof(utf8)-2 ) {
loggf("fixed size buf not big enough");
abort();
}
loggf("%s", utf8);
}
VOID
EFIAPI
_PoolCatPrint (
IN CONST CHAR16 *fmt,
IN VA_LIST args,
IN OUT POOL_PRINT *spc,
IN EFI_STATUS
(EFIAPI
*Output)
(
POOL_PRINT *context,
CHAR16 *str
)
);
#include "../libeg/FloatLib.h"
static int testPoolPrintFloat(const char* label, const wchar_t* expectResult, float param)
{
wchar_t* wbuf = PoolPrintFloat(param);
if ( memcmp(wbuf, expectResult, wchar_len(expectResult)*sizeof(expectResult[0])) != 0 ) {
// loggf(F(" -> ERROR. Expect " PRILF " and get %ls\n"), expectResult, buf);
// not using wprintf, it crashes sometimes, it doesn't work for short-wchar
loggf(F("%s -> ERROR. Expect "), label);
print_wchar_string(expectResult);
loggf(F(" and get "));
print_wchar_string(wbuf);
loggf("\n");
nbTestFailed += 1;
wchar_t* wbuf2 = PoolPrintFloat(param); // for stepping with a debugger.
FreePool(wbuf2);
}else if ( !displayOnlyFailed ) {
loggf(F("%s : "), label);
print_wchar_string(wbuf);
loggf(F(" -> OK\n"));
}
FreePool(wbuf);
return 1;
}
#define Test1arg(expectResult,param) \
{ \
char label[1024]; \
snprintf(label, sizeof(label), F("testPoolPrintFloat(%s)"), F(#param)); \
testPoolPrintFloat(label,L##expectResult,param); \
}
#define Test2arg(expectResult,format,c,d) \
{ \
char label[1024]; \
snprintf(label, sizeof(label), F("Test swprintf(%s, %s, %s)"), F(#format), F(#c), F(#d)); \
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c,d); \
}
#define Test5arg(expectResult,format,c,d,e,f,g) \
{ \
char label[1024]; \
snprintf(label, sizeof(label), F("Test swprintf(%s, %s, %s, %s, %s, %s)"), F(#format), F(#c), F(#d), F(#e), F(#f), F(#g)); \
testWPrintf(label,L##expectResult,(int)wcslen(L##expectResult),L##format,c,d,e,f,g); \
}
int poolprintfloat_tests(void)
{
#ifdef DISPLAY_START_INFO
loggf(F("\n"));
loggf(F("PoolPrintFloat unit test\n"));
loggf(F("\n"));
loggf(F("\n"));
// These depends on the plateform. They are not printf unit test, but it's nice to check size of builtin type.
loggf(F("sizeof(float)=%lu\n"), sizeof(float));
loggf(F("sizeof(double)=%zu\n"), sizeof(double));
loggf(F("\n"));
#endif
Test1arg(F(" 0.000000"), 0.0);
Test1arg(F(" 0.123456"), 0.1234567890);
Test1arg(F("-0.123456"), -0.1234567890);
Test1arg(F(" 1.100000"), 1.1);
Test1arg(F(" -1.100000"), -1.1);
Test1arg(F(" 123.456787"), 123.456789);
Test1arg(F(" -123.456787"), -123.456789);
Test1arg(F(" 1234567936.000000"), 1234567890.456789);
Test1arg(F(" -1234567936.000000"), -1234567890.456789);
Test1arg(F(" 0.000000"), 12345678901234567890.456789);
Test1arg(F(" 0.000000"), -12345678901234567890.456789);
return nbTestFailed;
}

View File

@ -0,0 +1 @@
int poolprintfloat_tests();

View File

@ -1,38 +0,0 @@
#include "panic.h"
#include <Platform.h>
//extern "C" {
//#include <Library/BaseLib.h> // for CpuDeadLoop
//}
bool stop_at_panic = true;
bool i_have_panicked = false;
/*
*
* Function panic_ seems useless. It's same as panic(). It's to be able to put a breakpoint in gdb with br panic_(). This is done in gdb_launch script in Qemu
*/
void panic_(const char* s)
{
if ( stop_at_panic ) {
if ( s ) DebugLog(2, "%a\n", s);
DebugLog(2, "A fatal error happened. System halted\n");
CpuDeadLoop();
}else{
// if ( s ) DebugLog(2, "%a\n", s);
// DebugLog(2, "A fatal error happened. Continue for testing\n");
i_have_panicked = true;
}
}
void panic(const char* s)
{
panic_(s);
}
void panic(void)
{
panic_(nullptr);
}

View File

@ -1,10 +0,0 @@
#ifndef __PANIC_H__
#define __PANIC_H__
extern bool stop_at_panic;
extern bool i_have_panicked;
void panic(void);
void panic(const char* s);
#endif

View File

@ -0,0 +1,13 @@
#include "../../Include/Library/printf_lite.h"
#define F(x) x
#define LF(x) L##x
#define PRIF "%a"
#define PRILF "%s"
//#define loggf(...) DebugLog(2, __VA_ARGS__)
#define loggf(...) printf(__VA_ARGS__)
//#define DISPLAY_ONLY_FAILED
#define DISPLAY_START_INFO

View File

@ -0,0 +1,12 @@
#define F(x) x
#define LF(x) L##x
#define PRIF "%a"
#define PRILF "%s"
#define loggf(...) DebugLog(2, __VA_ARGS__)
//#define loggf(...) printf(__VA_ARGS__)
#define DISPLAY_ONLY_FAILED
//#define DISPLAY_START_INFO

View File

@ -48,7 +48,8 @@
#define MAX_INT32 ((INT32)0x7FFFFFFF)
#define MAX_UINT32 ((UINT32)0xFFFFFFFF)
#define MAX_INT64 ((INT64)0x7FFFFFFFFFFFFFFFULL)
#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)
//#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)
#define MAX_UINT64 0xFFFFFFFFFFFFFFFFULL
#define UINTN uint64_t
#define INTN int64_t

View File

@ -0,0 +1,36 @@
//
// printf_lite.hpp
//
// Created by jief the 04 Apr 2019.
// Imported in CLover the 24 Feb 2020
//
#ifndef __PRINTF_LITE_CONF_H__
#define __PRINTF_LITE_CONF_H__
#include <stdarg.h>
#include <stddef.h> // for size_t
#ifndef __cplusplus
#ifdef _MSC_VER
typedef UINT16 wchar_t;
#endif
typedef UINT32 char32_t;
typedef UINT16 char16_t;
#endif
#ifdef _MSC_VER
# define __attribute__(x)
#endif
#ifdef DEBUG
#define DEFINE_SECTIONS 0
#endif
#define PRINTF_CFUNCTION_PREFIX
#define PRINTF_CFUNCTION_SUFFIX fl
#define PRINTF_EMIT_CR 0
#endif // __PRINTF_LITE_CONF_H__

View File

@ -0,0 +1,12 @@
#define F(x) x
#define LF(x) L##x
#define PRIF "%s"
#define PRILF "%ls"
#define loggf(...) DebugLog(2, __VA_ARGS__)
//#define loggf(...) printf(__VA_ARGS__)
#define DISPLAY_ONLY_FAILED
//#define DISPLAY_START_INFO

View File

@ -0,0 +1,12 @@
#define F(x) x
#define LF(x) L##x
#define PRIF "%s"
#define PRILF "%ls"
//#define loggf(...) DebugLog(2, __VA_ARGS__)
#define loggf(...) printf(__VA_ARGS__)
//#define DISPLAY_ONLY_FAILED
#define DISPLAY_START_INFO

View File

@ -38,7 +38,7 @@ VOID
EFIAPI
DebugLog (
IN INTN DebugMode,
IN CONST CHAR8 *FormatString, ...) __attribute__((format(printf, 2, 3)));;
IN CONST CHAR8 *FormatString, ...) __attribute__((format(printf, 2, 3)));
#endif

View File

@ -14,8 +14,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//#include "device_tree.h"
#include "kernel_patcher.h"
#ifndef DEBUG_ALL
#define PATCH_DEBUG 0
#define MEM_DEB 0
#else
#define PATCH_DEBUG DEBUG_ALL
#define MEM_DEB DEBUG_ALL
#endif
#if PATCH_DEBUG
#define DBG(...) Print(__VA_ARGS__);

View File

@ -662,7 +662,7 @@ VOID CheckHardware()
#if DEBUG_FIX
dadr1 = DisplayADR1[display];
dadr2 = DisplayADR2[display];
DBG("DisplayADR1[%d] = 0x%X, DisplayADR2[%d] = 0x%X\n", display, dadr1, display, dadr2);
DBG("DisplayADR1[%llu] = 0x%X, DisplayADR2[%llu] = 0x%X\n", display, dadr1, display, dadr2);
#endif
// dadr2 = dadr1; //to avoid warning "unused variable" :(
DisplayVendor[display] = Pci.Hdr.VendorId;
@ -749,7 +749,7 @@ VOID CheckHardware()
USBIntel = (Pci.Hdr.VendorId == 0x8086);
USBNForce = (Pci.Hdr.VendorId == 0x10de);
GetPciADR(DevicePath, &USBADR[usb], &USBADR2[usb], &USBADR3[usb]);
DBG("USBADR[%d] = 0x%X and PCIe = 0x%X\n", usb, USBADR[usb], USBADR2[usb]);
DBG("USBADR[%llu] = 0x%X and PCIe = 0x%X\n", usb, USBADR[usb], USBADR2[usb]);
if (USBIDFIX)
{
if (USBADR[usb] == 0x001D0000 && !NativeUSB(DID)) DID = 0x3a34;
@ -1492,7 +1492,7 @@ INTN ReplaceName(UINT8 *dsdt, UINT32 len, CONST CHAR8 *OldName, CONST CHAR8 *New
if (OldName) {
MsgLog("NewName %s already present, renaming impossible\n", NewName);
} else {
DBG("name %s present at %X\n", NewName, i);
DBG("name %s present at %llX\n", NewName, i);
}
return -1;
}
@ -2795,7 +2795,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
}
if (!PCISIZE) return len; //what is the bad DSDT ?!
DBG("Start HDMI%d Fix\n");
DBG("Start HDMI Fix\n");
// Device Address
for (i=0x20; len >= 10 && i < len - 10; i++) {
if (CmpAdr(dsdt, i, HDMIADR1)) {
@ -5346,7 +5346,7 @@ VOID RenameDevices(UINT8* table)
if (CmpFullName(table + k, len - k, Bridge)) {
CopyMem(table + adr, Replace, 4);
adr += 5;
DBG("found Bridge device begin=%X end=%X\n", k, k+size);
DBG("found Bridge device begin=%llX end=%llX\n", k, k+size);
// DBG(" name copied\n");
Num++;
break; //cancel search outer bridge, we found it.

View File

@ -13,6 +13,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "LegacyBiosThunk.h"
#include <posix.h>
#include "BootLog.h" // for DebugLog
#include "../refit/screen.h" // just for PauseForKey
#ifndef DEBUG_ALL
#define DEBUG_LBTHUNK 0

View File

@ -94,7 +94,9 @@ extern "C" {
#include "../cpp_util/remove_ref.h"
#endif
#include "BootLog.h"
#include "../refit/lib.h"
#include "../refit/screen.h" // for PauseForKey
#include "string.h"
#include "boot.h"
//#include "PiBootMode.h"

View File

@ -27,24 +27,24 @@ int printf(const char* format, ...)
static XString stdio_static_buf;
char* strerror(EFI_STATUS Status)
const char* strerror(EFI_STATUS Status)
{
UINTN n = 0;
do {
stdio_static_buf.CheckSize(stdio_static_buf.length()+10);
n = AsciiSPrint(stdio_static_buf.data(), stdio_static_buf.m_allocatedSize, "%r", Status);
} while ( n > stdio_static_buf.m_allocatedSize - 2 );
n = AsciiSPrint(stdio_static_buf.dataSized(0, stdio_static_buf.allocatedSize()), stdio_static_buf.allocatedSize(), "%r", Status);
} while ( n > stdio_static_buf.allocatedSize() - 2 );
return stdio_static_buf.data();
}
char* strguid(EFI_GUID* guid)
const char* strguid(EFI_GUID* guid)
{
UINTN n = 0;
do {
stdio_static_buf.CheckSize(stdio_static_buf.length()+10);
n = AsciiSPrint(stdio_static_buf.data(), stdio_static_buf.m_allocatedSize, "%g", guid);
} while ( n > stdio_static_buf.m_allocatedSize - 2 );
n = AsciiSPrint(stdio_static_buf.dataSized(0, stdio_static_buf.allocatedSize()), stdio_static_buf.allocatedSize(), "%g", guid);
} while ( n > stdio_static_buf.allocatedSize() - 2 );
return stdio_static_buf.data();
}

View File

@ -16,8 +16,8 @@ int printf(const char* format, ...) __attribute__((format(printf, 1, 2)));
//int snprintf(char* str, size_t size, const char* format, ...) __attribute__((format(printf, 1, 2)));;
char* strerror(EFI_STATUS errnum);
char* strguid(EFI_GUID* guid);
const char* strerror(EFI_STATUS errnum);
const char* strguid(EFI_GUID* guid);

View File

@ -995,45 +995,45 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
SetUGAWidth = TRUE;
if(UGAHeight == 120) {
SetUGAHeight = TRUE;
DBG (" Found quarter quarter VGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found quarter quarter VGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 240:
SetUGAWidth = TRUE;
if(UGAHeight == 160) {
SetUGAHeight = TRUE;
DBG (" Found Half quarter VGA Display - 3:2 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Half quarter VGA Display - 3:2 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 320:
SetUGAWidth = TRUE;
if(UGAHeight == 240) {
SetUGAHeight = TRUE;
DBG (" Found quarter VGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found quarter VGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 400:
SetUGAWidth = TRUE;
if(UGAHeight == 240) {
SetUGAHeight = TRUE;
DBG (" Found Wide quarter VGA Display - 5:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide quarter VGA Display - 5:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 480:
SetUGAWidth = TRUE;
if(UGAHeight == 320) {
SetUGAHeight = TRUE;
DBG (" Found Half-size VGA Display - 3:2 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Half-size VGA Display - 3:2 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 640:
@ -1041,14 +1041,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 360:
SetUGAHeight = TRUE;
DBG (" Found one ninth of a Full HD Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found one ninth of a Full HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 480:
SetUGAHeight = TRUE;
DBG (" Found VGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found VGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1057,14 +1057,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 480:
SetUGAHeight = TRUE;
DBG (" Found Wide VGA Display - 5:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide VGA Display - 5:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 600:
SetUGAHeight = TRUE;
DBG (" Found Super VGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Super VGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1072,9 +1072,9 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
SetUGAWidth = TRUE;
if(UGAHeight == 480) {
SetUGAHeight = TRUE;
DBG (" Found Full Wide VGA Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Full Wide VGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 960:
@ -1082,14 +1082,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 540:
SetUGAHeight = TRUE;
DBG (" Found one quarter of Full HD Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found one quarter of Full HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 640:
SetUGAHeight = TRUE;
DBG (" Found Double-size VGA Display - 3:2 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Double-size VGA Display - 3:2 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1098,18 +1098,18 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 576:
SetUGAHeight = TRUE;
DBG (" Found Wide Super VGA Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Super VGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 600:
SetUGAHeight = TRUE;
DBG (" Found Wide Super VGA Display - 17:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Super VGA Display - 17:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 768:
SetUGAHeight = TRUE;
DBG (" Found XGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1117,9 +1117,9 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
SetUGAWidth = TRUE;
if(UGAHeight == 864) {
SetUGAHeight = TRUE;
DBG (" Found XGA Plus Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found XGA Plus Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 1280:
@ -1127,22 +1127,22 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 720:
SetUGAHeight = TRUE;
DBG (" Found HD Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 768:
SetUGAHeight = TRUE;
DBG (" Found Wide XGA Display - 5:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide XGA Display - 5:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 800:
SetUGAHeight = TRUE;
DBG (" Found Wide XGA Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 1024:
SetUGAHeight = TRUE;
DBG (" Found Super XGA Display - 5:4 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Super XGA Display - 5:4 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1150,27 +1150,27 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
SetUGAWidth = TRUE;
if(UGAHeight == 768) {
SetUGAHeight = TRUE;
DBG (" Found Full Wide XGA Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Full Wide XGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 1400:
SetUGAWidth = TRUE;
if(UGAHeight == 1050) {
SetUGAHeight = TRUE;
DBG (" Found Super XGA Plus Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Super XGA Plus Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 1440:
SetUGAWidth = TRUE;
if(UGAHeight == 900) {
SetUGAHeight = TRUE;
DBG (" Found Wide XGA Plus Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide XGA Plus Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 1600:
@ -1178,14 +1178,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 900:
SetUGAHeight = TRUE;
DBG (" Found HD Plus Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found HD Plus Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 1200:
SetUGAHeight = TRUE;
DBG (" Found Ultra XGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Ultra XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1194,10 +1194,10 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 1050:
SetUGAHeight = TRUE;
DBG (" Found Widescreen Super XGA Plus Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Widescreen Super XGA Plus Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1206,14 +1206,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 1080:
SetUGAHeight = TRUE;
DBG (" Found Full HD Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Full HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 1200:
SetUGAHeight = TRUE;
DBG (" Found Wide Ultra XGA Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Ultra XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1222,14 +1222,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 1152:
SetUGAHeight = TRUE;
DBG (" Found Quad Wide XGA Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Quad Wide XGA Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 1536:
SetUGAHeight = TRUE;
DBG (" Found Quad XGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Quad XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1238,18 +1238,18 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 1440:
SetUGAHeight = TRUE;
DBG (" Found Quad HD Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Quad HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 1600:
SetUGAHeight = TRUE;
DBG (" Found Wide Quad XGA Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Quad XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 2048:
SetUGAHeight = TRUE;
DBG (" Found Quad Wide XGA Display - 5:4 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Quad Wide XGA Display - 5:4 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1257,9 +1257,9 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
SetUGAWidth = TRUE;
if(UGAHeight == 1800) {
SetUGAHeight = TRUE;
DBG (" Found Wide Quad XGA Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Quad XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 3200:
@ -1267,18 +1267,18 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 1800:
SetUGAHeight = TRUE;
DBG (" Found Quad HD Plus Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Quad HD Plus Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 2048:
SetUGAHeight = TRUE;
DBG (" Found Wide Quad Super XGA Display - 25:16 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Quad Super XGA Display - 25:16 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 2400:
SetUGAHeight = TRUE;
DBG (" Found Quad Ultra XGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Quad Ultra XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1287,14 +1287,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 2160:
SetUGAHeight = TRUE;
DBG (" Found Ultra HD, 4K Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Ultra HD, 4K Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 2400:
SetUGAHeight = TRUE;
DBG (" Found Wide Quad Ultra XGA Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Quad Ultra XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1302,9 +1302,9 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
SetUGAWidth = TRUE;
if(UGAHeight == 3072) {
SetUGAHeight = TRUE;
DBG (" Found Hex XGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Hex XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
} else {
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
}
break;
case 5120:
@ -1312,18 +1312,18 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 2880:
SetUGAHeight = TRUE;
DBG (" Found Ultra HD Plus Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Ultra HD Plus Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 3200:
SetUGAHeight = TRUE;
DBG (" Found Wide Hex XGA Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Hex XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 4096:
SetUGAHeight = TRUE;
DBG (" Found Hex Super XGA Display - 5:4 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Hex Super XGA Display - 5:4 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1332,14 +1332,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 4096:
SetUGAHeight = TRUE;
DBG (" Found Wide Hex Super XGA Display - 25:16 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Hex Super XGA Display - 25:16 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 4800:
SetUGAHeight = TRUE;
DBG (" Found Hex Ultra XGA Display - 4:3 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Hex Ultra XGA Display - 4:3 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
@ -1348,19 +1348,19 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (UGAHeight) {
case 4320:
SetUGAHeight = TRUE;
DBG (" Found Full Ultra HD Display - 16:9 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Full Ultra HD Display - 16:9 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
case 4800:
SetUGAHeight = TRUE;
DBG (" Found Wide Hex Ultra XGA Display - 16:10 :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Wide Hex Ultra XGA Display - 16:10 :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
break;
default:
DBG (" Found Unknown Resolution Display - ?:? :: Width=%d Height=%d\n", UGAWidth, UGAHeight);
DBG (" Found Unknown Resolution Display - ?:? :: Width=%lld Height=%lld\n", UGAWidth, UGAHeight);
break;
}
@ -1670,7 +1670,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x27AE: // "Intel GMA 950" // Mobile - Intel 945GM Express Chipset Family
if (!SetFake) {
FakeID = 0x27A28086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x27A28086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -1724,7 +1724,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0xA012: // "Intel GMA 3150" // Netbook - Intel NetBook Atom N4x0
if (!SetFake) {
FakeID = 0x27A28086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x27A28086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -1788,7 +1788,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x2A13: // "Intel GMA X3100" // Mobile - Intel 965 Express Chipset Family
if (!SetFake) {
FakeID = 0x2A028086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x2A028086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -1864,14 +1864,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (gma_dev->device_id) {
case 0x0042:
FakeID = 0x00428086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x00428086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
break;
case 0x0046:
FakeID = 0x00468086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x00468086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -1916,7 +1916,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
switch (gma_dev->device_id) {
case 0x0116:
FakeID = 0x01168086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x01168086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -1928,7 +1928,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x0122:
case 0x0126:
FakeID = 0x01268086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x01268086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2009,7 +2009,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x015A:
if (!SetFake) {
FakeID = 0x01528086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x01528086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2022,7 +2022,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x0156:
if (!SetFake) {
FakeID = 0x01568086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x01568086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2036,7 +2036,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x016A:
if (!SetFake) {
FakeID = 0x01628086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x01628086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2049,7 +2049,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x0166:
if (!SetFake) {
FakeID = 0x01668086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x01668086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2171,14 +2171,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x0D12:
case 0x0D16:
FakeID = 0x04128086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x04128086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
break;
case 0x0A26:
FakeID = 0x0A268086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x0A268086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2188,7 +2188,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x0A2B:
case 0x0A2E:
FakeID = 0x0A2E8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x0A2E8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2198,14 +2198,14 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x0D2B:
case 0x0D2E:
FakeID = 0x0D228086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x0D228086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
break;
case 0x0D26:
FakeID = 0x0D268086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x0D268086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2293,7 +2293,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1612:
if (!SetFake) {
FakeID = 0x16128086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x16128086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2306,7 +2306,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1616:
if (!SetFake) {
FakeID = 0x16168086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x16168086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2319,7 +2319,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x161E:
if (!SetFake) {
FakeID = 0x161E8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x161E8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2332,7 +2332,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1626:
if (!SetFake) {
FakeID = 0x16268086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x16268086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2345,7 +2345,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x162B:
if (!SetFake) {
FakeID = 0x162B8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x162B8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2360,7 +2360,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x162D:
if (!SetFake) {
FakeID = 0x16228086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x16228086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2434,7 +2434,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1906:
if (!SetFake) {
FakeID = 0x19028086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19028086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2447,7 +2447,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1912:
if (!SetFake) {
FakeID = 0x19128086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19128086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2461,7 +2461,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1921:
if (!SetFake) {
FakeID = 0x19168086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19168086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2476,7 +2476,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1923:
if (!SetFake) {
FakeID = 0x191B8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x191B8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2489,7 +2489,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x191E:
if (!SetFake) {
FakeID = 0x191E8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x191E8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2502,7 +2502,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x1926:
if (!SetFake) {
FakeID = 0x19268086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19268086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2517,7 +2517,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x192D:
if (!SetFake) {
FakeID = 0x19278086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19278086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2533,7 +2533,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x193D:
if (!SetFake) {
FakeID = 0x193B8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x193B8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2644,7 +2644,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x19028086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19028086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2656,7 +2656,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59028086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59028086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2671,7 +2671,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x19128086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19128086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2683,7 +2683,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59128086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59128086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2699,7 +2699,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x19168086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19168086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2711,7 +2711,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59168086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59168086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2728,7 +2728,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x191B8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x191B8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2740,7 +2740,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x591B8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x591B8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2756,7 +2756,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x191E8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x191E8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2768,7 +2768,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x591E8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x591E8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2783,7 +2783,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x19168086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19168086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2795,7 +2795,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59238086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59238086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2810,7 +2810,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x19268086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19268086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2822,7 +2822,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59268086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59268086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2837,7 +2837,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x19278086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x19278086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2849,7 +2849,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59278086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59278086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2865,7 +2865,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
if (os_version < AsciiOSVersionToUint64("10.12.6")) {
if (!SetFake) {
FakeID = 0x191E8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x191E8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2877,7 +2877,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else if (os_version < AsciiOSVersionToUint64("10.14")) {
if (!SetFake) {
FakeID = 0x591E8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x591E8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -2889,7 +2889,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x87C08086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x87C08086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3008,7 +3008,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
(AsciiStrStr(Entry->BuildVersion, "17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
if (!SetFake) {
FakeID = 0x3E908086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x3E908086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3020,7 +3020,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59028086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59028086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3036,7 +3036,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
(AsciiStrStr(Entry->BuildVersion, "17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
if (!SetFake) {
FakeID = 0x3E918086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x3E918086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3048,7 +3048,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59128086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59128086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3065,7 +3065,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
(AsciiStrStr(Entry->BuildVersion, "17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
if (!SetFake) {
FakeID = 0x3E928086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x3E928086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3077,7 +3077,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59128086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59128086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3096,7 +3096,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
(AsciiStrStr(Entry->BuildVersion, "17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
if (!SetFake) {
FakeID = 0x3E9B8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x3E9B8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3108,7 +3108,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x591B8086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x591B8086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3124,7 +3124,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
(AsciiStrStr(Entry->BuildVersion, "17G2") || FileExists(Entry->Volume->RootDir, CFLFBPath)))) {
if (!SetFake) {
FakeID = 0x3EA58086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x3EA58086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3136,7 +3136,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
} else {
if (!SetFake) {
FakeID = 0x59278086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x59278086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3222,7 +3222,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x0A01:
if (!SetFake) {
FakeID = 0x0A018086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x0A018086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3235,7 +3235,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x5A40:
if (!SetFake) {
FakeID = 0x5A408086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x5A408086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3248,7 +3248,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x5A41:
if (!SetFake) {
FakeID = 0x5A418086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x5A418086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3261,7 +3261,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x5A49:
if (!SetFake) {
FakeID = 0x5A498086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x5A498086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3274,7 +3274,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x5A50:
if (!SetFake) {
FakeID = 0x5A508086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x5A508086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3287,7 +3287,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x5A51:
if (!SetFake) {
FakeID = 0x5A518086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x5A518086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3301,7 +3301,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x5A54:
if (!SetFake) {
FakeID = 0x5A528086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x5A528086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);
@ -3314,7 +3314,7 @@ BOOLEAN setup_gma_devprop(LOADER_ENTRY *Entry, pci_dt_t *gma_dev)
case 0x5A59:
if (!SetFake) {
FakeID = 0x5A598086 >> 16;
DBG(" Found FakeID Intel GFX = 0x%04lx8086\n", FakeID);
DBG(" Found FakeID Intel GFX = 0x%04x8086\n", FakeID);
devprop_add_value(device, "device-id", (UINT8*)&FakeID, 4);
FakeID = 0x5A598086 & 0xFFFF;
devprop_add_value(device, "vendor-id", (UINT8*)&FakeID, 4);

View File

@ -14,10 +14,15 @@
#include "sse3_patcher.h"
#include "sse3_5_patcher.h"
#ifndef DEBUG_ALL
#define KERNEL_DEBUG 0
#else
#define KERNEL_DEBUG DEBUG_ALL
#endif
#if KERNEL_DEBUG
#define DBG(...) AsciiPrint(__VA_ARGS__);
#define DBG(...) printf(__VA_ARGS__);
#else
#define DBG(...)
#endif
@ -325,7 +330,7 @@ VOID KernelPatcher_32(VOID* kernelData, CHAR8 *OSVersion)
}
if (!patchLocation) {
DBG("Can't find _cpuid_set_info _panic address, patch kernel abort.\n",i);
DBG("Can't find _cpuid_set_info _panic address, patch kernel abort.\n"/*,i*/);
return;
}
@ -1571,7 +1576,7 @@ VOID Get_PreLink()
PrelinkTextSize = (UINT32)segCmd64->vmsize;
PrelinkTextLoadCmdAddr = (UINT32)(UINTN)segCmd64;
}
DBG("at %p: vmaddr = 0x%lx, vmsize = 0x%lx\n", segCmd64, segCmd64->vmaddr, segCmd64->vmsize);
DBG("at %p: vmaddr = 0x%llx, vmsize = 0x%llx\n", segCmd64, segCmd64->vmaddr, segCmd64->vmsize);
DBG("PrelinkTextLoadCmdAddr = 0x%X, PrelinkTextAddr = 0x%X, PrelinkTextSize = 0x%X\n",
PrelinkTextLoadCmdAddr, PrelinkTextAddr, PrelinkTextSize);
//DBG("cmd = 0x%08X\n",segCmd64->cmd);
@ -1592,8 +1597,8 @@ VOID Get_PreLink()
DBG("Found PRELINK_INFO, 64bit\n");
//DBG("cmd = 0x%08X\n",segCmd64->cmd);
//DBG("cmdsize = 0x%08X\n",segCmd64->cmdsize);
DBG("vmaddr = 0x%08X\n",segCmd64->vmaddr);
DBG("vmsize = 0x%08X\n",segCmd64->vmsize);
DBG("vmaddr = 0x%08llX\n",segCmd64->vmaddr);
DBG("vmsize = 0x%08llX\n",segCmd64->vmsize);
//DBG("fileoff = 0x%08X\n",segCmd64->fileoff);
//DBG("filesize = 0x%08X\n",segCmd64->filesize);
//DBG("maxprot = 0x%08X\n",segCmd64->maxprot);
@ -1614,7 +1619,7 @@ VOID Get_PreLink()
PrelinkInfoAddr = (UINT32)(sect->addr ? sect->addr + KernelRelocBase : 0);
PrelinkInfoSize = (UINT32)sect->size;
}
DBG("__info found at %p: addr = 0x%lx, size = 0x%lx\n", sect, sect->addr, sect->size);
DBG("__info found at %p: addr = 0x%llx, size = 0x%llx\n", sect, sect->addr, sect->size);
DBG("PrelinkInfoLoadCmdAddr = 0x%X, PrelinkInfoAddr = 0x%X, PrelinkInfoSize = 0x%X\n",
PrelinkInfoLoadCmdAddr, PrelinkInfoAddr, PrelinkInfoSize);
}
@ -1635,7 +1640,7 @@ VOID Get_PreLink()
PrelinkTextSize = (UINT32)segCmd->vmsize;
PrelinkTextLoadCmdAddr = (UINT32)(UINTN)segCmd;
}
DBG("at %p: vmaddr = 0x%lx, vmsize = 0x%lx\n", segCmd, segCmd->vmaddr, segCmd->vmsize);
DBG("at %p: vmaddr = 0x%x, vmsize = 0x%x\n", segCmd, segCmd->vmaddr, segCmd->vmsize);
DBG("PrelinkTextLoadCmdAddr = 0x%X, PrelinkTextAddr = 0x%X, PrelinkTextSize = 0x%X\n",
PrelinkTextLoadCmdAddr, PrelinkTextAddr, PrelinkTextSize);
//gBS->Stall(30*1000000);
@ -1668,7 +1673,7 @@ VOID Get_PreLink()
PrelinkInfoAddr = (UINT32)(sect->addr ? sect->addr + KernelRelocBase : 0);
PrelinkInfoSize = (UINT32)sect->size;
}
DBG("__info found at %p: addr = 0x%lx, size = 0x%lx\n", sect, sect->addr, sect->size);
DBG("__info found at %p: addr = 0x%x, size = 0x%x\n", sect, sect->addr, sect->size);
DBG("PrelinkInfoLoadCmdAddr = 0x%X, PrelinkInfoAddr = 0x%X, PrelinkInfoSize = 0x%X\n",
PrelinkInfoLoadCmdAddr, PrelinkInfoAddr, PrelinkInfoSize);
//gBS->Stall(30*1000000);
@ -1840,7 +1845,7 @@ KernelAndKextPatcherInit(IN LOADER_ENTRY *Entry)
// KernelRelocBase will normally be 0
// but if OsxAptioFixDrv is used, then it will be > 0
SetKernelRelocBase();
DBG("KernelRelocBase = %lx\n", KernelRelocBase);
DBG("KernelRelocBase = %llx\n", KernelRelocBase);
// Find bootArgs - we need then for proper detection
// of kernel Mach-O header

View File

@ -1,11 +1,17 @@
#include "Platform.h"
#ifndef DEBUG_ALL
#define KEXT_INJECT_DEBUG 0
#else
#define KEXT_INJECT_DEBUG DEBUG_ALL
#endif
#if KEXT_INJECT_DEBUG == 2
#define DBG(...) MsgLog(__VA_ARGS__)
#elif KEXT_INJECT_DEBUG == 1
#define DBG(...) AsciiPrint(__VA_ARGS__);
#define DBG(...) printf(__VA_ARGS__);
#else
#define DBG(...)
#endif

View File

@ -9,10 +9,15 @@
#include "kernel_patcher.h"
#ifndef DEBUG_ALL
#define KEXT_DEBUG 0
#else
#define KEXT_DEBUG DEBUG_ALL
#endif
#if KEXT_DEBUG
#define DBG(...) Print(__VA_ARGS__);
#define DBG(...) printf(__VA_ARGS__);
#else
#define DBG(...)
#endif
@ -1160,14 +1165,14 @@ UINT64 GetPlistHexValue(CONST CHAR8 *Plist, CONST CHAR8 *Key, CONST CHAR8 *Whole
// search for <integer
IntTag = AsciiStrStr(Value, "<integer");
if (IntTag == NULL) {
DBG(L"\nNo integer\n");
DBG("\nNo integer\n");
return 0;
}
// find <integer end
Value = AsciiStrStr(IntTag, ">");
if (Value == NULL) {
DBG(L"\nNo <integer end\n");
DBG("\nNo <integer end\n");
return 0;
}
@ -1182,7 +1187,7 @@ UINT64 GetPlistHexValue(CONST CHAR8 *Plist, CONST CHAR8 *Key, CONST CHAR8 *Whole
// it might be a reference: IDREF="173"/>
Value = AsciiStrStr(IntTag, "<integer IDREF=\"");
if (Value != IntTag) {
DBG(L"\nNo <integer IDREF=\"\n");
DBG("\nNo <integer IDREF=\"\n");
return 0;
}
@ -1197,7 +1202,7 @@ UINT64 GetPlistHexValue(CONST CHAR8 *Plist, CONST CHAR8 *Key, CONST CHAR8 *Whole
}
*/
if (IDLen > 8) {
DBG(L"\nIDLen too big\n");
DBG("\nIDLen too big\n");
return 0;
}
AsciiStrCpyS(Buffer, 48, "<integer ID=\"");
@ -1212,7 +1217,7 @@ UINT64 GetPlistHexValue(CONST CHAR8 *Plist, CONST CHAR8 *Key, CONST CHAR8 *Whole
// and search whole plist for ID
IntTag = AsciiStrStr(WholePlist, Buffer);
if (IntTag == NULL) {
DBG(L"\nNo %s\n", Buffer);
DBG("\nNo %s\n", Buffer);
return 0;
}
@ -1225,11 +1230,11 @@ UINT64 GetPlistHexValue(CONST CHAR8 *Plist, CONST CHAR8 *Key, CONST CHAR8 *Whole
*/
Value = AsciiStrStr(IntTag, ">");
if (Value == NULL) {
DBG(L"\nNo <integer end\n");
DBG("\nNo <integer end\n");
return 0;
}
if (Value[-1] == '/') {
DBG(L"\nInvalid <integer IDREF end\n");
DBG("\nInvalid <integer IDREF end\n");
return 0;
}
@ -1382,7 +1387,7 @@ VOID PatchLoadedKexts(LOADER_ENTRY *Entry)
//UINTN DbgCount = 0;
DBG(L"\nPatchLoadedKexts ... dtRoot = %p\n", dtRoot);
DBG("\nPatchLoadedKexts ... dtRoot = %p\n", dtRoot);
if (!dtRoot || !dtLength) {
return;

View File

@ -898,13 +898,13 @@ VOID ScanSPD()
//SmBus controller has class = 0x0c0500
if ((gPci.Hdr.ClassCode[2] == 0x0c) && (gPci.Hdr.ClassCode[1] == 5)
&& (gPci.Hdr.ClassCode[0] == 0) && (gPci.Hdr.VendorId == 0x8086 || gPci.Hdr.VendorId == 0x10DE)) {
DBG ("SMBus device : %04X %04X class=%02X%02X%02X status=%r\n",
DBG ("SMBus device : %04X %04X class=%02X%02X%02X status=%s\n",
gPci.Hdr.VendorId,
gPci.Hdr.DeviceId,
gPci.Hdr.ClassCode[2],
gPci.Hdr.ClassCode[1],
gPci.Hdr.ClassCode[0],
Status
strerror(Status)
);
read_smb(PciIo, gPci.Hdr.VendorId, gPci.Hdr.DeviceId);
}

View File

@ -176,7 +176,7 @@ FixOwnership(VOID)
// read PCI Config 32bit USBLEGCTLSTS (eecp+4)
PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, ExtendCap + 0x4, 1, &usblegctlsts);
DBG("usblegsup=%08X isOSowned=%d isBIOSowned=%d usblegctlsts=%08X\n", usblegsup, isOSowned, isBIOSowned, usblegctlsts);
DBG("usblegsup=%08X isOSowned=%llu isBIOSowned=%llu usblegctlsts=%08X\n", usblegsup, isOSowned, isBIOSowned, usblegctlsts);
//
// Disable the SMI in USBLEGCTLSTS firstly
//
@ -216,7 +216,7 @@ FixOwnership(VOID)
// read 32bit USBLEGCTLSTS (eecp+4)
PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, ExtendCap + 0x4, 1, &usblegctlsts);
DBG("usblegsup=%08X isOSowned=%d isBIOSowned=%d usblegctlsts=%08X\n", usblegsup, isOSowned, isBIOSowned, usblegctlsts);
DBG("usblegsup=%08X isOSowned=%llu isBIOSowned=%llu usblegctlsts=%08X\n", usblegsup, isOSowned, isBIOSowned, usblegctlsts);
MsgLog("Legacy USB Off Done\n");

View File

@ -33,13 +33,13 @@ const XString NullXString;
void XString::Init(xsize aSize)
{
c = (char*)malloc( (aSize+1)*sizeof(char) ); /* le 0 terminal n'est pas compté dans mSize */
if ( !c ) {
DebugLog(2, "XString::Init(%d) : Xalloc returned NULL. Cpu halted\n", (aSize+1)*sizeof(char));
m_data = (char*)malloc( (aSize+1)*sizeof(char) ); /* le 0 terminal n'est pas compté dans mSize */
if ( !m_data ) {
DebugLog(2, "XString::Init(%llu) : Xalloc returned NULL. Cpu halted\n", (aSize+1)*sizeof(char));
panic();
}
m_allocatedSize = aSize;
c[0] = 0;
m_data[0] = 0;
}
XString::XString()
@ -51,13 +51,13 @@ XString::XString()
XString::~XString()
{
//Debugf("Destructeur :%s\n", c);
delete c;
delete m_data;
}
void XString::SetLength(xsize len)
void XString::setLength(xsize len)
{
CheckSize(len);
c[len] = 0;
m_data[len] = 0;
}
/* CheckSize() */
@ -67,14 +67,14 @@ char *XString::CheckSize(xsize nNewSize, xsize nGrowBy)
{
nNewSize += nGrowBy;
c = (char*)realloc(c, (nNewSize+1)*sizeof(char), m_allocatedSize*sizeof(wchar_t));
if ( !c ) {
m_data = (char*)realloc(m_data, (nNewSize+1)*sizeof(char), m_allocatedSize*sizeof(wchar_t));
if ( !m_data ) {
DBG("XString::CheckSize(%d, %d) : Xrealloc(%d, %d, %d) returned NULL. System halted\n", nNewSize, nGrowBy, m_size, (nNewSize+1)*sizeof(char), c);
panic();
}
m_allocatedSize = nNewSize;
}
return c;
return m_data;
}
void XString::StrnCpy(const char *buf, xsize len)
@ -82,11 +82,11 @@ void XString::StrnCpy(const char *buf, xsize len)
if ( buf && *buf && len > 0 ) {
CheckSize(len, 0);
xsize idx = 0;
char* p = data();
char* p = _data(0);
while ( idx++ < len && (*p++ = *buf++) != 0 );
SetLength(idx-1); /* SetLength fait _Data[len]=0 */
setLength(idx-1); /* SetLength fait _Data[len]=0 */
}else{
SetLength(0); /* SetLength fait _Data[len]=0 */
setLength(0); /* SetLength fait _Data[len]=0 */
}
}
@ -95,7 +95,7 @@ void XString::StrCpy(const char *buf)
if ( buf && *buf ) {
StrnCpy(buf, (xsize)strlen(buf)); // overflow ?
}else{
SetLength(0); /* SetLength fait _Data[len]=0 */
setLength(0); /* SetLength fait _Data[len]=0 */
}
}
@ -107,16 +107,16 @@ void XString::StrnCat(const char *buf, xsize len)
if ( buf && *buf && len > 0 ) {
NewLen = length()+len;
CheckSize(NewLen, 0);
memcpy(data()+length(), buf, len);
SetLength(NewLen); /* SetLength fait data()[len]=0 */
memcpy(_data(0)+length(), buf, len);
setLength(NewLen); /* SetLength fait data()[len]=0 */
}
}
void XString::Cat(const XString &uneXString)
{
CheckSize(length()+uneXString.length());
memcpy(data()+length(), uneXString.c, uneXString.length());
SetLength(length() + uneXString.length());
memcpy(_data(0)+length(), uneXString.m_data, uneXString.length());
setLength(length() + uneXString.length());
}
void XString::StrCat(const char *buf)
@ -130,11 +130,11 @@ void XString::Delete(xsize pos, xsize count)
{
if ( pos < length() ) {
if ( count != MAX_XSIZE && pos + count < length() ) {
memmove( data()+pos, data()+pos+count, length()-pos-count);
SetLength(length()-count);
memmove(_data(0)+pos, data()+pos+count, length()-pos-count);
setLength(length()-count);
// data()[length()] = 0; fait dans setlength();
}else{
SetLength(pos);
setLength(pos);
// data()[length()] = 0; fait dans setlength();
}
}
@ -144,8 +144,8 @@ void XString::Insert(xsize pos, const XString& Str)
{
if ( pos < length() ) {
CheckSize(length()+Str.length());
memmove(data()+pos+Str.length(), data()+pos, length()-pos+1); // +1 to copy the NULL terminator
memcpy(data()+pos, Str.data(), Str.length());
memmove(_data(0)+pos+Str.length(), data()+pos, length()-pos+1); // +1 to copy the NULL terminator
memcpy(_data(0)+pos, Str.data(), Str.length());
}else{
StrCat(Str);
}
@ -274,7 +274,7 @@ static void XString_transmitSPrintf(const char* buf, unsigned int nbchar, void*
XString& XString::vSPrintf(const char* format, va_list va)
{
SetLength(0);
setLength(0);
// XString_sprintfBuf = this;
vprintf_with_callback(format, va, XString_transmitSPrintf, this);
@ -316,7 +316,7 @@ XString& XString::SPrintf(const char *Format, ...)
// Deactivate assignment during refactoring to avoid confusion
XString XString::basename() const
{
if ( LastChar() == PATH_SEPARATOR ) {
if ( lastChar() == PATH_SEPARATOR ) {
DebugLog(2, "XString::basename() -> LastChar() == PATH_SEPARATOR");
panic();
}
@ -641,20 +641,20 @@ bool XString::IsLettersNoAccent() const
}
#endif
void XString::RemoveLastEspCtrl()
void XString::removeLastEspCtrl()
{
char *p;
if ( length() > 0 ) {
p = data() + length() - 1;
p = _data(0) + length() - 1;
if ( *p >= 0 && *p <= ' ' ) {
p -= 1;
while ( p>data() && *p >= 0 && *p <= ' ' ) p -= 1;
if ( p>data() ) {
SetLength( (xsize)(p-data()+1) ); // safe (p-data()+1 < length()
setLength( (xsize)(p-data()+1) ); // safe (p-data()+1 < length()
}else{
if ( *p >= 0 && *p <= ' ' ) SetLength(0);
else SetLength(1);
if ( *p >= 0 && *p <= ' ' ) setLength(0);
else setLength(1);
}
}
}

View File

@ -22,11 +22,23 @@ class XStringW;
class XString
{
protected:
// char *_Data;
char *m_data;
xsize m_allocatedSize;
// convenience method. Did it this way to avoid #define in header. They can have an impact on other headers
xsize min(xsize x1, xsize x2) const { if ( x1 < x2 ) return x1; return x2; }
xsize max(xsize x1, xsize x2) const { if ( x1 > x2 ) return x1; return x2; }
// Next 2 methods are protected intentionally. They are const method returning non-const pointer. That's intentional, but dangerous. Do not expose to public.
// It's better practice, if you need a non-const pointer for low-level access, to use dataSized and ahev to specify the size
char* _data(unsigned int ui) const { if ( ui >= m_allocatedSize ) panic("char* data(unsigned int ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
char* _data(int i) const { if ( i<0 ) panic("char* data(int i) -> i < 0"); if ( (unsigned int)i >= m_allocatedSize ) panic("char* data(int i) -> i >= m_allocatedSize"); return m_data+i; }
char* _data(unsigned long ui) const { if ( ui >= m_allocatedSize ) panic("char* data(unsigned long ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
char* _data(long i) const { if ( i<0 ) panic("char* data(long i) -> i < 0"); if ( (unsigned long)i >= m_allocatedSize ) panic("char* data(long i) -> i >= m_allocatedSize"); return m_data+i; }
char* _data(xsize ui) const { if ( ui >= m_allocatedSize ) panic("char* data(xsize ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
char* _data(xisize i) const { if ( i<0 ) panic("char* data(xisize i) -> i < 0"); if ( (xsize)i >= m_allocatedSize ) panic("char* data(xisize i) -> i >= m_allocatedSize"); return m_data+i; }
public:
char *c;
xsize m_allocatedSize;
void Init(xsize aSize=0);
XString();
@ -49,53 +61,47 @@ class XString
char *CheckSize(xsize nNewSize, xsize nGrowBy = XStringGrowByDefault);
public:
const char *data(xsize ui=0) const { return c+ui; }
const char *c_str() const { return c; } // same as std::string
char *data(xsize ui=0) { return (char*)(c+ui); }
char *data(int i) { if ( i<0 ) panic("const wchar_t *data(INTN i=0) const -> i < 0"); return c+i; }
char *DataWithSizeMin(xsize ui, xsize size, xsize nGrowBy=XStringGrowByDefault) { CheckSize(size, nGrowBy); return data(ui); }
const char* c_str() const { return m_data; } // same as std::string
const char* data(xsize ui=0) const { return _data(ui); }
const char* data(xisize i) const { return _data(i); }
xsize length() const { return strlen(c); }
xsize Size() const { return m_allocatedSize; }
void SetLength(xsize len);
char* dataSized(xsize ui, xsize sizeMin, xsize nGrowBy=XStringGrowByDefault) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
xsize length() const { return strlen(m_data); }
xsize size() const { return strlen(m_data); }
xsize allocatedSize() const { return m_allocatedSize; }
void setLength(xsize len);
/* IsNull ? */
void setEmpty() { c[0] = 0; }
void setEmpty() { setLength(0); }
bool isEmpty() const { return length() == 0; }
/* Cast */
operator const char *() const { return data(); }
// operator char *() { return data(); }
int ToInt() const;
UINTN ToUINTN() const;
XStringW wcs();
// int ToInt() const;
// UINTN ToUINTN() const;
/* char [] */
char operator [](int i) const {
#if defined __XTOOLS_INT_CHECK__
if ( i < 0 ) DebugLog(2, "XString index cannot < 0");
panic();
#endif
return *data((unsigned int)i);
}
char operator [](xsize i) const { return *data(i); }
char operator [](int i) const { return *_data(i); }
char operator [](unsigned int ui) const { return *_data(ui); }
char operator [](long i) const { return *_data(i); }
char operator [](unsigned long ui) const { return *_data(ui); }
char operator [](xisize i) const { return *data(i); }
char operator [](xsize ui) const { return *data(ui); }
/* char& [] */
char& operator [](int i) {
#if defined __XTOOLS_INT_CHECK__
if ( i < 0 ) DebugLog(2, "XString index cannot < 0");
panic();
#endif
return *data(i);
}
char& operator [](xsize i) { return *data(i); }
char& operator [](int i) { return *_data(i); }
char& operator [](unsigned int ui) { return *_data(ui); }
char& operator [](long i) { return *_data(i); }
char& operator [](unsigned long ui) { return *_data(ui); }
char& operator [](xisize i) { return *_data(i); }
char& operator [](xsize ui) { return *_data(ui); }
char LastChar() const { if ( length() > 0 ) return data()[length()-1]; else return 0; }
void RemoveLastEspCtrl();
char lastChar() const { if ( length() > 0 ) return data()[length()-1]; else return 0; }
void removeLastEspCtrl();
void SetNull() { SetLength(0); };
void StrCpy(const char *buf);
void StrnCpy(const char *buf, xsize len);
void StrnCat(const char *buf, xsize len);
@ -109,7 +115,7 @@ class XString
XString& vSPrintf(const char *Format, va_list va);
XString& SPrintf(const char *format, ...)
#ifndef _MSC_VER
__attribute__((format (printf, 2, 3))) // 2 and 3 because of hidden parameter.
__attribute__((format (printf, 2, 3))) // 2 and 3 because of hidden parameter 'this'.
#endif
;

View File

@ -32,7 +32,7 @@ void XStringW::Init(UINTN aSize)
//DBG("Init aSize=%d\n", aSize);
m_data = (wchar_t*)malloc( (aSize+1)*sizeof(wchar_t) ); /* le 0 terminal n'est pas compté dans mSize */
if ( !m_data ) {
DebugLog(2, "XStringW::Init(%d) : Xalloc returned NULL. Cpu halted\n", (aSize+1)*sizeof(wchar_t));
DebugLog(2, "XStringW::Init(%llu) : Xalloc returned NULL. Cpu halted\n", (aSize+1)*sizeof(wchar_t));
panic();
}
m_allocatedSize = aSize;
@ -193,7 +193,7 @@ void XStringW::StrnCat(const wchar_t *buf, UINTN len)
if ( buf && *buf && len > 0 ) {
NewLen = length()+len;
CheckSize(NewLen, 0);
memmove(data(length()), buf, len*sizeof(wchar_t));
memmove(_data(length()), buf, len*sizeof(wchar_t));
SetLength(NewLen); /* data()[NewLen]=0 done in SetLength */
}
}
@ -214,7 +214,7 @@ void XStringW::Delete(UINTN pos, UINTN count)
{
if ( pos < length() ) {
if ( count != MAX_XSIZE && pos + count < length() ) {
memmove( data(pos), data(pos+count), (length()-pos-count)*sizeof(wchar_t)); // memmove handles overlapping memory move
memmove( _data(pos), data(pos+count), (length()-pos-count)*sizeof(wchar_t)); // memmove handles overlapping memory move
SetLength(length()-count);/* data()[length()-count]=0 done in SetLength */
}else{
SetLength(pos);/* data()[pos]=0 done in SetLength */
@ -226,8 +226,8 @@ void XStringW::Insert(UINTN pos, const XStringW& Str)
{
if ( pos < length() ) {
CheckSize(length()+Str.length());
memmove(data(pos + Str.length()), data(pos), (length()-pos)*sizeof(wchar_t));
memmove(data(pos), Str.data(), Str.length()*sizeof(wchar_t));
memmove(_data(pos + Str.length()), data(pos), (length()-pos)*sizeof(wchar_t));
memmove(_data(pos), Str.data(), Str.length()*sizeof(wchar_t));
SetLength(length()+Str.length());
}else{
StrCat(Str);
@ -238,7 +238,7 @@ void XStringW::Replace(wchar_t c1, wchar_t c2)
{
wchar_t* p;
p = data();
p = _data(0);
while ( *p ) {
if ( *p == c1 ) *p = c2;
p += 1;
@ -250,7 +250,7 @@ XStringW XStringW::SubStringReplace(wchar_t c1, wchar_t c2)
wchar_t* p;
XStringW Result;
p = data();
p = _data(0);
while ( *p ) {
if ( *p == c1 ) Result += c2;
else Result += *p;
@ -421,7 +421,7 @@ void XStringW::RemoveLastEspCtrl()
wchar_t *p;
if ( length() > 0 ) {
p = data() + length() - 1;
p = _data(0) + length() - 1;
if ( *p >= 0 && *p <= ' ' ) {
p -= 1;
while ( p>data() && *p >= 0 && *p <= ' ' ) p -= 1;

View File

@ -24,8 +24,18 @@ protected:
UINTN m_len;
UINTN m_allocatedSize;
// convenience method. Did it this way to avoid #define in header. They can have an impact on other heade.rs
// convenience method. Did it this way to avoid #define in header. They can have an impact on other headers
xsize min(xsize x1, xsize x2) const { if ( x1 < x2 ) return x1; return x2; }
xsize max(xsize x1, xsize x2) const { if ( x1 > x2 ) return x1; return x2; }
// Next 2 methods are protected intentionally. They are const method returning non-const pointer. That's intentional, but dangerous. Do not expose to public.
// It's better practice, if you need a non-const pointer for low-level access, to use dataSized and ahev to specify the size
wchar_t* _data(unsigned int ui) const { if ( ui >= m_allocatedSize ) panic("wchar_t* data(unsigned int ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
wchar_t* _data(int i) const { if ( i<0 ) panic("wchar_t* data(int i) -> i < 0"); if ( (unsigned int)i >= m_allocatedSize ) panic("wchar_t* data(int i) -> i >= m_allocatedSize"); return m_data+i; }
wchar_t* _data(unsigned long ui) const { if ( ui >= m_allocatedSize ) panic("wchar_t* data(unsigned long ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
wchar_t* _data(long i) const { if ( i<0 ) panic("wchar_t* data(long i) -> i < 0"); if ( (unsigned long)i >= m_allocatedSize ) panic("wchar_t* data(long i) -> i >= m_allocatedSize"); return m_data+i; }
wchar_t* _data(xsize ui) const { if ( ui >= m_allocatedSize ) panic("wchar_t* data(xsize ui=0) -> ui >= m_allocatedSize"); return m_data+ui; }
wchar_t* _data(xisize i) const { if ( i<0 ) panic("wchar_t* data(xisize i) -> i < 0"); if ( (xsize)i >= m_allocatedSize ) panic("wchar_t* data(xisize i) -> i >= m_allocatedSize"); return m_data+i; }
public:
void Init(UINTN aSize=0);
@ -42,16 +52,13 @@ protected:
wchar_t *CheckSize(UINTN nNewSize, UINTN nGrowBy = XStringWGrowByDefault);
public:
const wchar_t *data(UINTN ui=0) const { return m_data+ui; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
const wchar_t *data(INTN i) const { if ( i<0 ) panic("const wchar_t *data(INTN i=0) const -> i < 0"); return m_data+i; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
// const wchar_t *data(int i=0) const { if ( i<0 ) panic("const wchar_t *data(int i=0) const -> i < 0"); return m_data+i; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
wchar_t *data(UINTN ui=0) { return m_data+ui; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
wchar_t *data(INTN i) { if ( i<0 ) panic("wchar_t *data(INTN i=0) -> i < 0"); return m_data+i; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
// wchar_t *data(int i) { if ( i<0 ) panic("wchar_t *data(int i=0) -> i < 0"); return m_data+i; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
const wchar_t* wc_str() const { return m_data; } // equivalent as std::string
const wchar_t *data(xsize ui=0) const { return m_data+ui; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
const wchar_t *data(xisize i) const { if ( i<0 ) panic("const wchar_t *data(INTN i=0) const -> i < 0"); return m_data+i; } // do not multiply by sizeof(wchar_t), it's done by the compiler.
wchar_t *dataWithSizeMin(UINTN pos, UINTN sizeMin, UINTN nGrowBy=XStringWGrowByDefault) { CheckSize(sizeMin, nGrowBy); return data(pos); }
wchar_t * forgetDataWithoutFreeing();
wchar_t* dataSized(xsize ui, xsize sizeMin, xsize nGrowBy=XStringWGrowByDefault) { CheckSize(ui+sizeMin, nGrowBy); return _data(ui); }
wchar_t* dataSized(xisize i, xsize sizeMin, xsize nGrowBy=XStringWGrowByDefault) { if ( i<0 ) panic("wchar_t* dataSized(xisize i, xsize sizeMin, xsize nGrowBy) -> i < 0"); CheckSize((xsize)i+sizeMin, nGrowBy); return _data(i); }
wchar_t* forgetDataWithoutFreeing();
UINTN length() const { return m_len; }
UINTN size() const { return m_len; }
@ -77,12 +84,21 @@ public:
// XString mbs() const;
/* [] */
wchar_t operator [](int i) const { return *data((INTN)i); }
wchar_t operator [](UINTN i) const { return *data(i); }
/* wchar_t [] */
wchar_t operator [](int i) const { return *_data(i); }
wchar_t operator [](unsigned int ui) const { return *_data(ui); }
wchar_t operator [](long i) const { return *_data(i); }
wchar_t operator [](unsigned long ui) const { return *_data(ui); }
wchar_t operator [](xisize i) const { return *data(i); }
wchar_t operator [](xsize ui) const { return *data(ui); }
wchar_t& operator [](int i) { return *data((INTN)i); }
wchar_t& operator [](UINTN i) { return *data(i); }
/* wchar_t& [] */
wchar_t& operator [](int i) { return *_data(i); }
wchar_t& operator [](unsigned int ui) { return *_data(ui); }
wchar_t& operator [](long i) { return *_data(i); }
wchar_t& operator [](unsigned long ui) { return *_data(ui); }
wchar_t& operator [](xisize i) { return *_data(i); }
wchar_t& operator [](xsize ui) { return *_data(ui); }
wchar_t LastChar() const { if ( length() > 0 ) return data()[length()-1]; else return 0; }
void RemoveLastEspCtrl();

View File

@ -5,7 +5,9 @@
#define xsize UINTN
#define xisize INTN
#define MAX_XSIZE MAX_UINTN
#define MAX_XISIZE MAX_INTN
extern xsize XArrayGrowByDefault;
extern xsize XBufferGrowByDefault;
@ -40,11 +42,17 @@ extern "C" {
// Declare here instead of include to avoid circular dependency.
#ifdef _MSC_VER
#define __attribute__(x)
#endif
VOID
EFIAPI
DebugLog (
IN INTN DebugMode,
IN CONST CHAR8 *FormatString, ...);
IN CONST CHAR8 *FormatString, ...) __attribute__((format(printf, 2, 3)));;
#endif

View File

@ -9,105 +9,160 @@
int XStringW_tests()
{
//
//#ifdef JIEF_DEBUG
//// DebugLog(2, "XStringW_tests -> Enter\n");
//#endif
//
// if ( global_str3 != L"global_str3" ) return 1;
// if ( global_str4 != L"global_str4" ) return 2;
//
//#ifdef XSTRINGW_HAS_CTOR_LITTERAL
// XStringW str(L"1");
// if ( str != L"1" ) return 3;
// str.StrCat(L"2");
// if ( str != L"12" ) return 4;
//#endif
//
// XStringW str;
// str.takeValueFrom(L"12");
// XStringW str2;
// if ( !str2.isEmpty() ) return 10;
// str2.StrnCpy(str.data(), 2);
// if ( str2 != L"12" ) return 11;
// str2.StrnCat(L"345", 2);
// if ( str2 != L"1234" ) return 12;
// str2.Insert(1, str);
// if ( str2 != L"112234" ) return 13;
// str2 += L"6";
// if ( str2 != L"1122346" ) return 14;
//
////wchar_t c2 = L'Ň';
////printf("1=%lc\n", c2);
////const char* s1 = "𐌾";
//
// str2.SPrintf("%c", 'a'); // signle UTF8 ascii char
// if ( str2 != L"a" ) return 20;
// str2.takeValueFrom(L"ab"); // UTF16(32) string containing ascii char
// if ( str2 != L"ab" ) return 21;
//#ifdef _MSC_VER
// // IMPORTANT : you can't pass a litteral char in a vararg function with Visual Studio (Microsoft strikes again :-).
// // At least, you got a warning C4066
// // IMPORTANT2 : Litteral string containing UTF16 char are WRONG. And you don't get a warning !!! If litteral is only ascii, it's ok.
// // Maybe it's compilation option butI didn't find them.
// wchar_t c = 'Ň'; // using an imtermediary var for Microsoft.
//
//
// wchar_t s[2]; // wchar_t s2[] = L"Ň";
// s[0] = 'Ň';
// s[1] = 0;
//
// str2.SPrintf("%lc", c); // UTF16(32) char. (2 bytes in total if UTF16)
// if (str2 != s) return 22;
// str2.takeValueFrom("");
// if (str2.length() != 0) return 221;
// str2.takeValueFrom(s); // this is a UTF8 string 2 bytes long
// if (str2 != s) return 23;
//#else
// str2.SPrintf("%lc", L'Ň'); // signe UTF16(32) char. (2 bytes in total if UTF16)
// if ( str2 != L"Ň" ) return 22;
// str2.takeValueFrom("");
// if (str2.length() != 0) return 221;
//#ifdef XSTRINGW_HAS_CTOR_LITTERAL
// str2.takeValueFrom("Ň"); // this is a UTF8 string 2 bytes long
// if (str2 != "Ň") return 23; // utf8 litteral are converted to an XStringW if ctor is available.
//#endif
// str2.takeValueFrom("");
// if (str2.length() != 0) return 231;
//#ifdef XSTRINGW_HAS_CTOR_LITTERAL
// str2.takeValueFrom(L"Ň"); // this is a UTF8 string 2 bytes long
// if (str2 != "Ň") return 24;
//#endif
//#endif
//
//#if __WCHAR_MAX__ > 0xFFFFu
// str2.SPrintf("%lc", L'𐌾'); // L'𐌾' // this char cannot convert to an UTF16 char. So it doesn't compile with -fshort-wchar
// if ( str2 != L'𐌾' ) return 30;
//#endif
//
//
//#ifndef _MSC_VER
// // "𐌾" in UTF16 is 2 char : 0xd800, 0xdf3e
//
// str2.takeValueFrom(L"𐌾"); // this is a UTF8 string 4 bytes long
// if ( str2 != L"𐌾" ) return 31;
// str2.takeValueFrom(L"𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar)
// if ( str2 != L"𐌾" ) return 32;
//
//#ifdef XSTRINGW_HAS_CTOR_LITTERAL
// {
// XStringW str3("a");
// if ( str3 != L"a" ) return 40;
// XStringW str4("aŇ𐌾");
// if ( str4 != L"aŇ𐌾" ) return 41;
// }
//#endif
//#endif
//
//// XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot");
//// for (UINTN Index = 0; Index < 20; Index++) {
//// XStringW Name = CommonName + SPrintf("%lld", Index) + L".png";
//// DebugLog(2, "XStringW_test shot: %s\n", Name.data());
//// }
#ifdef JIEF_DEBUG
// DebugLog(2, "XStringW_tests -> Enter\n");
#endif
if ( global_str3 != L"global_str3" ) return 1;
if ( global_str4 != L"global_str4" ) return 2;
// Check default ctor
{
XStringW str;
if (str.length() != 0) return 3;
if (str.wc_str() == NULL) return 4;
}
// Check ctor with value (or check takeValueFrom while we are waiting to put back ctor(const char*)
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
{
{
XStringW str("");
if ( str != "" ) return 100;
}
{
XStringW str("1");
if ( str != "1" ) return 101;
}
}
#else
{
XStringW str;
str.takeValueFrom("");
if (str.length() != 0) return 110;
str.takeValueFrom("1");
if ( str != L"1" ) return 111;
str.StrCat(L"2");
if ( str != L"12" ) return 112;
}
#endif
// check [] operator
{
XStringW str;
str.takeValueFrom("01234567890123456789");
wchar_t c;
c = str[(char)1];
if ( c != '1' ) return 201;
c = str[(unsigned char)2];
if ( c != '2' ) return 202;
c = str[(short)3];
if ( c != '3' ) return 203;
c = str[(unsigned short)4];
if ( c != '4' ) return 204;
c = str[(int)5];
if ( c != '5' ) return 205;
c = str[(unsigned int)6];
if ( c != '6' ) return 206;
c = str[(long)7];
if ( c != '7' ) return 207;
c = str[(unsigned long)8];
if ( c != '8' ) return 208;
c = str[(long long)9];
if ( c != '9' ) return 209;
c = str[(unsigned long long)10];
if ( c != '0' ) return 210;
}
// Quick check of StrnCpy,StrnCat,Insert,+=
{
XStringW str;
str.takeValueFrom(L"12");
XStringW str2;
if ( !str2.isEmpty() ) return 10;
str2.StrnCpy(str.data(), 2);
if ( str2 != L"12" ) return 11;
str2.StrnCat(L"345", 2);
if ( str2 != L"1234" ) return 12;
str2.Insert(1, str);
if ( str2 != L"112234" ) return 13;
str2 += L"6";
if ( str2 != L"1122346" ) return 14;
}
//wchar_t c2 = L'Ň';
//printf("1=%lc\n", c2);
//const char* s1 = "𐌾";
XStringW str2;
str2.SPrintf("%c", 'a'); // signle UTF8 ascii char
if ( str2 != L"a" ) return 20;
str2.takeValueFrom(L"ab"); // UTF16(32) string containing ascii char
if ( str2 != L"ab" ) return 21;
#ifdef _MSC_VER
// IMPORTANT : you can't pass a litteral char in a vararg function with Visual Studio (Microsoft strikes again :-).
// At least, you got a warning C4066
// IMPORTANT2 : Litteral string containing UTF16 char are WRONG. And you don't get a warning !!! If litteral is only ascii, it's ok.
// Maybe it's compilation option but I didn't find them.
wchar_t c = 'Ň'; // using an imtermediary var for Microsoft.
wchar_t s[2]; // wchar_t s2[] = L"Ň";
s[0] = 'Ň';
s[1] = 0;
str2.SPrintf("%lc", c); // UTF16(32) char. (2 bytes in total if UTF16)
if (str2 != s) return 22;
str2.takeValueFrom("");
if (str2.length() != 0) return 221;
str2.takeValueFrom(s); // this is a UTF8 string 2 bytes long
if (str2 != s) return 23;
#else
str2.SPrintf("%lc", L'Ň'); // signe UTF16(32) char. (2 bytes in total if UTF16)
if ( str2 != L"Ň" ) return 22;
str2.takeValueFrom("");
if (str2.length() != 0) return 221;
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
str2.takeValueFrom("Ň"); // this is a UTF8 string 2 bytes long
if (str2 != "Ň") return 23; // utf8 litteral are converted to an XStringW if ctor is available.
#endif
str2.takeValueFrom("");
if (str2.length() != 0) return 231;
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
str2.takeValueFrom(L"Ň"); // this is a UTF8 string 2 bytes long
if (str2 != "Ň") return 24;
#endif
#endif
#if __WCHAR_MAX__ > 0xFFFFu
str2.SPrintf("%lc", L'𐌾'); // L'𐌾' // this char cannot convert to an UTF16 char. So it doesn't compile with -fshort-wchar
if ( str2 != L"𐌾" ) return 30;
#endif
#ifndef _MSC_VER
// "𐌾" in UTF16 is 2 char : 0xd800, 0xdf3e
str2.takeValueFrom(L"𐌾"); // this is a UTF8 string 4 bytes long
if ( str2 != L"𐌾" ) return 31;
str2.takeValueFrom(L"𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar)
if ( str2 != L"𐌾" ) return 32;
#ifdef XSTRINGW_HAS_CTOR_LITTERAL
{
XStringW str3("a");
if ( str3 != L"a" ) return 40;
XStringW str4("aŇ𐌾");
if ( str4 != L"aŇ𐌾" ) return 41;
}
#endif
#endif
// XStringW CommonName(L"EFI\\CLOVER\\misc\\screenshot");
// for (UINTN Index = 0; Index < 20; Index++) {
// XStringW Name = CommonName + SPrintf("%lld", Index) + L".png";
// DebugLog(2, "XStringW_test shot: %s\n", Name.data());
// }
return 0;
}

View File

@ -29,47 +29,76 @@ int XString_tests()
{
{
XString str("");
if ( str != "" ) return 10;
if ( str != "" ) return 100;
}
{
XString str("1");
if ( str != "1" ) return 101;
}
XString str("1");
if ( str != "1" ) return 11;
}
#else
{
XString str;
str.takeValueFrom("");
if (str.length() != 0) return 10;
if (str.length() != 0) return 110;
str.takeValueFrom("1");
if ( str != "1" ) return 11;
if ( str != "1" ) return 111;
str.StrCat("2");
if ( str != "12" ) return 12;
if ( str != "12" ) return 112;
}
#endif
// check [] operator
{
XString str;
str.takeValueFrom("01234567890123456789");
char c;
c = str[(char)1];
if ( c != '1' ) return 201;
c = str[(unsigned char)2];
if ( c != '2' ) return 202;
c = str[(short)3];
if ( c != '3' ) return 203;
c = str[(unsigned short)4];
if ( c != '4' ) return 204;
c = str[(int)5];
if ( c != '5' ) return 205;
c = str[(unsigned int)6];
if ( c != '6' ) return 206;
c = str[(long)7];
if ( c != '7' ) return 207;
c = str[(unsigned long)8];
if ( c != '8' ) return 208;
c = str[(long long)9];
if ( c != '9' ) return 209;
c = str[(unsigned long long)10];
if ( c != '0' ) return 210;
}
// Check StrCat. TODO more test, and test StrnCat
{
XString str;
str.takeValueFrom("1");
str.StrCat("2");
if ( str != "12" ) return 20;
if ( str != "12" ) return 50;
}
// check takeValueFrom from utf8 string
XString str;
str.takeValueFrom("Ň"); // this is a UTF8 string 2 bytes long
if (str != "Ň") return 30; // utf8 litteral are converted to an XStringW if ctor is available.
if (str != "Ň") return 80; // utf8 litteral are converted to an XStringW if ctor is available.
str.takeValueFrom("𐌾"); // this is a UTF8 string 4 bytes long
if ( str != "𐌾" ) return 31;
if ( str != "𐌾" ) return 81;
str.takeValueFrom("𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar)
if ( str != "𐌾" ) return 32;
if ( str != "𐌾" ) return 82;
// check takeValueFrom from UTF16 or 32 string
str.takeValueFrom(L"Ň"); // this is a UTF8 string 2 bytes long
if (str != "Ň") return 33; // utf8 litteral are converted to an XStringW if ctor is available.
if (str != "Ň") return 83; // utf8 litteral are converted to an XStringW if ctor is available.
str.takeValueFrom(L"𐌾"); // this is a UTF8 string 4 bytes long
if ( str != "𐌾" ) return 34;
if ( str != "𐌾" ) return 84;
str.takeValueFrom(L"𐌾"); // this is a UTF16 or UTF32 string (depending of -fshort-wchar)
if ( str != "𐌾" ) return 35;
if ( str != "𐌾" ) return 85;
// Quick check of StrnCpy,StrnCat,Insert,+=
str.takeValueFrom("12");
@ -93,7 +122,7 @@ int XString_tests()
//wchar_t c2 = L'Ň';
//printf("1=%lc\n", c2);
//const char* s1 = "𐌾";
// Check SPrintf
// Check SPrintf
str2.SPrintf("%c", 'a'); // single UTF8 ascii char
if ( str2 != "a" ) return 200;
#ifndef _MSC_VER

View File

@ -3,6 +3,8 @@
#include "../cpp_foundation/XArray.h"
#include "../cpp_foundation/XObjArray.h"
#include "../refit/screen.h" // just for PauseForKey
#include "XArray_tests.h"
#include "XObjArray_tests.h"
#include "XStringWArray_test.h"
@ -23,16 +25,18 @@ bool all_tests()
int ret;
#ifdef JIEF_DEBUG
ret = printlib_tests();
if ( ret != 0 ) {
DebugLog(2, "printf_lite_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = poolprint_tests();
if ( ret != 0 ) {
DebugLog(2, "printf_lite_tests() failed at test %d\n", ret);
all_ok = false;
}
#if defined(CLOVER_BUILD)
ret = printlib_tests();
if ( ret != 0 ) {
DebugLog(2, "printlib_tests() failed at test %d\n", ret);
all_ok = false;
}
ret = poolprint_tests();
if ( ret != 0 ) {
DebugLog(2, "poolprint_tests() failed at test %d\n", ret);
all_ok = false;
}
#endif
#endif
ret = printf_lite_tests();
if ( ret != 0 ) {

View File

@ -1,5 +1,4 @@
#include "../../Include/Library/printf_lite.h"
#define F(x) x
#define LF(x) L##x
#define PRIF "%a"

View File

@ -9,7 +9,7 @@
#include <Platform.h>
#include <limits.h>
#include "unicode_conversions.h"
#include "poolprint-test-cpp_conf.h"
#include <poolprint-test-cpp_conf.h>
#include "poolprint-test.h"
static int nbTestFailed = 0;

View File

@ -1,5 +1,4 @@
#include "../../Include/Library/printf_lite.h"
#define F(x) x
#define LF(x) L##x
#define PRIF "%s"

View File

@ -9,8 +9,10 @@
#include <Platform.h>
#include <limits.h>
#include "unicode_conversions.h"
#include "printf_lite-test-cpp_conf.h"
#include <printf_lite-test-cpp_conf.h>
#include "printf_lite-test.h"
#include <printf_lite-conf.h>
#include "../../Include/Library/printf_lite.h"
static int nbTestFailed = 0;
#ifdef DISPLAY_ONLY_FAILED

View File

@ -1,5 +1,4 @@
#include "../../Include/Library/printf_lite.h"
#define F(x) x
#define LF(x) L##x
#define PRIF "%s"

View File

@ -9,7 +9,7 @@
#include <Platform.h>
#include <limits.h>
#include "unicode_conversions.h"
#include "printlib-test-cpp_conf.h"
#include <printlib-test-cpp_conf.h>
#include "printlib-test.h"
static int nbTestFailed = 0;

View File

@ -334,36 +334,36 @@ VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONS
if (j > Low) QuickSort(Array, Low, j, Size, compare);
if (High > i) QuickSort(Array, i, High, Size, compare);
}
//S must be allocated before use
VOID AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X)
{
INTN I, Fract;
float D;
if (!S) {
return;
}
I = (INTN)X;
D = (float)I;
Fract = fabsf((X - D) * 1000000.0f);
AsciiSPrint(S, N, "%D.%06D", I, (INTN)Fract);
}
//
////S must be allocated before use
//VOID AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X)
//{
// INTN I, Fract;
// float D;
// if (!S) {
// return;
// }
//
// I = (INTN)X;
// D = (float)I;
// Fract = fabsf((X - D) * 1000000.0f);
// AsciiSPrint(S, N, "%D.%06D", I, (INTN)Fract);
//}
#endif
CHAR16* PoolPrintFloat(float X)
{
INTN I, Fract;
CHAR8 S = ' ';
float D;
I = (INTN)X;
D = (float)I;
if (I == 0 && X < 0) {
S = '-';
}
Fract = (INTN)fabsf((X - D) * 1000000.0f);
return PoolPrint(L"%c%d.%06d", S, I, Fract);
}
//
//CHAR16* PoolPrintFloat(float X)
//{
// INTN I, Fract;
// CHAR8 S = ' ';
// float D;
// I = (INTN)X;
// D = (float)I;
// if (I == 0 && X < 0) {
// S = '-';
// }
// Fract = (INTN)fabsf((X - D) * 1000000.0f);
// return PoolPrint(L"%c%d.%06d", S, I, Fract);
//}
static UINT32 seed = 12345;
float rndf() //expected 0..1

View File

@ -52,11 +52,11 @@ AsciiStrToFloat(IN CONST CHAR8 *String,
OUT CHAR8 **EndPointer, OPTIONAL
OUT float *Data);
#if 0
VOID AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X);
//VOID AsciiSPrintFloat(CHAR8* S, INTN N, CHAR8* F, float X);
VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size,
INTN (*compare)(CONST VOID* a, CONST VOID* b));
#endif
CHAR16* PoolPrintFloat(float X);
//CHAR16* PoolPrintFloat(float X);
#endif /* FloatLib_h */

View File

@ -194,7 +194,7 @@ EFI_STATUS ParseSVGXIcon(NSVGparser *p, INTN Id, CONST CHAR8 *IconName, float S
float Height = IconImage->height * Scale;
float Width = IconImage->width * Scale;
// DBG("icon %s width=%ls height=%ls\n", IconName, PoolPrintFloat(Width), PoolPrintFloat(Height));
// DBG("icon %s width=%ls height=%ls\n", IconName, Width, Height);
int iWidth = (int)(Width + 0.5f);
int iHeight = (int)(Height + 0.5f);
// EG_IMAGE *NewImage = egCreateFilledImage(iWidth, iHeight, TRUE, &MenuBackgroundPixel);
@ -364,7 +364,7 @@ EFI_STATUS ParseSVGIcon(NSVGparser *p, INTN Id, CONST CHAR8 *IconName, float Sc
float Height = IconImage->height * Scale;
float Width = IconImage->width * Scale;
// DBG("icon %s width=%ls height=%ls\n", IconName, PoolPrintFloat(Width), PoolPrintFloat(Height));
// DBG("icon %s width=%ls height=%ls\n", IconName, Width, Height);
int iWidth = (int)(Width + 0.5f);
int iHeight = (int)(Height + 0.5f);
EG_IMAGE *NewImage = egCreateFilledImage(iWidth, iHeight, TRUE, &MenuBackgroundPixel);
@ -429,7 +429,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict)
SVGimage->height = 768.f; //default height
}
Scale = UGAHeight / SVGimage->height;
DBG("using scale %ls\n", PoolPrintFloat(Scale));
DBG("using scale %f\n", Scale);
GlobalConfig.Scale = Scale;
GlobalConfig.CentreShift = (vbx * Scale - (float)UGAWidth) * 0.5f;
@ -646,7 +646,7 @@ EFI_STATUS ParseSVGXTheme(CONST CHAR8* buffer, TagPtr * dict)
SVGimage->height = 768.f; //default height
}
float Scale = UGAHeight / SVGimage->height;
DBG("using scale %ls\n", PoolPrintFloat(Scale));
DBG("using scale %ls\n", Scale);
ThemeX.Scale = Scale;
ThemeX.CentreShift = (vbx * Scale - (float)UGAWidth) * 0.5f;
@ -711,7 +711,7 @@ VOID RenderSVGfont(NSVGfont *fontSVG, UINT32 color)
fH = fontSVG->unitsPerEm;
}
FontScale = (float)FontHeight / fH;
DBG("font scale %ls\n", PoolPrintFloat(FontScale));
DBG("font scale %ls\n", FontScale);
FontWidth = (int)(fontSVG->horizAdvX * FontScale);
INTN Width = FontWidth * (AsciiPageSize + GlobalConfig.CodepageSize);
FontImage = egCreateImage(Width, Height, TRUE);
@ -836,7 +836,7 @@ INTN renderSVGtext(XImage& TextBufferXY, INTN posX, INTN posY, INTN textType, XS
}
float fH = fontSVG->bbox[3] - fontSVG->bbox[1]; //1250
if (fH == 0.f) {
DBG("wrong font: %ls\n", PoolPrintFloat(fontSVG->unitsPerEm));
DBG("wrong font: %ls\n", fontSVG->unitsPerEm);
DumpFloat2("Font bbox", fontSVG->bbox, 4);
fH = fontSVG->unitsPerEm?fontSVG->unitsPerEm:1000.0f; //1000
}
@ -932,7 +932,7 @@ INTN renderSVGtext(EG_IMAGE* TextBufferXY, INTN posX, INTN posY, INTN textType,
}
float fH = fontSVG->bbox[3] - fontSVG->bbox[1]; //1250
if (fH == 0.f) {
DBG("wrong font: %ls\n", PoolPrintFloat(fontSVG->unitsPerEm));
DBG("wrong font: %f\n", fontSVG->unitsPerEm);
DumpFloat2("Font bbox", fontSVG->bbox, 4);
fH = fontSVG->unitsPerEm?fontSVG->unitsPerEm:1000.0f; //1000
}
@ -958,18 +958,18 @@ INTN renderSVGtext(EG_IMAGE* TextBufferXY, INTN posX, INTN posY, INTN textType,
addLetter(p, 0x5F, x, y, sy, color);
}
x = addLetter(p, letter, x, y, sy, color);
// DBG("next x=%ls\n", PoolPrintFloat(x));
// DBG("next x=%ls\n", x);
} //end of string
p->image->realBounds[0] = fontSVG->bbox[0] * Scale;
p->image->realBounds[1] = fontSVG->bbox[1] * Scale;
p->image->realBounds[2] = fontSVG->bbox[2] * Scale + x; //last bound
p->image->realBounds[3] = fontSVG->bbox[3] * Scale;
// DBG("internal Scale=%ls\n", PoolPrintFloat(Scale));
// DBG("internal Scale=%ls\n", Scale);
// DumpFloat2("text bounds", p->image->realBounds, 4);
//We made an image, then rasterize it
rast = nsvgCreateRasterizer();
// DBG("begin raster text, scale=%ls\n", PoolPrintFloat(Scale));
// DBG("begin raster text, scale=%ls\n", Scale);
nsvgRasterize(rast, p->image, 0, 0, 1.f, 1.f, (UINT8*)TextBufferXY->PixelData,
(int)TextBufferXY->Width, (int)TextBufferXY->Height, (int)(Width*4));
float RealWidth = p->image->realBounds[2] - p->image->realBounds[0];
@ -1076,7 +1076,7 @@ VOID testSVG()
Scale = (ScaleX > ScaleY)?ScaleY:ScaleX;
float tx = 0; //-SVGimage->realBounds[0] * Scale;
float ty = 0; //-SVGimage->realBounds[1] * Scale;
DBG("timing rasterize start tx=%ls ty=%ls\n", PoolPrintFloat(tx), PoolPrintFloat(ty));
DBG("timing rasterize start tx=%f ty=%f\n", tx, ty);
nsvgRasterize(rast, SVGimage, tx,ty,Scale,Scale, (UINT8*)NewImage->PixelData, (int)Width, (int)Height, (int)Width*4);
DBG("timing rasterize end\n");
//now show it!

View File

@ -295,12 +295,12 @@ EFI_STATUS egSetMode(INT32 Next)
return Status;
}
EFI_STATUS egSetScreenResolution(IN CHAR16 *WidthHeight)
EFI_STATUS egSetScreenResolution(IN const CHAR16 *WidthHeight)
{
EFI_STATUS Status = EFI_UNSUPPORTED;
UINT32 Width;
UINT32 Height;
CHAR16 *HeightP;
const CHAR16 *HeightP;
UINT32 MaxMode;
UINT32 Mode;
UINTN SizeOfInfo;
@ -388,7 +388,7 @@ VOID egInitScreen(IN BOOLEAN SetMaxResolution)
// Resolution = PoolPrint(L"%dx%d",egScreenWidth,egScreenHeight);
XStringW Resolution = WPrintf("%llux%llu", egScreenWidth, egScreenHeight);
// if (Resolution) { //no sense
Status = egSetScreenResolution(Resolution.data());
Status = egSetScreenResolution(Resolution.wc_str());
// FreePool(Resolution);
if (!EFI_ERROR(Status)) {
return;

View File

@ -136,7 +136,7 @@ VOID egDecompressIcnsRLE(IN OUT UINT8 **CompData, IN OUT UINTN *CompLen, IN UINT
}
if (pp_left > 0) {
DBG(" egDecompressIcnsRLE: still need %d bytes of pixel data\n", pp_left);
DBG(" egDecompressIcnsRLE: still need %llu bytes of pixel data\n", pp_left);
}
// record what's left of the compressed data stream
@ -255,7 +255,7 @@ EG_IMAGE * egDecodeICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN Ic
egDecompressIcnsRLE(&CompData, &CompLen, PLPTR(NewImage, b), PixelCount);
// possible assertion: CompLen == 0
if (CompLen > 0) {
DBG(" egLoadICNSIcon: %d bytes of compressed data left\n", CompLen);
DBG(" egLoadICNSIcon: %llu bytes of compressed data left\n", CompLen);
}
} else {

View File

@ -2753,15 +2753,15 @@ static void nsvg__parseTextSpan(NSVGparser* p, const char** dict)
if (strcmp(dict[i], "x") == 0) {
x = nsvg__parseCoordinate(p, dict[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p));
text->x = x;
// DBG("span posX=%ls\n", PoolPrintFloat(x));
// DBG("span posX=%f\n", x);
} else if (strcmp(dict[i], "y") == 0) {
y = nsvg__parseCoordinate(p, dict[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p));
text->y = y;
// DBG("span posY=%ls\n", PoolPrintFloat(y));
// DBG("span posY=%f\n", y);
} else if (strcmp(dict[i], "font-size") == 0) {
r = nsvg__parseCoordinate(p, dict[i+1], 0.0f, nsvg__actualHeight(p));
text->fontSize = r;
// DBG("span fontSize=%ls from=%s\n", PoolPrintFloat(r), dict[i+1]);
// DBG("span fontSize=%f from=%s\n", r, dict[i+1]);
} else if (strcmp(dict[i], "font-style") == 0) {
// DBG("span: attr=%s value=%s\n", dict[i], dict[i+1]);
if (strstr(dict[i+1], "italic") != NULL) {
@ -2822,7 +2822,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
nsvg__parseAttr(p, dict[i], dict[i + 1]);
}
}
DBG("text: x=%ls y=%ls attr:Style=%X, size=%ls, id=%s\n", PoolPrintFloat(x), PoolPrintFloat(y), attr->fontFace->fontStyle, PoolPrintFloat(attr->fontFace->fontSize), attr->id);
DBG("text: x=%f y=%f attr:Style=%X, size=%f, id=%s\n", x, y, attr->fontFace->fontStyle, attr->fontFace->fontSize, attr->id);
text->x = x;
text->y = y;
text->fontSize = attr->fontFace->fontSize;
@ -2914,7 +2914,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
textFace[1].size = (INTN)text->fontSize;
textFace[1].color = text->fontColor;
textFace[1].valid = TRUE;
DBG("set message->font=%s color=%X size=%ls as in MessageRow\n", fontSVG->fontFamily, text->fontColor, PoolPrintFloat(text->fontSize));
DBG("set message->font=%s color=%X size=%f as in MessageRow\n", fontSVG->fontFamily, text->fontColor, text->fontSize);
}
break;
} else if (!DayLight && strcmp(group->id, "MessageRow_night") == 0) {
@ -2926,7 +2926,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
textFace[1].size = (INTN)text->fontSize;
textFace[1].color = text->fontColor;
textFace[1].valid = TRUE;
DBG("set message->font=%s color=%X size=%ls as in MessageRow\n", fontSVG->fontFamily, text->fontColor, PoolPrintFloat(text->fontSize));
DBG("set message->font=%s color=%X size=%f as in MessageRow\n", fontSVG->fontFamily, text->fontColor, text->fontSize);
break;
} else if (strcmp(group->id, "MenuRows") == 0) {
if (!textFace[2].valid) {
@ -2934,7 +2934,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
textFace[2].size = (INTN)text->fontSize;
textFace[2].color = text->fontColor;
textFace[2].valid = TRUE;
DBG("set menu->font=%s color=%X size=%ls as in MenuRows\n", fontSVG->fontFamily, text->fontColor, PoolPrintFloat(text->fontSize));
DBG("set menu->font=%s color=%X size=%f as in MenuRows\n", fontSVG->fontFamily, text->fontColor, text->fontSize);
}
break;
} else if (!DayLight && strcmp(group->id, "MenuRows_night") == 0) {
@ -2949,7 +2949,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
textFace[0].size = (INTN)text->fontSize;
textFace[0].color = text->fontColor;
textFace[0].valid = TRUE;
DBG("set help->font=%s color=%X size=%ls as in HelpRows\n", fontSVG->fontFamily, text->fontColor, PoolPrintFloat(text->fontSize));
DBG("set help->font=%s color=%X size=%f as in HelpRows\n", fontSVG->fontFamily, text->fontColor, text->fontSize);
}
break;
} else if (!DayLight && strstr(group->id, "HelpRows_night") != NULL) {
@ -2957,7 +2957,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
textFace[0].size = (INTN)text->fontSize;
textFace[0].color = text->fontColor;
textFace[0].valid = TRUE;
DBG("set help->font=%s color=%X size=%ls as in HelpRows\n", fontSVG->fontFamily, text->fontColor, PoolPrintFloat(text->fontSize));
DBG("set help->font=%s color=%X size=%f as in HelpRows\n", fontSVG->fontFamily, text->fontColor, text->fontSize);
break;
}
group = group->next;
@ -4120,7 +4120,7 @@ float addLetter(NSVGparser* p, CHAR16 letter, float x, float y, float scale, UIN
DBG("bbox3=%ls \n", PoolPrintFloat(p->text->font->bbox[3]));
DumpFloat2("glyph xform:", shape->xform, 6);
DBG("stroke-color=%X ", shape->stroke.color);
DBG("stroke-width=%ls\n", PoolPrintFloat(shape->strokeWidth));
DBG("stroke-width=%ls\n", shape->strokeWidth);
}
*/
//in glyph units
@ -4424,7 +4424,7 @@ NSVGparser* nsvgParse(char* input, /* const char* units,*/ float dpi, float opac
p->image->width = bounds[2] - bounds[0];
p->image->height = bounds[3] - bounds[1];
#endif
DBG("scaled width=%ls height=%ls\n", PoolPrintFloat(p->image->width),
DBG("scaled width=%f height=%ls\n", p->image->width,
PoolPrintFloat(p->image->height));
return p;
}

View File

@ -1175,7 +1175,7 @@ static void nsvg__scanlineSolid(unsigned char* row, int count, unsigned char* co
for (i = 0; i < count; i++) {
int r,g,b,a,ia;
gd = sqrtf(gx*gx + gy*gy);
// DBG("gx=%ls gy=%ls\n", PoolPrintFloat(gx), PoolPrintFloat(gy));
// DBG("gx=%f gy=%f\n", gx, gy);
int level = cache->coarse;
c = cache->colors[dither(nsvg__clampf(gd*(255.0f-level*2), 0, (254.99f-level*2)), level)];
cr = (c) & 0xff;
@ -1775,7 +1775,7 @@ void nsvgRasterize(NSVGrasterizer* r,
tx -= image->realBounds[0] * scalex;
ty -= image->realBounds[1] * scaley;
// DBG(" image will be shifted by [%ls,%ls]\n", PoolPrintFloat(tx), PoolPrintFloat(ty));
// DBG(" image will be shifted by [%f,%f]\n", tx, ty);
// DumpFloat(" image real bounds ", image->realBounds, 4);
nsvg__rasterizeClipPaths(r, image, w, h, tx, ty, scalex, scaley);

View File

@ -129,9 +129,9 @@ EG_IMAGE * egLoadFontImage(IN BOOLEAN UseEmbedded, IN INTN Rows, IN INTN Cols)
}
ImageWidth = NewImage->Width;
DBG("ImageWidth=%d\n", ImageWidth);
DBG("ImageWidth=%lld\n", ImageWidth);
ImageHeight = NewImage->Height;
DBG("ImageHeight=%d\n", ImageHeight);
DBG("ImageHeight=%lld\n", ImageHeight);
PixelPtr = NewImage->PixelData;
NewFontImage = egCreateImage(ImageWidth * Rows, ImageHeight / Rows, TRUE);
@ -223,7 +223,7 @@ VOID PrepareFont()
}
// TextHeight = FontHeight + TEXT_YMARGIN * 2;
DBG("Font %d prepared WxH=%dx%d CharWidth=%d\n", GlobalConfig.Font, FontWidth, FontHeight, GlobalConfig.CharWidth);
DBG("Font %d prepared WxH=%lldx%lld CharWidth=%lld\n", GlobalConfig.Font, FontWidth, FontHeight, GlobalConfig.CharWidth);
} else {
DBG("Failed to load font\n");
}

View File

@ -35,6 +35,8 @@
# EfiLib/BmLib.c
# Platform/DevicePath.c #included into GenericBdsLib
Platform/BdsConnect.cpp #included into GenericBdsLib
../Include/Library/printf_lite-conf.h
../Include/Library/printf_lite.h
refit/main.cpp
refit/icns.cpp
refit/lib.cpp

View File

@ -623,7 +623,7 @@ VOID UninitRefitLib(VOID);
EFI_STATUS ReinitRefitLib(VOID);
EFI_STATUS ReinitSelfLib(VOID);
//extern EFI_STATUS FinishInitRefitLib(VOID); -- static
VOID PauseForKey(IN CONST CHAR16 *Msg);
BOOLEAN IsEmbeddedTheme(VOID);
UINT8 GetOSTypeFromPath (IN CONST CHAR16 *Path);

View File

@ -930,7 +930,7 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry)
*/
// DBG("BeginExternalScreen\n");
BeginExternalScreen(OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS), L"Booting OS");
BeginExternalScreen(OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS)/*, L"Booting OS"*/);
if (!OSTYPE_IS_WINDOWS(Entry->LoaderType)) {
if (OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS)) {
@ -1031,7 +1031,7 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry)
}
egClearScreen(&DarkBackgroundPixel);
BeginExternalScreen(TRUE, L"Booting Legacy OS");
BeginExternalScreen(TRUE/*, L"Booting Legacy OS"*/);
BootLogoImage = LoadOSIcon(Entry->Volume->LegacyOS->IconName, L"legacy", 128, TRUE, TRUE);
if (BootLogoImage != NULL) {
@ -1077,7 +1077,7 @@ static VOID StartTool(IN REFIT_MENU_ENTRY_LOADER_TOOL *Entry)
DBG("Start Tool: %ls\n", Entry->LoaderPath);
egClearScreen(&DarkBackgroundPixel);
// assumes "Start <title>" as assigned below
BeginExternalScreen(OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS), &Entry->Title[6]); // Shouldn't we check that length of Title is at least 6 ?
BeginExternalScreen(OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS)/*, &Entry->Title[6]*/); // Shouldn't we check that length of Title is at least 6 ?
StartEFIImage(Entry->DevicePath, Entry->LoadOptions, Basename(Entry->LoaderPath), Basename(Entry->LoaderPath), NULL, NULL);
FinishExternalScreen();
//ReinitSelfLib();
@ -2081,7 +2081,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
DBG("Clover : Image base = 0x%llX\n", (uintptr_t)SelfLoadedImage->ImageBase); // do not change, it's used by grep to feed the debugger
#ifdef JIEF_DEBUG
gBS->Stall(3000000); // to give time to gdb to connect
gBS->Stall(1500000); // to give time to gdb to connect
// PauseForKey(L"press\n");
#endif

View File

@ -181,7 +181,7 @@ VOID FinishTextScreen(IN BOOLEAN WaitAlways)
haveError = FALSE;
}
VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CONST CHAR16 *Title)
VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode/*, IN CONST CHAR16 *Title*/)
{
if (!AllowGraphicsMode) {
UseGraphicsMode = FALSE;

View File

@ -4,7 +4,7 @@ VOID InitScreen(IN BOOLEAN SetMaxResolution);
VOID SetupScreen(VOID);
VOID BeginTextScreen(IN CONST CHAR16 *Title);
VOID FinishTextScreen(IN BOOLEAN WaitAlways);
VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CONST CHAR16 *Title);
VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode/*, IN CONST CHAR16 *Title*/);
VOID FinishExternalScreen(VOID);
VOID TerminateScreen(VOID);
VOID SetNextScreenMode(INT32);
@ -27,3 +27,5 @@ VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG
INTN HybridRepositioning(INTN Edge, INTN Value, INTN ImageDimension, INTN ScreenDimension, INTN DesignScreenDimension);
INTN CalculateNudgePosition(INTN Position, INTN NudgeValue, INTN ImageDimension, INTN ScreenDimension);
VOID PauseForKey(CONST CHAR16* msg);