1 | #
|
---|
2 | # Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
3 | #
|
---|
4 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | # available from http://www.virtualbox.org. This file is free software;
|
---|
6 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | # General Public License (GPL) as published by the Free Software
|
---|
8 | # Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | # VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | # hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | #
|
---|
12 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
13 | # Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
14 | # additional information or have any questions.
|
---|
15 |
|
---|
16 | import sys
|
---|
17 |
|
---|
18 | import apiutil
|
---|
19 |
|
---|
20 |
|
---|
21 | def GenerateEntrypoints():
|
---|
22 |
|
---|
23 | #apiutil.CopyrightC()
|
---|
24 |
|
---|
25 | # Get sorted list of dispatched functions.
|
---|
26 | # The order is very important - it must match cr_opcodes.h
|
---|
27 | # and spu_dispatch_table.h
|
---|
28 | print '%include "iprt/asmdefs.mac"'
|
---|
29 | print ""
|
---|
30 | print "%ifdef RT_ARCH_AMD64"
|
---|
31 | print "extern glim"
|
---|
32 | print "%else ; X86"
|
---|
33 | print "extern glim"
|
---|
34 | print "%endif"
|
---|
35 | print ""
|
---|
36 |
|
---|
37 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
38 |
|
---|
39 | for index in range(len(keys)):
|
---|
40 | func_name = keys[index]
|
---|
41 | if apiutil.Category(func_name) == "Chromium":
|
---|
42 | continue
|
---|
43 |
|
---|
44 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
45 | print "%ifdef RT_ARCH_AMD64"
|
---|
46 | print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)
|
---|
47 | print "%else ; X86"
|
---|
48 | print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (4*index)
|
---|
49 | print "%endif"
|
---|
50 | print "ENDPROC gl%s" % func_name
|
---|
51 | print ""
|
---|
52 |
|
---|
53 |
|
---|
54 | print ';'
|
---|
55 | print '; Aliases'
|
---|
56 | print ';'
|
---|
57 |
|
---|
58 | # Now loop over all the functions and take care of any aliases
|
---|
59 | allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
60 | for func_name in allkeys:
|
---|
61 | if "omit" in apiutil.ChromiumProps(func_name):
|
---|
62 | continue
|
---|
63 |
|
---|
64 | if func_name in keys:
|
---|
65 | # we already processed this function earlier
|
---|
66 | continue
|
---|
67 |
|
---|
68 | # alias is the function we're aliasing
|
---|
69 | alias = apiutil.Alias(func_name)
|
---|
70 | if alias:
|
---|
71 | # this dict lookup should never fail (raise an exception)!
|
---|
72 | index = keys.index(alias)
|
---|
73 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
74 | print "%ifdef RT_ARCH_AMD64"
|
---|
75 | print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)
|
---|
76 | print "%else ; X86"
|
---|
77 | print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (4*index)
|
---|
78 | print "%endif"
|
---|
79 | print "ENDPROC gl%s" % func_name
|
---|
80 | print ""
|
---|
81 |
|
---|
82 |
|
---|
83 | print ';'
|
---|
84 | print '; No-op stubs'
|
---|
85 | print ';'
|
---|
86 |
|
---|
87 | # Now generate no-op stub functions
|
---|
88 | for func_name in allkeys:
|
---|
89 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
90 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
91 | print "\tleave"
|
---|
92 | print "\tret"
|
---|
93 | print "ENDPROC gl%s" % func_name
|
---|
94 | print ""
|
---|
95 |
|
---|
96 |
|
---|
97 | GenerateEntrypoints()
|
---|
98 |
|
---|