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 |
|
---|
17 | import sys
|
---|
18 |
|
---|
19 | import apiutil
|
---|
20 |
|
---|
21 |
|
---|
22 | def GenerateEntrypoints():
|
---|
23 |
|
---|
24 | #apiutil.CopyrightC()
|
---|
25 |
|
---|
26 | # Get sorted list of dispatched functions.
|
---|
27 | # The order is very important - it must match cr_opcodes.h
|
---|
28 | # and spu_dispatch_table.h
|
---|
29 | print '%include "iprt/asmdefs.mac"'
|
---|
30 | print ""
|
---|
31 | print "%ifdef RT_ARCH_AMD64"
|
---|
32 | print "extern glim"
|
---|
33 | print "%else ; X86"
|
---|
34 | print "extern glim"
|
---|
35 | print "%endif"
|
---|
36 | print ""
|
---|
37 |
|
---|
38 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
39 |
|
---|
40 | for index in range(len(keys)):
|
---|
41 | func_name = keys[index]
|
---|
42 | if apiutil.Category(func_name) == "Chromium":
|
---|
43 | continue
|
---|
44 |
|
---|
45 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
46 | print "%ifdef RT_ARCH_AMD64"
|
---|
47 | print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)
|
---|
48 | print "%else ; X86"
|
---|
49 | print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)
|
---|
50 | print "%endif"
|
---|
51 | print "ENDPROC gl%s" % func_name
|
---|
52 | print ""
|
---|
53 |
|
---|
54 |
|
---|
55 | print ';'
|
---|
56 | print '; Aliases'
|
---|
57 | print ';'
|
---|
58 |
|
---|
59 | # Now loop over all the functions and take care of any aliases
|
---|
60 | allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
61 | for func_name in allkeys:
|
---|
62 | if "omit" in apiutil.ChromiumProps(func_name):
|
---|
63 | continue
|
---|
64 |
|
---|
65 | if func_name in keys:
|
---|
66 | # we already processed this function earlier
|
---|
67 | continue
|
---|
68 |
|
---|
69 | # alias is the function we're aliasing
|
---|
70 | alias = apiutil.Alias(func_name)
|
---|
71 | if alias:
|
---|
72 | # this dict lookup should never fail (raise an exception)!
|
---|
73 | index = keys.index(alias)
|
---|
74 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
75 | print "%ifdef RT_ARCH_AMD64"
|
---|
76 | print "\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index)
|
---|
77 | print "%else ; X86"
|
---|
78 | print "\tjmp \t[glim+%d wrt ..gotpc]" % (4*index)
|
---|
79 | print "%endif"
|
---|
80 | print "ENDPROC gl%s" % func_name
|
---|
81 | print ""
|
---|
82 |
|
---|
83 |
|
---|
84 | print ';'
|
---|
85 | print '; No-op stubs'
|
---|
86 | print ';'
|
---|
87 |
|
---|
88 | # Now generate no-op stub functions
|
---|
89 | for func_name in allkeys:
|
---|
90 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
91 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
92 | print "\tleave"
|
---|
93 | print "\tret"
|
---|
94 | print "ENDPROC gl%s" % func_name
|
---|
95 | print ""
|
---|
96 |
|
---|
97 |
|
---|
98 | GenerateEntrypoints()
|
---|
99 |
|
---|