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 | print"""
|
---|
29 | %ifdef RT_ARCH_AMD64
|
---|
30 | %define PTR_PRE qword
|
---|
31 | %define PTR_CB 8
|
---|
32 | %else
|
---|
33 | %define PTR_PRE dword
|
---|
34 | %define PTR_CB 4
|
---|
35 | %endif
|
---|
36 | """
|
---|
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 "\tjmp \t[PTR_PRE glim + PTR_CB*%d]" % index
|
---|
47 | print "ENDPROC gl%s" % func_name
|
---|
48 | print ""
|
---|
49 |
|
---|
50 |
|
---|
51 | print ';'
|
---|
52 | print '; Aliases'
|
---|
53 | print ';'
|
---|
54 |
|
---|
55 | # Now loop over all the functions and take care of any aliases
|
---|
56 | allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
57 | for func_name in allkeys:
|
---|
58 | if "omit" in apiutil.ChromiumProps(func_name):
|
---|
59 | continue
|
---|
60 |
|
---|
61 | if func_name in keys:
|
---|
62 | # we already processed this function earlier
|
---|
63 | continue
|
---|
64 |
|
---|
65 | # alias is the function we're aliasing
|
---|
66 | alias = apiutil.Alias(func_name)
|
---|
67 | if alias:
|
---|
68 | # this dict lookup should never fail (raise an exception)!
|
---|
69 | index = keys.index(alias)
|
---|
70 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
71 | print "\tjmp \t[PTR_PRE glim + PTR_CB*%d]" % index
|
---|
72 | print "ENDPROC gl%s" % func_name
|
---|
73 | print ""
|
---|
74 |
|
---|
75 |
|
---|
76 | print ';'
|
---|
77 | print '; No-op stubs'
|
---|
78 | print ';'
|
---|
79 |
|
---|
80 | # Now generate no-op stub functions
|
---|
81 | for func_name in allkeys:
|
---|
82 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
83 | print "BEGINPROC_EXPORTED gl%s" % func_name
|
---|
84 | print "\tleave"
|
---|
85 | print "\tret"
|
---|
86 | print "ENDPROC gl%s" % func_name
|
---|
87 | print ""
|
---|
88 |
|
---|
89 |
|
---|
90 | GenerateEntrypoints()
|
---|
91 |
|
---|