2 /// This is set of macros used in calculating offsets in the IVT.
4 /// Copyright (c) 2006 - 2008, Intel Corporation
5 /// All rights reserved. This program and the accompanying materials
6 /// are licensed and made available under the terms and conditions of the BSD License
7 /// which accompanies this distribution. The full text of the license may be found at
8 /// http://opensource.org/licenses/bsd-license.php
10 /// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 /// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 /// Module Name: Ds64Macros.i
18 #define EXCPT_EXTERNAL_INTERRUPT 12
19 #define MASK_0_4 0x000000000000001F // mask bits 0 through 4
33 #define PSR_RI_MASK 0x60000000000
35 #define EXCPT_EXTERNAL_INTERRUPT 12
37 #define SCRATCH_REG0 r23
38 #define SCRATCH_REG1 r24
39 #define SCRATCH_REG2 r25
40 #define SCRATCH_REG3 r26
41 #define SCRATCH_REG4 r27
42 #define SCRATCH_REG5 r28
43 #define SCRATCH_REG6 r29
48 // EXT_INT_OFFSET is the offset of the external interrupt entry in the IVT
49 #define EXT_INT_ENTRY_OFFSET 0x03000
51 // PATCH_ENTRY_OFFSET is the offset into the IVT of the entry that is coopted (stolen)
52 // for use by the handler. The entire entry is restored when the handler is
54 #define PATCH_ENTRY_OFFSET 0x03400
56 // PATCH_CODE_SIZE is the size of patch code
57 #define PATCH_CODE_SIZE (EndPatchCode - PatchCode)
59 // A hard coded branch back into the external interrupt IVT entry's second bundle
60 // is put here, just in case the original bundle zero did not have a branch
61 // This is the last bundle in the reserved IVT entry
62 #define FAILSAFE_BRANCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - 0x10)
64 // the original external interrupt IVT entry bundle zero is copied and relocated
65 // here... also in the reserved IVT entry
66 // This is the second-to-last bundle in the reserved IVT entry
67 #define RELOCATED_EXT_INT (PATCH_ENTRY_OFFSET + 0x400 - 0x20)
69 // The patch is actually stored at the end of IVT:PATCH_ENTRY. The PATCH_OFFSET
70 // is the offset into IVT where the patch is actually stored. It is carefully
71 // located so that when we run out of patch code, the next bundle is the
72 // relocated bundle 0 from the original external interrupt handler
73 #define PATCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCode ) - 0x20)
75 #define PATCH_RETURN_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCodeRet ) - 0x20)
77 // PATCH_BRANCH is used only in the new bundle that is placed at the beginning
78 // of the external interrupt IVT entry.
79 #define PATCH_BRANCH (PATCH_OFFSET - EXT_INT_ENTRY_OFFSET)