https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f7d825e62034dee120a24…
commit f7d825e62034dee120a24e238e5e3c1d8dce2ff9
Author: Dmitry Borisov <di.sean(a)protonmail.com>
AuthorDate: Thu May 13 02:17:27 2021 +0600
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Tue May 18 19:30:29 2021 +0300
[PC98VID] Fix MSVC 2015 build for PC-98 target
Addendum to 3adf45086743d5f075e4270af7af64017eb01d63
Also isolate the constant structures into page section
and restore the previous sections for start IO and entrypoint routines.
---
win32ss/drivers/miniport/pc98vid/ioctl.c | 1 +
win32ss/drivers/miniport/pc98vid/pc98vid.c | 17 ++++++++++++++---
win32ss/drivers/miniport/pc98vid/pc98vid.h | 10 ++++++++++
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/win32ss/drivers/miniport/pc98vid/ioctl.c
b/win32ss/drivers/miniport/pc98vid/ioctl.c
index 918beb117d6..d89a17510cd 100644
--- a/win32ss/drivers/miniport/pc98vid/ioctl.c
+++ b/win32ss/drivers/miniport/pc98vid/ioctl.c
@@ -206,6 +206,7 @@ Pc98VidGetChildState(
return NO_ERROR;
}
+CODE_SEG("PAGE")
BOOLEAN
NTAPI
Pc98VidStartIO(
diff --git a/win32ss/drivers/miniport/pc98vid/pc98vid.c
b/win32ss/drivers/miniport/pc98vid/pc98vid.c
index 8705aee35ea..4fe45f7bc54 100644
--- a/win32ss/drivers/miniport/pc98vid/pc98vid.c
+++ b/win32ss/drivers/miniport/pc98vid/pc98vid.c
@@ -11,6 +11,7 @@
/* GLOBALS ********************************************************************/
+DATA_SEG("PAGECONS")
const VIDEOMODE VideoModes[] =
{
{640, 480, GRAPH_HF_31KHZ, GDC2_CLOCK1_5MHZ, GDC2_CLOCK2_5MHZ,
@@ -18,7 +19,8 @@ const VIDEOMODE VideoModes[] =
{0, 80, 12, 2, 4, 4, 6, 480, 37}, {0, 80, 12, 2, 4, 132, 6, 480, 37}}
};
-static VIDEO_ACCESS_RANGE LegacyRangeList[] =
+DATA_SEG("PAGECONS")
+const VIDEO_ACCESS_RANGE LegacyRangeList[] =
{
{ {{0x60, 0}}, 0x00000001, 1, 1, 1, 0 },
{ {{0x62, 0}}, 0x00000001, 1, 1, 1, 0 },
@@ -72,7 +74,7 @@ Pc98VidFindAdapter(
Status = VideoPortVerifyAccessRanges(DeviceExtension,
RTL_NUMBER_OF(LegacyRangeList),
- LegacyRangeList);
+ (PVIDEO_ACCESS_RANGE)LegacyRangeList);
if (Status != NO_ERROR)
{
VideoDebugPrint((Error, "%s() Resource conflict was found\n",
__FUNCTION__));
@@ -193,6 +195,15 @@ Pc98VidGetVideoChildDescriptor(
return ERROR_NO_MORE_DEVICES;
}
+#if defined(_MSC_VER)
+/*
+ * Avoid C2983 error for MSVC 2015. There is no such thing
+ * as DRIVER_INITIALIZE for video miniport drivers.
+ */
+#pragma alloc_text(INIT, DriverEntry)
+#else
+CODE_SEG("INIT")
+#endif
ULONG
NTAPI
DriverEntry(
@@ -227,7 +238,7 @@ DriverEntry(
InitData.HwGetVideoChildDescriptor = Pc98VidGetVideoChildDescriptor;
}
- InitData.HwLegacyResourceList = LegacyRangeList;
+ InitData.HwLegacyResourceList = (PVIDEO_ACCESS_RANGE)LegacyRangeList;
InitData.HwLegacyResourceCount = RTL_NUMBER_OF(LegacyRangeList);
InitData.AdapterInterfaceType = Isa;
diff --git a/win32ss/drivers/miniport/pc98vid/pc98vid.h
b/win32ss/drivers/miniport/pc98vid/pc98vid.h
index 75cb4402c26..7cb9b15ef44 100644
--- a/win32ss/drivers/miniport/pc98vid/pc98vid.h
+++ b/win32ss/drivers/miniport/pc98vid/pc98vid.h
@@ -22,6 +22,10 @@
#define READ_PORT_UCHAR(p) VideoPortReadPortUchar(p)
#include <drivers/pc98/video.h>
+#if defined(_MSC_VER)
+#pragma section("PAGECONS", read)
+#endif
+
#define MONITOR_HW_ID 0x1033FACE /* Dummy */
typedef struct _VIDEOMODE
@@ -54,23 +58,27 @@ NTAPI
HasPegcController(
_In_ PHW_DEVICE_EXTENSION DeviceExtension);
+CODE_SEG("PAGE")
BOOLEAN
NTAPI
Pc98VidStartIO(
_In_ PVOID HwDeviceExtension,
_Inout_ PVIDEO_REQUEST_PACKET RequestPacket);
+CODE_SEG("PAGE")
VP_STATUS
FASTCALL
Pc98VidSetCurrentMode(
_In_ PHW_DEVICE_EXTENSION DeviceExtension,
_In_ PVIDEO_MODE RequestedMode);
+CODE_SEG("PAGE")
VP_STATUS
FASTCALL
Pc98VidSetColorRegisters(
_In_ PVIDEO_CLUT ColorLookUpTable);
+CODE_SEG("PAGE")
VP_STATUS
NTAPI
Pc98VidGetPowerState(
@@ -78,6 +86,7 @@ Pc98VidGetPowerState(
_In_ ULONG HwId,
_In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl);
+CODE_SEG("PAGE")
VP_STATUS
NTAPI
Pc98VidSetPowerState(
@@ -85,6 +94,7 @@ Pc98VidSetPowerState(
_In_ ULONG HwId,
_In_ PVIDEO_POWER_MANAGEMENT VideoPowerControl);
+DATA_SEG("PAGECONS")
extern const VIDEOMODE VideoModes[];
#endif /* _PC98VID_PCH_ */