1 | """
|
---|
2 | Copyright (C) 2009-2016 Oracle Corporation
|
---|
3 |
|
---|
4 | This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
5 | available from http://www.virtualbox.org. This file is free software;
|
---|
6 | you can redistribute it and/or modify it under the terms of the GNU
|
---|
7 | General Public License (GPL) as published by the Free Software
|
---|
8 | Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
9 | VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
10 | hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
11 | """
|
---|
12 |
|
---|
13 | from __future__ import print_function
|
---|
14 | import sys
|
---|
15 |
|
---|
16 | import apiutil
|
---|
17 |
|
---|
18 |
|
---|
19 | def GenerateEntrypoints():
|
---|
20 |
|
---|
21 | #apiutil.CopyrightC()
|
---|
22 |
|
---|
23 | # Get sorted list of dispatched functions.
|
---|
24 | # The order is very important - it must match cr_opcodes.h
|
---|
25 | # and spu_dispatch_table.h
|
---|
26 | print('%include "iprt/asmdefs.mac"')
|
---|
27 | print("")
|
---|
28 | print("%ifdef RT_ARCH_AMD64")
|
---|
29 | print("extern glim")
|
---|
30 | print("%else ; X86")
|
---|
31 | print("extern glim")
|
---|
32 | print("%endif")
|
---|
33 | print("")
|
---|
34 |
|
---|
35 | keys = apiutil.GetDispatchedFunctions(sys.argv[1]+"/APIspec.txt")
|
---|
36 |
|
---|
37 | for index in range(len(keys)):
|
---|
38 | func_name = keys[index]
|
---|
39 | if apiutil.Category(func_name) == "Chromium":
|
---|
40 | continue
|
---|
41 | if apiutil.Category(func_name) == "VBox":
|
---|
42 | continue
|
---|
43 |
|
---|
44 | print("BEGINPROC_EXPORTED gl%s" % func_name)
|
---|
45 | print("%ifdef RT_ARCH_AMD64")
|
---|
46 | print("\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index))
|
---|
47 | print("%else ; X86")
|
---|
48 | print("\tjmp \t[glim+%d wrt ..gotpc]" % (4*index))
|
---|
49 | print("%endif")
|
---|
50 | print("ENDPROC 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 gl%s" % func_name)
|
---|
74 | print("%ifdef RT_ARCH_AMD64")
|
---|
75 | print("\tjmp \t[glim+%d wrt rip wrt ..gotpcrel]" % (8*index))
|
---|
76 | print("%else ; X86")
|
---|
77 | print("\tjmp \t[glim+%d wrt ..gotpc]" % (4*index))
|
---|
78 | print("%endif")
|
---|
79 | print("ENDPROC gl%s" % func_name)
|
---|
80 | print("")
|
---|
81 |
|
---|
82 |
|
---|
83 | print(';')
|
---|
84 | print('; No-op stubs')
|
---|
85 | print(';')
|
---|
86 |
|
---|
87 | # Now generate no-op stub functions
|
---|
88 | for func_name in allkeys:
|
---|
89 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
90 | print("BEGINPROC_EXPORTED gl%s" % func_name)
|
---|
91 | print("\tleave")
|
---|
92 | print("\tret")
|
---|
93 | print("ENDPROC gl%s" % func_name)
|
---|
94 | print("")
|
---|
95 |
|
---|
96 |
|
---|
97 | GenerateEntrypoints()
|
---|
98 |
|
---|