bonjour,
J'ai un petit soucis avec le syscall linux 2.6.27 sys_init_module, il me retourne -EFAULT et je n'ai pas réussi a trouver de doc consistante sur les syscalls linux et je galère... Si quelqu'un a une idée ou un lien, je suis preneur.
syscalls.h:
static inline KRESULT sys_init_module(void *umod, unsigned long len, const char *uargs)
{
KRESULT __res;
asm volatile ("int $0x80" : "=a" (__res)
: "0" (__NR_init_module), "b" (umod), "c" (len), "d" (uargs) : "memory");
return __res;
}
static inline void *sys_mmap2(void *addr, size_t length, unsigned int prot, unsigned int flags, int fd, off_t pgoffset)
{
unsigned long __res;
asm volatile ("int $0x80" : "=a" (__res)
: "0" (__NR_mmap2), "b" (addr), "c" (length), "d" (prot), "S" (flags), "D" (fd), "p" (pgoffset)
: "memory");
return (void*) __res;
}
mman.h:
#define PROT_READ 0x1 /* Page can be read. */
#define PROT_WRITE 0x2 /* Page can be written. */
#define PROT_EXEC 0x4 /* Page can be executed. */
#define MAP_PRIVATE 0x02 /* Changes are private. */
init.c:
int usb_insmod(char *modname, char *opts)
{
int fd;
void *modmap;
struct stat statbuf;
if (sys_stat(modname, &statbuf) || !S_ISREG(statbuf.st_mode))
{
print_f("%s introuvable.\n", modname);
return 0;
}
fd = sys_open(modname, O_RDONLY, 0);
if (!fd) {
print_f("echec ouverture %s.\n", modname);
return 0;
}
modmap = sys_mmap2(0, statbuf.st_size, (PROT_READ | PROT_WRITE | PROT_EXEC), MAP_PRIVATE, fd, 0);
sys_close(fd);
if (BADPTR(modmap)) {
print_f("echec mapping %s (%d).\n", modname, modmap);
return 0;
}
fd = sys_init_module(modmap, statbuf.st_size, opts);
if (fd) {
sys_munmap(modmap, statbuf.st_size);
print_f("echec initialisation %s (%d).\n", modname, fd);
return 0;
}
sys_munmap(modmap, statbuf.st_size);
return 1;
}
merci d'avance.