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