summaryrefslogtreecommitdiffstats
path: root/libc/tools/bionic_utils.py
diff options
context:
space:
mode:
authorRaghu Gandham <raghu@mips.com>2012-01-27 17:51:42 -0800
committerElliott Hughes <enh@google.com>2012-05-09 11:46:28 -0700
commit1fa0d849576555577ffd9675677a3c95f21b754e (patch)
tree20c015513cd03630c3fe81ddf9b36625c3b26310 /libc/tools/bionic_utils.py
parent7eb1cc23f8976a2062ba0cf92f030216a8e64e60 (diff)
downloadbionic-1fa0d849576555577ffd9675677a3c95f21b754e.zip
bionic-1fa0d849576555577ffd9675677a3c95f21b754e.tar.gz
bionic-1fa0d849576555577ffd9675677a3c95f21b754e.tar.bz2
[MIPS] Add support for MIPS syscalls
Change-Id: I4deba67e15c865c4c2db03064c04098a09828ea6 Signed-off-by: Raghu Gandham <raghu@mips.com> Signed-off-by: Chris Dearman <chris@mips.com>
Diffstat (limited to 'libc/tools/bionic_utils.py')
-rw-r--r--libc/tools/bionic_utils.py53
1 files changed, 36 insertions, 17 deletions
diff --git a/libc/tools/bionic_utils.py b/libc/tools/bionic_utils.py
index 0bc947b..abb7820 100644
--- a/libc/tools/bionic_utils.py
+++ b/libc/tools/bionic_utils.py
@@ -4,13 +4,13 @@ import sys, os, commands, string
# support Bionic architectures, add new ones as appropriate
#
-bionic_archs = [ "arm", "x86" ]
+bionic_archs = [ "arm", "x86", "mips" ]
# basic debugging trace support
# call D_setlevel to set the verbosity level
# and D(), D2(), D3(), D4() to add traces
#
-verbose = 1
+verbose = 0
def D(msg):
global verbose
@@ -178,7 +178,7 @@ class SysCallsTxtParser:
self.syscalls = []
self.lineno = 0
- def E(msg):
+ def E(self, msg):
print "%d: %s" % (self.lineno, msg)
def parse_line(self, line):
@@ -238,36 +238,55 @@ class SysCallsTxtParser:
number = line[pos_rparen+1:].strip()
if number == "stub":
- syscall_id = -1
- syscall_id2 = -1
+ syscall_common = -1
+ syscall_arm = -1
+ syscall_x86 = -1
+ syscall_mips = -1
else:
try:
if number[0] == '#':
number = number[1:].strip()
numbers = string.split(number,',')
- syscall_id = int(numbers[0])
- syscall_id2 = syscall_id
- if len(numbers) > 1:
- syscall_id2 = int(numbers[1])
+ if len(numbers) == 1:
+ syscall_common = int(numbers[0])
+ syscall_arm = -1
+ syscall_x86 = -1
+ syscall_mips = -1
+ else:
+ if len(numbers) == 3:
+ syscall_common = -1
+ syscall_arm = int(numbers[0])
+ syscall_x86 = int(numbers[1])
+ syscall_mips = int(numbers[2])
+ else:
+ E("invalid syscall number format in '%s'" % line)
+ return
except:
E("invalid syscall number in '%s'" % line)
return
- global verbose
+ global verbose
if verbose >= 2:
- if call_id < 0:
- print "%s: %d,%d" % (syscall_name, syscall_id, syscall_id2)
+ if call_id == -1:
+ if syscall_common == -1:
+ print "%s: %d,%d,%d" % (syscall_name, syscall_arm, syscall_x86, syscall_mips)
+ else:
+ print "%s: %d" % (syscall_name, syscall_common)
else:
- print "%s(%d): %d,%d" % (syscall_name, call_id, syscall_id, syscall_id2)
-
- t = { "id" : syscall_id,
- "id2" : syscall_id2,
+ if syscall_common == -1:
+ print "%s(%d): %d,%d,%d" % (syscall_name, call_id, syscall_arm, syscall_x86, syscall_mips)
+ else:
+ print "%s(%d): %d" % (syscall_name, call_id, syscall_common)
+
+ t = { "armid" : syscall_arm,
+ "x86id" : syscall_x86,
+ "mipsid" : syscall_mips,
+ "common" : syscall_common,
"cid" : call_id,
"name" : syscall_name,
"func" : syscall_func,
"params" : syscall_params,
"decl" : "%-15s %s (%s);" % (return_type, syscall_func, params) }
-
self.syscalls.append(t)
def parse_file(self, file_path):