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 | print"""
|
---|
25 | %ifdef RT_ARCH_AMD64
|
---|
26 | %define PTR_PRE qword
|
---|
27 | %define PTR_CB 8
|
---|
28 | %else
|
---|
29 | %define PTR_PRE dword
|
---|
30 | %define PTR_CB 4
|
---|
31 | %endif
|
---|
32 | """
|
---|
33 |
|
---|
34 | # Get sorted list of dispatched functions.
|
---|
35 | # The order is very important - it must match cr_opcodes.h
|
---|
36 | # and spu_dispatch_table.h
|
---|
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 cr_gl%s" % func_name
|
---|
45 | print "%ifdef RT_ARCH_AMD64"
|
---|
46 | print "\tjmp \t[PTR_PRE glim + PTR_CB*%d]" % index
|
---|
47 | print "%else ; X86"
|
---|
48 | print "\tjmp \t[PTR_PRE _glim + PTR_CB*%d]" % index
|
---|
49 | print "%endif"
|
---|
50 | print "ENDPROC cr_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 cr_gl%s" % func_name
|
---|
74 | print "\tjmp \t[PTR_PRE glim + PTR_CB*%d]" % index
|
---|
75 | print "%else ; X86"
|
---|
76 | print "\tjmp \t[PTR_PRE _glim + PTR_CB*%d]" % index
|
---|
77 | print "%endif"
|
---|
78 | print "ENDPROC cr_gl%s" % func_name
|
---|
79 | print ""
|
---|
80 |
|
---|
81 |
|
---|
82 | print ';'
|
---|
83 | print '; No-op stubs'
|
---|
84 | print ';'
|
---|
85 |
|
---|
86 | # Now generate no-op stub functions
|
---|
87 | for func_name in allkeys:
|
---|
88 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
89 | print "BEGINPROC_EXPORTED cr_gl%s" % func_name
|
---|
90 | print "\tleave"
|
---|
91 | print "\tret"
|
---|
92 | print "ENDPROC cr_gl%s" % func_name
|
---|
93 | print ""
|
---|
94 |
|
---|
95 |
|
---|
96 | GenerateEntrypoints()
|
---|
97 |
|
---|