[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>
diff --git a/libc/tools/checksyscalls.py b/libc/tools/checksyscalls.py
index 2c563d7..286e727 100755
--- a/libc/tools/checksyscalls.py
+++ b/libc/tools/checksyscalls.py
@@ -70,10 +70,17 @@
re_nr_clock_line = re.compile( r"#define __NR_(\w*)\s*\(__NR_timer_create\+(\w*)\)" )
re_arm_nr_line = re.compile( r"#define __ARM_NR_(\w*)\s*\(__ARM_NR_BASE\+\s*(\w*)\)" )
re_x86_line = re.compile( r"#define __NR_(\w*)\s*([0-9]*)" )
+re_mips_line = re.compile( r"#define __NR_(\w*)\s*\(__NR_Linux\s*\+\s*([0-9]*)\)" )
# now read the Linux arm header
def process_nr_line(line,dict):
+ m = re_mips_line.match(line)
+ if m:
+ if dict["Linux"]==4000:
+ dict[m.group(1)] = int(m.group(2))
+ return
+
m = re_nr_line.match(line)
if m:
dict[m.group(1)] = int(m.group(2))
@@ -118,6 +125,7 @@
arm_dict = {}
x86_dict = {}
+mips_dict = {}
# remove trailing slash from the linux_root, if any
if linux_root[-1] == '/':
@@ -141,8 +149,15 @@
print "maybe using a different set of kernel headers might help."
sys.exit(1)
+mips_unistd = find_arch_header(linux_root, "mips", "unistd.h")
+if not mips_unistd:
+ print "WEIRD: Could not locate the Mips unistd.h kernel header file,"
+ print "maybe using a different set of kernel headers might help."
+ sys.exit(1)
+
process_header( arm_unistd, arm_dict )
process_header( x86_unistd, x86_dict )
+process_header( mips_unistd, mips_dict )
# now perform the comparison
errors = 0
@@ -154,18 +169,19 @@
sc_id = sc[idname]
if sc_id >= 0:
if not arch_dict.has_key(sc_name):
- print "%s syscall %s not defined, should be %d !!" % (archname, sc_name, sc_id)
+ print "error: %s syscall %s not defined, should be %d" % (archname, sc_name, sc_id)
errors += 1
elif not arch_dict.has_key(sc_name):
- print "%s syscall %s is not implemented!" % (archname, sc_name)
+ print "error: %s syscall %s is not implemented" % (archname, sc_name)
errors += 1
elif arch_dict[sc_name] != sc_id:
- print "%s syscall %s should be %d instead of %d !!" % (archname, sc_name, arch_dict[sc_name], sc_id)
+ print "error: %s syscall %s should be %d instead of %d" % (archname, sc_name, arch_dict[sc_name], sc_id)
errors += 1
return errors
-errors += check_syscalls("arm", "id", arm_dict)
-errors += check_syscalls("x86", "id2", x86_dict)
+errors += check_syscalls("arm", "armid", arm_dict)
+errors += check_syscalls("x86", "x86id", x86_dict)
+errors += check_syscalls("mips", "mipsid", mips_dict)
if errors == 0:
print "congratulations, everything's fine !!"