00001
00002
00003
00004
00005 #ifndef _GEM_VDI_P_
00006 # define _GEM_VDI_P_
00007
00008 # ifndef _GEMLIB_H_
00009 # include "mt_gem.h"
00010 # endif
00011
00012
00013 #define vdi_control_ptr(n) *((void**)(vdi_control +n))
00014 #define vdi_intin_ptr(n) *((void**)(vdi_intin +n))
00015 #define vdi_intout_long(n) *((long*) (vdi_intout +n))
00016
00017 #if defined(__GNUC_INLINE__) && (__GNUC__ > 2 || __GNUC_MINOR__ > 5)
00018
00019 static inline void
00020 _vdi_trap_esc (VDIPB * vdipb,
00021 long cntrl_0_1, long cntrl_3, long cntrl_5, short handle)
00022 {
00023 __asm__ volatile (
00024 "movea.l %0,a0\n\t"
00025 "move.l a0,d1\n\t"
00026 "move.l (a0),a0\n\t"
00027 "move.l %1,(a0)+\n\t"
00028 "move.l %2,(a0)+\n\t"
00029 "move.l %3,(a0)+\n\t"
00030 "move.w %4,(a0)\n\t"
00031 "move.w #115,d0\n\t"
00032 "trap #2"
00033 :
00034 : "a"(vdipb), "g"(cntrl_0_1), "g"(cntrl_3), "g"(cntrl_5), "g"(handle)
00035 : "a0", "d0", "d1", "memory"
00036 );
00037 }
00038 #define VDI_TRAP_ESC(vdipb, handle, opcode, subop, cntrl_1, cntrl_3) \
00039 _vdi_trap_esc (&vdipb, (opcode##uL<<16)|cntrl_1, cntrl_3, subop, handle)
00040
00041 static inline void
00042 _vdi_trap_00 (VDIPB * vdipb, long cntrl_0_1, short handle)
00043 {
00044 __asm__ volatile (
00045 "movea.l %0,a0\n\t"
00046 "move.l a0,d1\n\t"
00047 "move.l (a0),a0\n\t"
00048 "move.l %1,(a0)+\n\t"
00049 "eor.l d0,d0\n\t"
00050 "move.l d0,(a0)+\n\t"
00051 "move.l d0,(a0)+\n\t"
00052 "move.w %2,(a0)\n\t"
00053 "move.w #115,d0\n\t"
00054 "trap #2"
00055 :
00056 : "a"(vdipb), "g"(cntrl_0_1), "g"(handle)
00057 : "a0", "d0","d1","memory"
00058 );
00059 }
00060 #define VDI_TRAP_00(vdipb, handle, opcode) \
00061 _vdi_trap_00 (&vdipb, (opcode##uL<<16), handle)
00062
00063
00064 #else
00065
00066 #define VDI_TRAP_ESC(vdipb, handle, opcode, subop, cntrl_1, cntrl_3) \
00067 vdi_control[0] = opcode; \
00068 vdi_control[1] = cntrl_1; \
00069 vdi_control[3] = cntrl_3; \
00070 vdi_control[5] = subop; \
00071 vdi_control[6] = handle; \
00072 vdi (&vdipb);
00073
00074 #define VDI_TRAP_00(vdipb, handle, opcode) \
00075 VDI_TRAP_ESC (vdipb, handle, opcode, 0, 0, 0)
00076 #endif
00077
00078
00079 #define VDI_TRAP(vdipb, handle, opcode, cntrl_1, cntrl_3) \
00080 VDI_TRAP_ESC(vdipb, handle, opcode, 0, cntrl_1, cntrl_3)
00081
00082 #define VDI_PARAMS(a,b,c,d,e) \
00083 VDIPB vdi_params; \
00084 vdi_params.control = a; \
00085 vdi_params.intin = b; \
00086 vdi_params.ptsin = c; \
00087 vdi_params.intout = d; \
00088 vdi_params.ptsout = e;
00089
00090
00091
00092
00093
00094 #define CHECK_NULLPTR 1
00095
00096
00097
00098
00099
00100 #define USE_VDI_DUMMY 1
00101
00102 #if USE_VDI_DUMMY
00103
00104 extern short vdi_dummy[];
00105 #else
00106
00107 #define vdi_dummy 0L
00108 #endif
00109
00110 # endif