Annotation of ntddk/src/video/inc/callconv.inc, revision 1.1

1.1     ! root        1: 
        !             2: ;****************************Public Macro************************************
        !             3: ;
        !             4: ;   ComposeInst Inst,p1,p2,p3,p4,p5,p6,p7,p8,p9
        !             5: ;
        !             6: ;       This macro simply concatenates all arguments into one string.
        !             7: ;
        !             8: ;   History:
        !             9: ;       Thu 15-Aug-1991 16:21:14    -by-    Viroon Touranachun [viroont]
        !            10: ;           Created
        !            11: ;
        !            12: ;****************************************************************************
        !            13: 
        !            14: ComposeInst macro   Inst,p1,p2,p3,p4,p5,p6,p7,p8,p9
        !            15:         &Inst &p1&p2&p3&p4&p5&p6&p7&p8&p9
        !            16: endm
        !            17: 
        !            18: ;****************************Public Macro************************************
        !            19: ;
        !            20: ;   CountArg    cCount,ArgList
        !            21: ;
        !            22: ;       This macro count the number of arguments in the ArgList and returns
        !            23: ;       the value in cCount.
        !            24: ;
        !            25: ;   History:
        !            26: ;       Thu 15-Aug-1991 16:21:14    -by-    Viroon Touranachun [viroont]
        !            27: ;           Created
        !            28: ;
        !            29: ;****************************************************************************
        !            30: 
        !            31: CountArg    macro   cCount,ArgList
        !            32: 
        !            33:         cCount = 0
        !            34: 
        !            35:         irp arg,<ArgList>
        !            36:             cCount = cCount+1
        !            37:         endm
        !            38: endm
        !            39: 
        !            40: ;****************************Public Macro************************************
        !            41: ;
        !            42: ;   RevPush     ArgList,cCount
        !            43: ;
        !            44: ;       This macro pushes the arguments in ArgList in the reverse order
        !            45: ;       and returns the number of arguments in cCount.
        !            46: ;
        !            47: ;   History:
        !            48: ;       Thu 15-Aug-1991 16:21:14    -by-    Viroon Touranachun [viroont]
        !            49: ;           Created
        !            50: ;
        !            51: ;****************************************************************************
        !            52: 
        !            53: RevPush macro   ArgList,cCount
        !            54:         Local   index,x
        !            55: 
        !            56:         CountArg cCount,<ArgList>
        !            57: 
        !            58:         index  = cCount
        !            59:         rept    cCount
        !            60:             x = 0
        !            61:             irp arg,<ArgList>
        !            62:                 x = x+1
        !            63:                 ife index-x
        !            64:                     push    arg
        !            65:                     exitm
        !            66:                 endif
        !            67:             endm
        !            68:             index = index-1
        !            69:         endm
        !            70: endm
        !            71: 
        !            72: ;****************************Public Macro************************************
        !            73: ;
        !            74: ;   The following sections contain calling-convention related macros for:
        !            75: ;
        !            76: ;   PUBLICP     Func,N
        !            77: ;       to define a public label
        !            78: ;
        !            79: ;   EXTRNP      Func,N,Thunk
        !            80: ;       to define a external near label
        !            81: ;
        !            82: ;   LABELP      Func,N
        !            83: ;       to label an address as a routine entry point
        !            84: ;
        !            85: ;   stdPROC       Func,N,ArgList
        !            86: ;       to declare a routine header
        !            87: ;
        !            88: ;   ProcName    Name,Func,N
        !            89: ;       to rename a function Func to Name. Using it in conjunction with
        !            90: ;       normal function declaration (with the new name) will solve an error
        !            91: ;       caused by a long parameter list routine that exhausts page width.
        !            92: ;
        !            93: ;   stdRET        Func
        !            94: ;       to return from Func routines (declared with stdPROC or ProcName.)
        !            95: ;
        !            96: ;   stdENDP     Func
        !            97: ;       to declare the end of routine (declared with stdPROC or ProcName.)
        !            98: ;
        !            99: ;   endMod      Func
        !           100: ;       to declare the end of module with an entry point at Func (declared
        !           101: ;       with stdPROC or ProcName.)
        !           102: ;
        !           103: ;   stdCall     Func,ArgList
        !           104: ;       to call to a routine--Func--with the arguments pushed on the stack
        !           105: ;
        !           106: ;   MovAddr     dest,Func,n
        !           107: ;       to move the address of the routine--Func--into dest.
        !           108: ;
        !           109: ;   Note that for the standard calling convention all the function names,
        !           110: ;   Func, are automatically converted to Func@N where N is the number of
        !           111: ;   bytes (decimal) in the argument list.
        !           112: ;
        !           113: ;   History:
        !           114: ;       Thu 15-Aug-1991 16:21:14    -by-    Viroon Touranachun [viroont]
        !           115: ;           Created
        !           116: ;
        !           117: ;       John Vert (jvert) 3-Aug-1992
        !           118: ;           Stolen from GDI and modified for use in the kernel
        !           119: ;
        !           120: ;****************************************************************************
        !           121: 
        !           122: IFNDEF STD_CALL
        !           123: 
        !           124: ;****************************************************************************
        !           125: ;
        !           126: ;   This section is used exclusively for C calling convention.
        !           127: ;
        !           128: ;****************************************************************************
        !           129: 
        !           130: PUBLICP macro   Func,N
        !           131: 
        !           132:         public      &Func
        !           133: endm
        !           134: 
        !           135: EXTRNP  macro   Func,N,Thunk
        !           136: 
        !           137:         extrn       &Func:NEAR
        !           138: endm
        !           139: 
        !           140: LABELP  macro   Func,N
        !           141: 
        !           142:         &Func       LABEL   NEAR
        !           143: endm
        !           144: 
        !           145: ProcName macro  Name,Func,N
        !           146: 
        !           147:         &Name        EQU     <&Func>
        !           148: endm
        !           149: 
        !           150: stdPROC   macro   Func,N,ArgList
        !           151: 
        !           152:         &Func proc &ArgList
        !           153: endm
        !           154: 
        !           155: cPublicProc macro Func,N,ArgList
        !           156:         align   dword
        !           157:         PUBLICP  Func,N
        !           158:         stdPROC Func,N,&ArgList
        !           159: endm
        !           160: 
        !           161: cPublicFpo macro FpoLocals, FpoParams
        !           162: 
        !           163: endm
        !           164: 
        !           165: stdRET    macro   Func
        !           166: 
        !           167:         ret
        !           168: endm
        !           169: 
        !           170: stdENDP macro   Func
        !           171: 
        !           172:         &Func   endp
        !           173: endm
        !           174: 
        !           175: endMod  macro   Func
        !           176: 
        !           177: end     xxx&Func
        !           178: 
        !           179: endm
        !           180: 
        !           181: stdCall macro   Func,ArgList
        !           182:         Local   Bytes
        !           183: 
        !           184:         RevPush <ArgList>,Bytes
        !           185:         Bytes = Bytes*4
        !           186: 
        !           187:         call    &Func
        !           188: 
        !           189:         if      Bytes GT 0
        !           190:             add     esp,Bytes
        !           191:         endif
        !           192: 
        !           193: endm
        !           194: 
        !           195: MovAddr macro   dest,addr,n
        !           196: 
        !           197:         mov     dest,offset FLAT:&addr
        !           198: endm
        !           199: 
        !           200: ELSE
        !           201: 
        !           202: ;****************************************************************************
        !           203: ;
        !           204: ;   This section is used exclusively for the standard calling convention.
        !           205: ;
        !           206: ;****************************************************************************
        !           207: 
        !           208: PUBLICP macro   Func,N
        !           209: 
        !           210:         ifb    <N>
        !           211:             public      &Func&@0
        !           212:         else
        !           213:             PUBLICP2    Func,%(N*4)
        !           214:         endif
        !           215: endm
        !           216: 
        !           217: PUBLICP2 macro   Func,N
        !           218: 
        !           219:         public       &Func&@&N
        !           220: endm
        !           221: 
        !           222: EXTRNP  macro   Func,N,Thunk
        !           223:         ifb    <N>
        !           224:             IFNDEF &Func&@0
        !           225:                 extrn       &Func&@0:NEAR
        !           226:             ENDIF
        !           227:         else
        !           228:             ifb     <Thunk>
        !           229:                 EXTRNP2     Func,%(N*4)
        !           230:             else
        !           231:                 EXTRNTHUNK  Func,%(N*4)
        !           232:             endif
        !           233:         endif
        !           234: endm
        !           235: 
        !           236: EXTRNP2 macro   Func,N
        !           237:         IFNDEF  &Func&@&N
        !           238:             extrn       &Func&@&N:NEAR
        !           239:         ENDIF
        !           240: endm
        !           241: 
        !           242: EXTRNTHUNK macro   Func,N
        !           243:         IFNDEF  __imp_&Func&@&N
        !           244:             extrn       __imp_&Func&@&N:DWORD
        !           245:         ENDIF
        !           246: endm
        !           247: 
        !           248: LABELP  macro   Func,N
        !           249: 
        !           250:         ifb    <N>
        !           251:             &Func&@0    LABEL   NEAR
        !           252:         else
        !           253:             &Func&@&N   LABEL   NEAR
        !           254:         endif
        !           255: endm
        !           256: 
        !           257: ProcName macro  Name,Func,N
        !           258: 
        !           259:         ifb <N>
        !           260:             cByte&Func   EQU     0
        !           261:             &Name        EQU     <&Func&@0>
        !           262:         else
        !           263:             cByte&Func   EQU     N
        !           264:             &Name        EQU     <&Func&@&N>
        !           265:         endif
        !           266: endm
        !           267: 
        !           268: stdPROC   macro   Func,N,ArgList
        !           269: 
        !           270:         ProcName &Func,Func,%(N*4)
        !           271: 
        !           272:         &Func proc &ArgList
        !           273: endm
        !           274: 
        !           275: cPublicProc macro Func,N,ArgList
        !           276:         align dword
        !           277:         PUBLICP Func,N
        !           278:         ifb <N>
        !           279:             stdPROC Func,0,<&ArgList>
        !           280:         else
        !           281:             stdPROC Func,N,<&ArgList>
        !           282:         endif
        !           283: endm
        !           284: 
        !           285: stdRET    macro   Func
        !           286: 
        !           287:         ret     cByte&Func
        !           288: 
        !           289: endm
        !           290: 
        !           291: cPublicFpo macro FpoLocals, FpoParams
        !           292: 
        !           293: .FPO ( FpoParams, FpoLocals, 0, 0, 0, 0 )
        !           294: 
        !           295: endm
        !           296: 
        !           297: 
        !           298: stdENDP macro   Func
        !           299: 
        !           300:         &Func   endp
        !           301: 
        !           302: endm
        !           303: 
        !           304: endMod  macro   Func
        !           305: 
        !           306: end     &Func
        !           307: 
        !           308: endm
        !           309: 
        !           310: stdCallCall macro  Func,N
        !           311:     IFDEF  __imp_&Func&@&N
        !           312:         call    dword ptr [ __imp_&Func&@&N ]
        !           313:     ELSE
        !           314:         call    &Func&@&N
        !           315:     ENDIF
        !           316: endm stdCallThunk
        !           317: 
        !           318: 
        !           319: stdCall macro   Func,ArgList
        !           320:         Local   Bytes
        !           321: 
        !           322:         RevPush <ArgList>,Bytes
        !           323:         Bytes = Bytes*4
        !           324: 
        !           325:         stdCallCall   Func,%(Bytes)
        !           326: endm
        !           327: 
        !           328: 
        !           329: MovAddr macro   dest,addr,n
        !           330: 
        !           331:         ComposeInst <mov >,dest,<,offset FLAT:>,addr,<@>,n
        !           332: endm
        !           333: 
        !           334: ENDIF   ;STD_CALL

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.