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 | from __future__ import print_function
|
---|
8 | import sys
|
---|
9 |
|
---|
10 | import apiutil
|
---|
11 |
|
---|
12 |
|
---|
13 | def GenerateEntrypoints():
|
---|
14 |
|
---|
15 | apiutil.CopyrightC()
|
---|
16 |
|
---|
17 | print('#include "chromium.h"')
|
---|
18 | print('#include "stub.h"')
|
---|
19 | print('')
|
---|
20 | print('#define NAKED __declspec(naked)')
|
---|
21 | print('#define UNUSED(x) ((void)(x))')
|
---|
22 | print('')
|
---|
23 |
|
---|
24 |
|
---|
25 | # Get sorted list of dispatched functions.
|
---|
26 | # The order is very important - it must match cr_opcodes.h
|
---|
27 | # and spu_dispatch_table.h
|
---|
28 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
29 |
|
---|
30 | for index in range(len(keys)):
|
---|
31 | func_name = keys[index]
|
---|
32 | if apiutil.Category(func_name) == "Chromium":
|
---|
33 | continue
|
---|
34 | if apiutil.Category(func_name) == "VBox":
|
---|
35 | continue
|
---|
36 |
|
---|
37 | return_type = apiutil.ReturnType(func_name)
|
---|
38 | params = apiutil.Parameters(func_name)
|
---|
39 |
|
---|
40 | print("NAKED %s cr_gl%s( %s )" % (return_type, func_name,
|
---|
41 | apiutil.MakeDeclarationString( params )))
|
---|
42 | print("{")
|
---|
43 | print("\t__asm jmp [glim.%s]" % func_name)
|
---|
44 | for (name, type, vecSize) in params:
|
---|
45 | print("\tUNUSED( %s );" % name)
|
---|
46 | print("}")
|
---|
47 | print("")
|
---|
48 |
|
---|
49 | print('/*')
|
---|
50 | print('* Aliases')
|
---|
51 | print('*/')
|
---|
52 |
|
---|
53 | # Now loop over all the functions and take care of any aliases
|
---|
54 | allkeys = apiutil.GetAllFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
55 | for func_name in allkeys:
|
---|
56 | if "omit" in apiutil.ChromiumProps(func_name):
|
---|
57 | continue
|
---|
58 |
|
---|
59 | if func_name in keys:
|
---|
60 | # we already processed this function earlier
|
---|
61 | continue
|
---|
62 |
|
---|
63 | # alias is the function we're aliasing
|
---|
64 | alias = apiutil.Alias(func_name)
|
---|
65 | if alias:
|
---|
66 | return_type = apiutil.ReturnType(func_name)
|
---|
67 | params = apiutil.Parameters(func_name)
|
---|
68 | print("NAKED %s cr_gl%s( %s )" % (return_type, func_name,
|
---|
69 | apiutil.MakeDeclarationString( params )))
|
---|
70 | print("{")
|
---|
71 | print("\t__asm jmp [glim.%s]" % alias)
|
---|
72 | for (name, type, vecSize) in params:
|
---|
73 | print("\tUNUSED( %s );" % name)
|
---|
74 | print("}")
|
---|
75 | print("")
|
---|
76 |
|
---|
77 |
|
---|
78 | print('/*')
|
---|
79 | print('* No-op stubs')
|
---|
80 | print('*/')
|
---|
81 |
|
---|
82 | # Now generate no-op stub functions
|
---|
83 | for func_name in allkeys:
|
---|
84 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
85 | return_type = apiutil.ReturnType(func_name)
|
---|
86 | params = apiutil.Parameters(func_name)
|
---|
87 | print("NAKED %s cr_gl%s( %s )" % (return_type, func_name, apiutil.MakeDeclarationString(params)))
|
---|
88 | print("{")
|
---|
89 | if return_type != "void":
|
---|
90 | print("return (%s) 0" % return_type)
|
---|
91 | print("}")
|
---|
92 | print("")
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 |
|
---|
97 | GenerateEntrypoints()
|
---|
98 |
|
---|