blob: e025e182b6e7425181d4c70355d7ed0ba1f84419 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
enum libsyscalls_error
libsyscalls_get_syscall(enum libsyscalls_os os, enum libsyscalls_arch arch, long long int syscallnr,
const struct libsyscalls_syscall **syscall_out)
{
const struct libsyscalls_syscall *syscalldesc;
static enum libsyscalls_error error;
long long int min, max;
error = libsyscalls_get_syscall_range(os, arch, &min, &max);
if (error)
return error;
if (syscallnr < min || syscallnr > max)
return LIBSYSCALLS_E_NOSUCHSYSCALL;
/* buffer access is validated by libsyscalls_get_syscall_range() */
syscalldesc = libsyscalls_syscalls_tables_[os][arch][syscallnr - min];
if (!syscalldesc)
return LIBSYSCALLS_E_NOSUCHSYSCALL;
if (syscall_out)
*syscall_out = syscalldesc;
return LIBSYSCALLS_E_OK;
}
|