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 | print '#include "chromium.h"'
|
---|
17 | print '#include "stub.h"'
|
---|
18 | print ''
|
---|
19 | print '#define NAKED __declspec(naked)'
|
---|
20 | print '#define UNUSED(x) ((void)(x))'
|
---|
21 | print ''
|
---|
22 |
|
---|
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 | return_type = apiutil.ReturnType(func_name)
|
---|
35 | params = apiutil.Parameters(func_name)
|
---|
36 |
|
---|
37 | print "NAKED %s cr_gl%s( %s )" % (return_type, func_name,
|
---|
38 | apiutil.MakeDeclarationString( params ))
|
---|
39 | print "{"
|
---|
40 | print "\t__asm jmp [glim.%s]" % func_name
|
---|
41 | for (name, type, vecSize) in params:
|
---|
42 | print "\tUNUSED( %s );" % name
|
---|
43 | print "}"
|
---|
44 | print ""
|
---|
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 | return_type = apiutil.ReturnType(func_name)
|
---|
64 | params = apiutil.Parameters(func_name)
|
---|
65 | print "NAKED %s cr_gl%s( %s )" % (return_type, func_name,
|
---|
66 | apiutil.MakeDeclarationString( params ))
|
---|
67 | print "{"
|
---|
68 | print "\t__asm jmp [glim.%s]" % alias
|
---|
69 | for (name, type, vecSize) in params:
|
---|
70 | print "\tUNUSED( %s );" % name
|
---|
71 | print "}"
|
---|
72 | print ""
|
---|
73 |
|
---|
74 |
|
---|
75 | print '/*'
|
---|
76 | print '* No-op stubs'
|
---|
77 | print '*/'
|
---|
78 |
|
---|
79 | # Now generate no-op stub functions
|
---|
80 | for func_name in allkeys:
|
---|
81 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
82 | return_type = apiutil.ReturnType(func_name)
|
---|
83 | params = apiutil.Parameters(func_name)
|
---|
84 | print "NAKED %s cr_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))
|
---|
85 | print "{"
|
---|
86 | if return_type != "void":
|
---|
87 | print "return (%s) 0" % return_type
|
---|
88 | print "}"
|
---|
89 | print ""
|
---|
90 |
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 | GenerateEntrypoints()
|
---|
95 |
|
---|