Linux_i386_exports.py revision bc32972cf8383f278e08cb0b480e8009babd15ca
d46ee884c41b808b239563b1978468aae12e33a2vboxsync# Copyright (c) 2001, Stanford University
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync# All rights reserved.
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync#
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync# See the file LICENSE.txt for information on redistributing this software.
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsyncimport sys
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsyncimport apiutil
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsyncdef GenerateEntrypoints():
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync #apiutil.CopyrightC()
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync # Get sorted list of dispatched functions.
d46ee884c41b808b239563b1978468aae12e33a2vboxsync # The order is very important - it must match cr_opcodes.h
d46ee884c41b808b239563b1978468aae12e33a2vboxsync # and spu_dispatch_table.h
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print '%include "iprt/asmdefs.mac"'
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync print ""
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "%ifdef RT_ARCH_AMD64"
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "extern glim"
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "%else ; X86"
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "extern glim"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "%endif"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print ""
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync for index in range(len(keys)):
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync func_name = keys[index]
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync if apiutil.Category(func_name) == "Chromium":
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync continue
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "BEGINPROC_EXPORTED gl%s" % func_name
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "%ifdef RT_ARCH_AMD64"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "\tmov \trax, qword glim+%d" % (8*index)
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "\tjmp \t[rax]"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "%else ; X86"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "\tmov \teax, dword glim+%d" % (4*index)
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "\tjmp \t[eax]"
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "%endif"
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "ENDPROC gl%s" % func_name
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print ""
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print ';'
3b70c9ab3cea93ab1a771d2db319311282041382vboxsync print '; Aliases'
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ';'
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync # Now loop over all the functions and take care of any aliases
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
d46ee884c41b808b239563b1978468aae12e33a2vboxsync for func_name in allkeys:
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync if "omit" in apiutil.ChromiumProps(func_name):
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync continue
2a229554eb081e98411c81dcdef146c35a000f80vboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync if func_name in keys:
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync # we already processed this function earlier
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync continue
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync # alias is the function we're aliasing
d46ee884c41b808b239563b1978468aae12e33a2vboxsync alias = apiutil.Alias(func_name)
d46ee884c41b808b239563b1978468aae12e33a2vboxsync if alias:
d46ee884c41b808b239563b1978468aae12e33a2vboxsync # this dict lookup should never fail (raise an exception)!
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync index = keys.index(alias)
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync print "BEGINPROC_EXPORTED gl%s" % func_name
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "%ifdef RT_ARCH_AMD64"
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "\tmov \trax, qword glim+%d" % (8*index)
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "\tjmp \t[rax]"
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "%else ; X86"
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "\tmov \teax, dword glim+%d" % (4*index)
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync print "\tjmp \t[eax]"
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "%endif"
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "ENDPROC gl%s" % func_name
71e8510a26b72d539cf6d7d7157bd87a53de8cf4vboxsync print ""
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ';'
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print '; No-op stubs'
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ';'
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
358a99c385080f7f31166943f3ac3a2aea6b5263vboxsync # Now generate no-op stub functions
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync for func_name in allkeys:
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync if "stub" in apiutil.ChromiumProps(func_name):
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "BEGINPROC_EXPORTED gl%s" % func_name
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync print "\tleave"
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync print "\tret"
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync print "ENDPROC gl%s" % func_name
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ""
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
e33247bff4fddfdba92538374bcc9e2753044a38vboxsyncGenerateEntrypoints()
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync