示例#1
0
def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
    argList = apiparser.MakeArgList(argTypeList, argNameList)
    parms = MakeParamList(argNameList)
    printString = MakePrintfString(name, argTypeList, argNameList)
    if alias == '':
        dispatchName = name
    else:
        dispatchName = alias
    if offset < 0:
        offset = FindOffset(dispatchName)
    if offset >= 0:
        print 'KEYWORD1 %s KEYWORD2 NAME(%s)(%s)' % (returnType, name, argList)
        print '{'
        if returnType == 'void':
            print '   DISPATCH(%s, (%s), %s);' % (dispatchName, parms,
                                                  printString)
        else:
            print '   RETURN_DISPATCH(%s, (%s), %s);' % (dispatchName, parms,
                                                         printString)
        print '}'
        print ''
        records.append((name, dispatchName, offset))
        if not emittedFuncs.has_key(offset):
            emittedFuncs[offset] = name
        else:
            aliasedFuncs.append(name)
    else:
        print '/* No dispatch for %s() */' % (name)
示例#2
0
def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
    argList = apiparser.MakeArgList(argTypeList, argNameList)
    if alias != '':
        dispatchName = alias
    else:
        dispatchName = name
    #endif

    if offset < 0:
        # try to find offset from alias name
        assert dispatchName != ''
        offset = FindOffset(dispatchName)
        if offset == -1:
            #print 'Cannot dispatch %s' % name
            return
        #endif
    #endif

    # save this info in case we need to look up an alias later
    records.append((name, dispatchName, offset))

    # Find the argument stack size for _stdcall name mangling
    stackSize = FindStackSize(argTypeList)

    # print the assembly code
    print 'ALIGNTEXT16'
    print "GLOBL_FN(GL_PREFIX(%s,%s@%s))" % (name, name, stackSize)
    print "GL_PREFIX(%s,%s@%s):" % (name, name, stackSize)
    print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX)'
    print "\tJMP(GL_OFFSET(_gloffset_%s))" % (dispatchName)
    print ''
示例#3
0
def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
    argList = apiparser.MakeArgList(argTypeList, argNameList)
    if alias != '':
        dispatchName = alias
    else:
        dispatchName = name
    #endif

    if offset < 0:
        # try to find offset from alias name
        assert dispatchName != ''
        offset = FindOffset(dispatchName)
        if offset == -1:
            #print 'Cannot dispatch %s' % name
            return
        #endif
    #endif

    # save this info in case we need to look up an alias later
    records.append((name, dispatchName, offset))

    # print the assembly code
    # note that for clarity this has been changed to supply _glapi_Dispatch
    # instead of zeroes, but _mesa_init_sparc_glapi_relocs() will replace
    # the relocations regardless
    print ''
    print '.globl gl%s' % (name)
    print '.type gl%s,#function' % (name)
    print 'gl%s:' % (name)
    print '#if (defined(__sparc_v9__) && \\'
    print '    (!defined(__linux__) || defined(__linux_sparc_64__)))'
    print '\tsethi\t%uhi(_glapi_Dispatch), %g2'
    print '\tsethi\t%hi(_glapi_Dispatch), %g1'
    print '\tor\t%g2, %ulo(_glapi_Dispatch), %g2'
    print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
    print '\tsllx\t%g2, 32, %g2'
    print '\tldx\t[%g1 + %g2], %g1'
    print "\tsethi\t%%hi(8 * _gloffset_%s), %%g2" % (dispatchName)
    print "\tor\t%%g2, %%lo(8 * _gloffset_%s), %%g2" % (dispatchName)
    print '\tldx\t[%g1 + %g2], %g3'
    print '#else'
    print '\tsethi\t%hi(_glapi_Dispatch), %g1'
    print '\tld\t[%g1 + %lo(_glapi_Dispatch)], %g1'
    print "\tld\t[%%g1 + (4 * _gloffset_%s)], %%g3" % (dispatchName)
    print '#endif'
    print '\tjmpl\t%g3, %g0'
    print '\tnop'
示例#4
0
def EmitFunction(name, returnType, argTypeList, argNameList, alias, offset):
    argList = apiparser.MakeArgList(argTypeList, argNameList)
    if alias != '':
        dispatchName = alias
    else:
        dispatchName = name
    #endif

    if offset < 0:
        # try to find offset from alias name
        assert dispatchName != ''
        offset = FindOffset(dispatchName)
        if offset == -1:
            #print 'Cannot dispatch %s' % name
            return
        #endif
    #endif

    # save this info in case we need to look up an alias later
    records.append((name, dispatchName, offset))

    # print the assembly code
    print ''
    print '.globl gl%s' % (name)
    print '.type gl%s,#function' % (name)
    print 'gl%s:' % (name)
    print '#if (defined(__sparc_v9__) && (!defined(__linux__) || defined(__linux_sparc_64__)))'
    print '\tsethi\t%hi(0x00000000), %g2'
    print '\tsethi\t%hi(0x00000000), %g1'
    print '\tor\t%g2, %lo(0x00000000), %g2'
    print '\tor\t%g1, %lo(0x00000000), %g1'
    print '\tsllx\t%g2, 32, %g2'
    print '\tldx\t[%g1 + %g2], %g1'
    print "\tsethi\t%%hi(8 * _gloffset_%s), %%g2" % (dispatchName)
    print "\tor\t%%g2, %%lo(8 * _gloffset_%s), %%g2" % (dispatchName)
    print '\tldx\t[%g1 + %g2], %g3'
    print '#else'
    print '\tsethi\t%hi(0x00000000), %g1'
    print '\tld\t[%g1 + %lo(0x00000000)], %g1'
    print "\tld\t[%%g1 + (4 * _gloffset_%s)], %%g3" % (dispatchName)
    print '#endif'
    print '\tjmpl\t%g3, %g0'
    print '\tnop'
示例#5
0
def DoRecord(name, returnType, argTypeList, argNameList, alias, offset):
    argList = apiparser.MakeArgList(argTypeList, argNameList)
    if offset >= 0 and not records.has_key(offset):
        records[offset] = (name, returnType, argList)