ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/include/thunks.h
(Generate patch)

Comparing SheepShaver/src/include/thunks.h (file contents):
Revision 1.9 by gbeauche, 2004-11-13T14:09:16Z vs.
Revision 1.14 by gbeauche, 2006-05-03T21:45:14Z

# Line 32 | Line 32 | enum {
32    NATIVE_VIDEO_INSTALL_ACCEL,
33    NATIVE_VIDEO_VBL,
34    NATIVE_VIDEO_DO_DRIVER_IO,
35 +  NATIVE_ETHER_AO_GET_HWADDR,
36 +  NATIVE_ETHER_AO_ADD_MULTI,
37 +  NATIVE_ETHER_AO_DEL_MULTI,
38 +  NATIVE_ETHER_AO_SEND_PACKET,
39    NATIVE_ETHER_IRQ,
40    NATIVE_ETHER_INIT,
41    NATIVE_ETHER_TERM,
# Line 59 | Line 63 | enum {
63    NATIVE_BITBLT,
64    NATIVE_INVRECT,
65    NATIVE_FILLRECT,
66 +  NATIVE_NAMED_CHECK_LOAD_INVOC,
67 +  NATIVE_GET_NAMED_RESOURCE,
68 +  NATIVE_GET_1_NAMED_RESOURCE,
69    NATIVE_OP_MAX
70   };
71  
# Line 85 | Line 92 | extern uint32 NativeRoutineDescriptor(in
92  
93   /*
94   *  Helpers to share 32-bit addressable data with MacOS
95 + *
96 + *  There are two distinct allocatable regions:
97 + *
98 + *  - The Data region is used to share data between MacOS and
99 + *    SheepShaver. This is stack-like allocation since it is
100 + *    meant to only hold temporary data which dies at the end
101 + *    of the current function scope.
102 + *
103 + *  - The Procedure region is used to hold permanent M68K or
104 + *    PowerPC code to assist native routine implementations.
105 + *
106 + *  - The Procedure region grows up whereas the Data region
107 + *    grows down. They may intersect into the ZeroPage, which
108 + *    is a read-only page with all bits set to zero. In practise,
109 + *    the intersection is unlikely since the Procedure region is
110 + *    static and the Data region is meant to be small (< 256 KB).
111   */
112  
113   class SheepMem {
# Line 93 | Line 116 | protected:
116          static uint32  page_size;
117          static uintptr zero_page;
118          static uintptr base;
119 <        static uintptr top;
120 <        static const uint32 size = 0x40000; // 256 KB
119 >        static uintptr data;
120 >        static uintptr proc;
121 >        static const uint32 size = 0x80000; // 512 KB
122   public:
123          static bool Init(void);
124          static void Exit(void);
# Line 102 | Line 126 | public:
126          static uint32 ZeroPage();
127          static uint32 Reserve(uint32 size);
128          static void Release(uint32 size);
129 +        static uint32 ReserveProc(uint32 size);
130          friend class SheepVar;
131   };
132  
# Line 123 | Line 148 | inline uint32 SheepMem::ZeroPage()
148  
149   inline uint32 SheepMem::Reserve(uint32 size)
150   {
151 <        top -= align(size);
152 <        assert(top >= base);
153 <        return top;
151 >        data -= align(size);
152 >        assert(data >= proc);
153 >        return data;
154   }
155  
156   inline void SheepMem::Release(uint32 size)
157   {
158 <        top += align(size);
158 >        data += align(size);
159   }
160  
161 + inline uint32 SheepMem::ReserveProc(uint32 size)
162 + {
163 +        uint32 mproc = proc;
164 +        proc += align(size);
165 +        assert(proc < data);
166 +        return mproc;
167 + }
168 +
169 + static inline uint32 SheepProc(const uint8 *proc, uint32 proc_size)
170 + {
171 +        uint32 mac_proc = SheepMem::ReserveProc(proc_size);
172 +        Host2Mac_memcpy(mac_proc, proc, proc_size);
173 +        return mac_proc;
174 + }
175 +
176 + #define BUILD_SHEEPSHAVER_PROCEDURE(PROC)                                                       \
177 +        static uint32 PROC = 0;                                                                                 \
178 +        if (PROC == 0)                                                                                                  \
179 +                PROC = SheepProc(PROC##_template, sizeof(PROC##_template))
180 +
181   class SheepVar
182   {
183          uint32 m_base;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines