https://git.reactos.org/?p=reactos.git;a=commitdiff;h=764e884f5e05484a363ca…
commit 764e884f5e05484a363caf4ee83bf9e8be8bd060
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Sat May 2 23:16:58 2020 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Sat May 2 23:23:33 2020 +0300
[FREELDR] Work with Xbox GPU memory registers properly
Bug was noticed with GCC 8.4
---
boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c
b/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c
index b0e38a35247..261f4550664 100644
--- a/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c
+++ b/boot/freeldr/freeldr/arch/i386/xbox/xboxvideo.c
@@ -124,8 +124,8 @@ XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
UCHAR
NvGetCrtc(UCHAR Index)
{
- *((PUCHAR) NV2A_CRTC_REGISTER_INDEX) = Index;
- return *((PUCHAR) NV2A_CRTC_REGISTER_VALUE);
+ WRITE_REGISTER_UCHAR(NV2A_CRTC_REGISTER_INDEX, Index);
+ return READ_REGISTER_UCHAR(NV2A_CRTC_REGISTER_VALUE);
}
ULONG
@@ -175,7 +175,7 @@ VOID
XboxVideoInit(VOID)
{
/* Reuse framebuffer that was set up by firmware */
- FrameBuffer = (PVOID)*((PULONG) NV2A_CRTC_FRAMEBUFFER_START);
+ FrameBuffer = (PVOID)READ_REGISTER_ULONG(NV2A_CRTC_FRAMEBUFFER_START);
/* Verify that framebuffer address is page-aligned */
ASSERT((ULONG_PTR)FrameBuffer % PAGE_SIZE == 0);
@@ -187,8 +187,8 @@ XboxVideoInit(VOID)
WARN("Could not detect framebuffer memory size, fallback to 4 MB\n");
}
- ScreenWidth = *((PULONG) NV2A_RAMDAC_FP_HVALID_END) + 1;
- ScreenHeight = *((PULONG) NV2A_RAMDAC_FP_VVALID_END) + 1;
+ ScreenWidth = READ_REGISTER_ULONG(NV2A_RAMDAC_FP_HVALID_END) + 1;
+ ScreenHeight = READ_REGISTER_ULONG(NV2A_RAMDAC_FP_VVALID_END) + 1;
/* Get BPP directly from NV2A CRTC (magic constants are from Cromwell) */
BytesPerPixel = 8 * (((NvGetCrtc(0x19) & 0xE0) << 3) | (NvGetCrtc(0x13) &
0xFF)) / ScreenWidth;
if (BytesPerPixel == 4)