[15532] | 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 | print '%include "iprt/asmdefs.mac"'
|
---|
| 16 | print ""
|
---|
| 17 | print "%ifdef RT_ARCH_AMD64"
|
---|
| 18 | print "extern glim"
|
---|
| 19 | print "%else ; X86"
|
---|
| 20 | print "extern _glim"
|
---|
| 21 | print "%endif"
|
---|
| 22 | print ""
|
---|
| 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
|
---|
[30457] | 33 | if apiutil.Category(func_name) == "VBox":
|
---|
| 34 | continue
|
---|
[15532] | 35 |
|
---|
| 36 | print "BEGINPROC_EXPORTED cr_gl%s" % func_name
|
---|
| 37 | print "%ifdef RT_ARCH_AMD64"
|
---|
[18142] | 38 | print "\tmov \trax, qword glim+%d" % (8*index)
|
---|
| 39 | print "\tjmp \t[rax]"
|
---|
[15532] | 40 | print "%else ; X86"
|
---|
[18142] | 41 | print "\tmov \teax, dword _glim+%d" % (4*index)
|
---|
| 42 | print "\tjmp \t[eax]"
|
---|
[15532] | 43 | print "%endif"
|
---|
| 44 | print "ENDPROC cr_gl%s" % func_name
|
---|
| 45 | print ""
|
---|
| 46 |
|
---|
| 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 | # this dict lookup should never fail (raise an exception)!
|
---|
| 66 | index = keys.index(alias)
|
---|
| 67 | print "BEGINPROC_EXPORTED cr_gl%s" % func_name
|
---|
[18142] | 68 | print "%ifdef RT_ARCH_AMD64"
|
---|
| 69 | print "\tmov \trax, qword glim+%d" % (8*index)
|
---|
| 70 | print "\tjmp \t[rax]"
|
---|
[15532] | 71 | print "%else ; X86"
|
---|
[18142] | 72 | print "\tmov \teax, dword _glim+%d" % (4*index)
|
---|
| 73 | print "\tjmp \t[eax]"
|
---|
[15532] | 74 | print "%endif"
|
---|
| 75 | print "ENDPROC cr_gl%s" % func_name
|
---|
| 76 | print ""
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | print ';'
|
---|
| 80 | print '; No-op stubs'
|
---|
| 81 | print ';'
|
---|
| 82 |
|
---|
| 83 | # Now generate no-op stub functions
|
---|
| 84 | for func_name in allkeys:
|
---|
| 85 | if "stub" in apiutil.ChromiumProps(func_name):
|
---|
| 86 | print "BEGINPROC_EXPORTED cr_gl%s" % func_name
|
---|
| 87 | print "\tleave"
|
---|
| 88 | print "\tret"
|
---|
| 89 | print "ENDPROC cr_gl%s" % func_name
|
---|
| 90 | print ""
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | GenerateEntrypoints()
|
---|
| 94 |
|
---|