summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2014-04-15 09:36:36 +0100
committerPaul Moore <pmoore@redhat.com>2014-04-15 18:19:39 -0400
commit9b119de38267358f6e776e826adad0b1be58ed53 (patch)
tree3e4e62adcffa70f0ab065e0aa994b94dde292ad3 /src
parent87a826b20e9485f6de12404d347b69e98a4ab972 (diff)
downloadlibseccomp-9b119de38267358f6e776e826adad0b1be58ed53.tar.gz
arch: Add support for MIPS Little Endian
Add support for MIPS 32-bit (O32 ABI) Little Endian Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> Signed-off-by: Paul Moore <pmoore@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/arch-mips.c7
-rw-r--r--src/arch-mips.h2
-rw-r--r--src/arch.c10
3 files changed, 19 insertions, 0 deletions
diff --git a/src/arch-mips.c b/src/arch-mips.c
index af2d67e..7e88929 100644
--- a/src/arch-mips.c
+++ b/src/arch-mips.c
@@ -33,3 +33,10 @@ const struct arch_def arch_def_mips = {
.size = ARCH_SIZE_32,
.endian = ARCH_ENDIAN_BIG,
};
+
+const struct arch_def arch_def_mipsel = {
+ .token = SCMP_ARCH_MIPSEL,
+ .token_bpf = AUDIT_ARCH_MIPSEL,
+ .size = ARCH_SIZE_32,
+ .endian = ARCH_ENDIAN_LITTLE,
+};
diff --git a/src/arch-mips.h b/src/arch-mips.h
index ffae4e9..1258c26 100644
--- a/src/arch-mips.h
+++ b/src/arch-mips.h
@@ -31,8 +31,10 @@
#define mips_arg_count_max 6
extern const struct arch_def arch_def_mips;
+extern const struct arch_def arch_def_mipsel;
#define mips_arg_offset(x) (offsetof(struct seccomp_data, args[x]) + 4)
+#define mipsel_arg_offset(x) (offsetof(struct seccomp_data, args[x]))
int mips_syscall_resolve_name(const char *name);
const char *mips_syscall_resolve_num(int num);
diff --git a/src/arch.c b/src/arch.c
index 2ea5137..1b0a3ef 100644
--- a/src/arch.c
+++ b/src/arch.c
@@ -49,6 +49,8 @@ const struct arch_def *arch_def_native = &arch_def_x86_64;
const struct arch_def *arch_def_native = &arch_def_arm;
#elif __MIPSEB__
const struct arch_def *arch_def_native = &arch_def_mips;
+#elif __MIPSEL__
+const struct arch_def *arch_def_native = &arch_def_mipsel;
#else
#error the arch code needs to know about your machine type
#endif /* machine type guess */
@@ -68,6 +70,7 @@ int arch_valid(uint32_t arch)
case SCMP_ARCH_X32:
case SCMP_ARCH_ARM:
case SCMP_ARCH_MIPS:
+ case SCMP_ARCH_MIPSEL:
return 0;
}
@@ -94,6 +97,8 @@ const struct arch_def *arch_def_lookup(uint32_t token)
return &arch_def_arm;
case SCMP_ARCH_MIPS:
return &arch_def_mips;
+ case SCMP_ARCH_MIPSEL:
+ return &arch_def_mipsel;
}
return NULL;
@@ -119,6 +124,7 @@ int arch_arg_count_max(const struct arch_def *arch)
case SCMP_ARCH_ARM:
return arm_arg_count_max;
case SCMP_ARCH_MIPS:
+ case SCMP_ARCH_MIPSEL:
return mips_arg_count_max;
}
@@ -188,6 +194,8 @@ int arch_arg_offset(const struct arch_def *arch, unsigned int arg)
return arm_arg_offset(arg);
case SCMP_ARCH_MIPS:
return mips_arg_offset(arg);
+ case SCMP_ARCH_MIPSEL:
+ return mipsel_arg_offset(arg);
default:
return -EDOM;
}
@@ -215,6 +223,7 @@ int arch_syscall_resolve_name(const struct arch_def *arch, const char *name)
case SCMP_ARCH_ARM:
return arm_syscall_resolve_name(name);
case SCMP_ARCH_MIPS:
+ case SCMP_ARCH_MIPSEL:
return mips_syscall_resolve_name(name);
}
@@ -243,6 +252,7 @@ const char *arch_syscall_resolve_num(const struct arch_def *arch, int num)
case SCMP_ARCH_ARM:
return arm_syscall_resolve_num(num);
case SCMP_ARCH_MIPS:
+ case SCMP_ARCH_MIPSEL:
return mips_syscall_resolve_num(num);
}