From: Aleksandar Andrejevic Date: Fri, 21 Feb 2014 01:29:13 +0000 (+0000) Subject: [FAST486] X-Git-Tag: backups/0.3.17@66124~1365^2~77 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=0b434e7c6c589a8e60f7577975d147d392aa6c1b;hp=011259b78f790a79748cb49c6e35b350e1eafd13 [FAST486] Add a macro ALIGNMENT_CHECK that checks for unaligned pointers and generates an exception. svn path=/branches/ntvdm/; revision=62279 --- diff --git a/lib/fast486/common.h b/lib/fast486/common.h index a97f1c5ac2d..1bfdb311ef2 100644 --- a/lib/fast486/common.h +++ b/lib/fast486/common.h @@ -55,6 +55,15 @@ if (State->PrefixFlags & FAST486_PREFIX_LOCK)\ #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) #define GET_ADDR_PDE(x) ((x) >> 22)