Author: aandrejevic
Date: Fri Feb 21 01:29:13 2014
New Revision: 62279
URL:
http://svn.reactos.org/svn/reactos?rev=62279&view=rev
Log:
[FAST486]
Add a macro ALIGNMENT_CHECK that checks for unaligned pointers and generates an exception.
Modified:
branches/ntvdm/lib/fast486/common.h
Modified: branches/ntvdm/lib/fast486/common.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/common.h?rev=…
==============================================================================
--- branches/ntvdm/lib/fast486/common.h [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/common.h [iso-8859-1] Fri Feb 21 01:29:13 2014
@@ -54,6 +54,15 @@
if (State->PrefixFlags & FAST486_PREFIX_ADSIZE) x = !x;
#define SWAP(x, y) { (x) ^= (y); (y) ^= (x); (x) ^= (y); }
+
+#define ALIGNMENT_CHECK(x, a) if (State->Flags.Ac \
+ && (State->ControlRegisters[FAST486_REG_CR0]
& FAST486_CR0_AM)\
+ && (State->Cpl == 3)\
+ && (((x) % (a)) != 0))\
+{\
+ Fast486Exception(State, FAST486_EXCEPTION_AC);\
+ return FALSE;\
+}
#define PAGE_ALIGN(x) ((x) & 0xFFFFF000)
#define PAGE_OFFSET(x) ((x) & 0x00000FFF)