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 | if apiutil.Category(func_name) == "VBox":
|
---|
34 | continue
|
---|
35 |
|
---|
36 | return_type = apiutil.ReturnType(func_name)
|
---|
37 | params = apiutil.Parameters(func_name)
|
---|
38 |
|
---|
39 | print "NAKED %s cr_gl%s( %s )" % (return_type, func_name,
|
---|
40 | apiutil.MakeDeclarationString( params ))
|
---|
41 | print "{"
|
---|
42 | print "\t__asm jmp [glim.%s]" % func_name
|
---|
43 | for (name, type, vecSize) in params:
|
---|
44 | print "\tUNUSED( %s );" % name
|
---|
45 | print "}"
|
---|
46 | print ""
|
---|
47 |
|
---|
48 | print '/*'
|
---|
49 | print '* Aliases'
|
---|
50 | print '*/'
|
---|
51 |
|
---|
52 | # Now loop over all the functions and take care of any aliases
|
---|
53 | allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
54 | for func_name in allkeys:
|
---|
55 | if "omit" in apiutil.ChromiumProps(func_name):
|
---|
56 | continue
|
---|
57 |
|
---|
58 | if func_name in keys:
|
---|
59 | # we already processed this function earlier
|
---|
60 | continue
|
---|
61 |
|
---|
62 | # alias is the function we're aliasing
|
---|
63 | alias = apiutil.Alias(func_name)
|
---|
64 | if alias:
|
---|
65 | return_type = apiutil.ReturnType(func_name)
|
---|
66 | params = apiutil.Parameters(func_name)
|
---|
67 | print "NAKED %s cr_gl%s( %s )" % (return_type, func_name,
|
---|
68 | apiutil.MakeDeclarationString( params ))
|
---|
69 | print "{"
|
---|
70 | print "\t__asm jmp [glim.%s]" % alias
|
---|
71 | for (name, type, vecSize) in params:
|
---|
72 | print "\tUNUSED( %s );" % name
|
---|
73 | print "}"
|
---|
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 | return_type = apiutil.ReturnType(func_name)
|
---|
85 | params = apiutil.Parameters(func_name)
|
---|
86 | print "NAKED %s cr_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params))
|
---|
87 | print "{"
|
---|
88 | if return_type != "void":
|
---|
89 | print "return (%s) 0" % return_type
|
---|
90 | print "}"
|
---|
91 | print ""
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | GenerateEntrypoints()
|
---|
97 |
|
---|