From 3131aac7a99a07320c3c99ef886574044eb3ac6e Mon Sep 17 00:00:00 2001 From: belliash Date: Thu, 5 Jan 2023 15:58:36 +0100 Subject: [PATCH] Move serial ports I/O address to architecture specific header --- sdk/xtdk/amd64/hltypes.h | 3 +++ sdk/xtdk/i686/hltypes.h | 3 +++ xtoskrnl/hl/cport.c | 5 ++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sdk/xtdk/amd64/hltypes.h b/sdk/xtdk/amd64/hltypes.h index 51971e7..9de74be 100644 --- a/sdk/xtdk/amd64/hltypes.h +++ b/sdk/xtdk/amd64/hltypes.h @@ -14,6 +14,9 @@ #include "xttypes.h" +/* Serial port I/O addresses */ +#define COMPORT_ADDRESSES {0x000, 0x3F8, 0x2F8, 0x3E8, 0x2E8, 0x5F8, 0x4F8, 0x5E8, 0x4E8} + /* Control Register 0 constants */ #define CR0_PE 0x00000001 #define CR0_MP 0x00000002 diff --git a/sdk/xtdk/i686/hltypes.h b/sdk/xtdk/i686/hltypes.h index 8148203..3f7173b 100644 --- a/sdk/xtdk/i686/hltypes.h +++ b/sdk/xtdk/i686/hltypes.h @@ -14,6 +14,9 @@ #include "xttypes.h" +/* Serial port I/O addresses */ +#define COMPORT_ADDRESSES {0x000, 0x3F8, 0x2F8, 0x3E8, 0x2E8, 0x5F8, 0x4F8, 0x5E8, 0x4E8} + /* Control Register 0 constants */ #define CR0_PE 0x00000001 #define CR0_MP 0x00000002 diff --git a/xtoskrnl/hl/cport.c b/xtoskrnl/hl/cport.c index e12614c..685413f 100644 --- a/xtoskrnl/hl/cport.c +++ b/xtoskrnl/hl/cport.c @@ -9,9 +9,8 @@ #include "xtkmapi.h" -/* I/O port addresses for COM1 - COM8 (valid only for ia32 and amd64) */ -ULONG ComPortAddress[] = {0x000, 0x3F8, 0x2F8, 0x3E8, 0x2E8, 0x5F8, 0x4F8, 0x5E8, 0x4E8}; - +/* COM port I/O addresses */ +ULONG ComPortAddress[] = COMPORT_ADDRESSES; /** * This routine gets a byte from serial port.