SunOS_i386_exports.py revision a88953ac5b9988667a57d0dd230f1f7ae0d2579f
d46ee884c41b808b239563b1978468aae12e33a2vboxsync#
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync# Copyright (C) 2009 Sun Microsystems, Inc.
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync#
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync# available from http://www.virtualbox.org. This file is free software;
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync# you can redistribute it and/or modify it under the terms of the GNU
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync# General Public License (GPL) as published by the Free Software
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync#
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync# Clara, CA 95054 USA or visit http://www.sun.com if you need
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync# additional information or have any questions.
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsyncimport sys
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsyncimport apiutil
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
e2760cdc84c692bc46cfaf5018d313db2f122acavboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsyncdef GenerateEntrypoints():
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsync #apiutil.CopyrightC()
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync # Get sorted list of dispatched functions.
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync # The order is very important - it must match cr_opcodes.h
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync # and spu_dispatch_table.h
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print '%include "iprt/asmdefs.mac"'
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print ""
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "%ifdef RT_ARCH_AMD64"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "extern glim"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync print "%else ; X86"
1c94c0a63ba68be1a7b2c640e70d7a06464e4fcavboxsync 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":
d46ee884c41b808b239563b1978468aae12e33a2vboxsync continue
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "BEGINPROC_EXPORTED gl%s" % func_name
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "%ifdef RT_ARCH_AMD64"
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "%else ; X86"
3b70c9ab3cea93ab1a771d2db319311282041382vboxsync print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "%endif"
d46ee884c41b808b239563b1978468aae12e33a2vboxsync print "ENDPROC gl%s" % func_name
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ""
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ';'
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print '; Aliases'
2a229554eb081e98411c81dcdef146c35a000f80vboxsync print ';'
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync # Now loop over all the functions and take care of any aliases
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync for func_name in allkeys:
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync if "omit" in apiutil.ChromiumProps(func_name):
d46ee884c41b808b239563b1978468aae12e33a2vboxsync continue
d46ee884c41b808b239563b1978468aae12e33a2vboxsync
d46ee884c41b808b239563b1978468aae12e33a2vboxsync if func_name in keys:
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync # we already processed this function earlier
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync continue
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync # alias is the function we're aliasing
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync alias = apiutil.Alias(func_name)
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync if alias:
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync # this dict lookup should never fail (raise an exception)!
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync index = keys.index(alias)
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "BEGINPROC_EXPORTED gl%s" % func_name
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "%ifdef RT_ARCH_AMD64"
71e8510a26b72d539cf6d7d7157bd87a53de8cf4vboxsync print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "%else ; X86"
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "%endif"
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "ENDPROC gl%s" % func_name
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ""
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
358a99c385080f7f31166943f3ac3a2aea6b5263vboxsync
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync print ';'
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync print '; No-op stubs'
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ';'
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync # Now generate no-op stub functions
8cd393943ea52545c4d063f5a94436639f0f80b6vboxsync for func_name in allkeys:
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync if "stub" in apiutil.ChromiumProps(func_name):
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "BEGINPROC_EXPORTED gl%s" % func_name
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "\tleave"
e33247bff4fddfdba92538374bcc9e2753044a38vboxsync print "\tret"
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print "ENDPROC gl%s" % func_name
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync print ""
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
e33247bff4fddfdba92538374bcc9e2753044a38vboxsyncGenerateEntrypoints()
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync
fe06619ae576367ff3568e6abd99fb8ad28cc73avboxsync