--- /dev/null
+//++\r
+// Copyright (c) 2006, Intel Corporation \r
+// All rights reserved. This program and the accompanying materials \r
+// are licensed and made available under the terms and conditions of the BSD License \r
+// which accompanies this distribution. The full text of the license may be found at \r
+// http://opensource.org/licenses/bsd-license.php \r
+// \r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+// \r
+// Module Name:\r
+//\r
+// Ds64Macros.i\r
+//\r
+// Abstract:\r
+//\r
+// This is set of macros used in calculating offsets in the IVT\r
+//\r
+// Revision History:\r
+//\r
+//--\r
+\r
+#define EXCPT_EXTERNAL_INTERRUPT 12\r
+#define MASK_0_4 0x000000000000001F // mask bits 0 through 4\r
+#define SLOT0 0\r
+#define SLOT1 1\r
+#define SLOT2 2\r
+\r
+#define PSR_DT 17\r
+#define PSR_TB 26\r
+#define PSR_RT 27\r
+#define PSR_IS 34\r
+#define PSR_IT 36\r
+#define PSR_IC 13\r
+#define PSR_I 14\r
+#define PSR_SS 40\r
+#define PSR_BN 44\r
+#define PSR_RI_MASK 0x60000000000\r
+\r
+#define EXCPT_EXTERNAL_INTERRUPT 12\r
+\r
+#define SCRATCH_REG0 r23\r
+#define SCRATCH_REG1 r24\r
+#define SCRATCH_REG2 r25\r
+#define SCRATCH_REG3 r26\r
+#define SCRATCH_REG4 r27\r
+#define SCRATCH_REG5 r28\r
+#define SCRATCH_REG6 r29\r
+#define PR_REG r30\r
+#define B0_REG r31\r
+\r
+\r
+// EXT_INT_OFFSET is the offset of the external interrupt entry in the IVT\r
+#define EXT_INT_ENTRY_OFFSET 0x03000\r
+\r
+// PATCH_ENTRY_OFFSET is the offset into the IVT of the entry that is coopted (stolen)\r
+// for use by the handler. The entire entry is restored when the handler is\r
+// unloaded.\r
+#define PATCH_ENTRY_OFFSET 0x03400\r
+\r
+// PATCH_BUNDLES is the number of bundles actually in the patch\r
+#define NUM_PATCH_BUNDLES ((EndPatchCode - PatchCode) / 0x10)\r
+\r
+// A hard coded branch back into the external interrupt IVT entry's second bundle\r
+// is put here, just in case the original bundle zero did not have a branch\r
+// This is the last bundle in the reserved IVT entry\r
+#define FAILSAFE_BRANCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - 0x10)\r
+\r
+// the original external interrupt IVT entry bundle zero is copied and relocated\r
+// here... also in the reserved IVT entry\r
+// This is the second-to-last bundle in the reserved IVT entry\r
+#define RELOCATED_EXT_INT (PATCH_ENTRY_OFFSET + 0x400 - 0x20)\r
+\r
+// The patch is actually stored at the end of IVT:PATCH_ENTRY. The PATCH_OFFSET\r
+// is the offset into IVT where the patch is actually stored. It is carefully\r
+// located so that when we run out of patch code, the next bundle is the\r
+// relocated bundle 0 from the original external interrupt handler\r
+#define PATCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCode ) - 0x20)\r
+\r
+#define PATCH_RETURN_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCodeRet ) - 0x20)\r
+\r
+// PATCH_BRANCH is used only in the new bundle that is placed at the beginning\r
+// of the external interrupt IVT entry.\r
+#define PATCH_BRANCH (PATCH_OFFSET - EXT_INT_ENTRY_OFFSET)\r
+\r