]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/DebugSupport/Dxe/ipf/Ds64Macros.i
Initial import.
[mirror_edk2.git] / EdkModulePkg / Universal / DebugSupport / Dxe / ipf / Ds64Macros.i
1 //++
2 // Copyright (c) 2006, Intel Corporation
3 // All rights reserved. This program and the accompanying materials
4 // are licensed and made available under the terms and conditions of the BSD License
5 // which accompanies this distribution. The full text of the license may be found at
6 // http://opensource.org/licenses/bsd-license.php
7 //
8 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10 //
11 // Module Name:
12 //
13 // Ds64Macros.i
14 //
15 // Abstract:
16 //
17 // This is set of macros used in calculating offsets in the IVT
18 //
19 // Revision History:
20 //
21 //--
22
23 #define EXCPT_EXTERNAL_INTERRUPT 12
24 #define MASK_0_4 0x000000000000001F // mask bits 0 through 4
25 #define SLOT0 0
26 #define SLOT1 1
27 #define SLOT2 2
28
29 #define PSR_DT 17
30 #define PSR_TB 26
31 #define PSR_RT 27
32 #define PSR_IS 34
33 #define PSR_IT 36
34 #define PSR_IC 13
35 #define PSR_I 14
36 #define PSR_SS 40
37 #define PSR_BN 44
38 #define PSR_RI_MASK 0x60000000000
39
40 #define EXCPT_EXTERNAL_INTERRUPT 12
41
42 #define SCRATCH_REG0 r23
43 #define SCRATCH_REG1 r24
44 #define SCRATCH_REG2 r25
45 #define SCRATCH_REG3 r26
46 #define SCRATCH_REG4 r27
47 #define SCRATCH_REG5 r28
48 #define SCRATCH_REG6 r29
49 #define PR_REG r30
50 #define B0_REG r31
51
52
53 // EXT_INT_OFFSET is the offset of the external interrupt entry in the IVT
54 #define EXT_INT_ENTRY_OFFSET 0x03000
55
56 // PATCH_ENTRY_OFFSET is the offset into the IVT of the entry that is coopted (stolen)
57 // for use by the handler. The entire entry is restored when the handler is
58 // unloaded.
59 #define PATCH_ENTRY_OFFSET 0x03400
60
61 // PATCH_BUNDLES is the number of bundles actually in the patch
62 #define NUM_PATCH_BUNDLES ((EndPatchCode - PatchCode) / 0x10)
63
64 // A hard coded branch back into the external interrupt IVT entry's second bundle
65 // is put here, just in case the original bundle zero did not have a branch
66 // This is the last bundle in the reserved IVT entry
67 #define FAILSAFE_BRANCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - 0x10)
68
69 // the original external interrupt IVT entry bundle zero is copied and relocated
70 // here... also in the reserved IVT entry
71 // This is the second-to-last bundle in the reserved IVT entry
72 #define RELOCATED_EXT_INT (PATCH_ENTRY_OFFSET + 0x400 - 0x20)
73
74 // The patch is actually stored at the end of IVT:PATCH_ENTRY. The PATCH_OFFSET
75 // is the offset into IVT where the patch is actually stored. It is carefully
76 // located so that when we run out of patch code, the next bundle is the
77 // relocated bundle 0 from the original external interrupt handler
78 #define PATCH_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCode ) - 0x20)
79
80 #define PATCH_RETURN_OFFSET (PATCH_ENTRY_OFFSET + 0x400 - ( EndPatchCode - PatchCodeRet ) - 0x20)
81
82 // PATCH_BRANCH is used only in the new bundle that is placed at the beginning
83 // of the external interrupt IVT entry.
84 #define PATCH_BRANCH (PATCH_OFFSET - EXT_INT_ENTRY_OFFSET)
85