~akheon23/pose/origin

« back to all changes in this revision

Viewing changes to SrcShared/Patches/EmPatchModuleTypes.h

  • Committer: Christopher Werkshage
  • Date: 2014-12-27 12:51:57 UTC
  • Revision ID: git-v1:cc9410eb6ec5b4e23248dc175d142202f86be8e8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C++; tab-width: 4 -*- */
 
2
/* ===================================================================== *\
 
3
        Copyright (c) 2001 PocketPyro, Inc.
 
4
        Portions Copyright (c) Palm, Inc.
 
5
        All rights reserved.
 
6
 
 
7
        This file is part of the Palm OS Emulator.
 
8
 
 
9
        This program is free software; you can redistribute it and/or modify
 
10
        it under the terms of the GNU General Public License as published by
 
11
        the Free Software Foundation; either version 2 of the License, or
 
12
        (at your option) any later version.
 
13
\* ===================================================================== */
 
14
 
 
15
#ifndef EmPatchModuleTypes_h
 
16
#define EmPatchModuleTypes_h
 
17
 
 
18
#include "EmPatchIf.h"                  // HeadpatchProc, TailpatchProc, IEmPatchModule
 
19
#include "EmStructs.h"                  // SystemCallContext
 
20
 
 
21
 
 
22
// ======================================================================
 
23
// At compile time, the list of functions we want to head- and tailpatch
 
24
// are stored in an array of ProtoPatchTableEntries.  At runtime, these
 
25
// compact arrays are expanded by PatchModule into a sparse array
 
26
// so that the function dispatch number can be used to look up the
 
27
// patch function.
 
28
// ======================================================================
 
29
 
 
30
struct ProtoPatchTableEntry
 
31
{
 
32
        uint16                  fTrapWord;
 
33
        HeadpatchProc   fHeadpatch;
 
34
        TailpatchProc   fTailpatch;
 
35
};
 
36
 
 
37
 
 
38
// ===========================================================================
 
39
//              InstalledLibPatchEntry
 
40
// ===========================================================================
 
41
// Structure used to hold tail-patch information.
 
42
 
 
43
class InstalledLibPatchEntry
 
44
{
 
45
        public:
 
46
                                                                InstalledLibPatchEntry (void) :
 
47
                                                                        fIsDirty (true),
 
48
                                                                        fTableP (NULL)
 
49
                                                                {
 
50
                                                                }
 
51
 
 
52
                bool                                    IsDirty (void) const
 
53
                                                                {
 
54
                                                                        return fIsDirty;
 
55
                                                                }
 
56
 
 
57
                void                                    SetDirty (bool dirty = true)
 
58
                                                                {
 
59
                                                                        fIsDirty = dirty;
 
60
                                                                }
 
61
 
 
62
                IEmPatchModule*                 GetPatchTableP (void) const
 
63
                                                                {
 
64
                                                                        return fTableP;
 
65
                                                                }
 
66
 
 
67
                void                                    SetPatchTableP (IEmPatchModule* tableP)
 
68
                                                                {
 
69
                                                                        fTableP = tableP;
 
70
                                                                }
 
71
 
 
72
        private:
 
73
                bool                                    fIsDirty;
 
74
                IEmPatchModule*                 fTableP;
 
75
};
 
76
 
 
77
typedef vector<InstalledLibPatchEntry> PatchedLibIndex;
 
78
 
 
79
 
 
80
// ===========================================================================
 
81
//              � TailpatchType
 
82
// ===========================================================================
 
83
// Structure used to hold tail-patch information.
 
84
 
 
85
struct TailpatchType
 
86
{
 
87
        SystemCallContext       fContext;
 
88
        int32                           fCount;
 
89
        TailpatchProc           fTailpatch;
 
90
};
 
91
 
 
92
typedef vector<TailpatchType>           TailPatchIndex;
 
93
 
 
94
#endif // EmPatchModuleTypes_h