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