aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-04-05 07:33:10 +0000
committerEric Andersen <andersen@codepoet.org>2001-04-05 07:33:10 +0000
commit64c8b1762c269cd3d6d1bd58ba6cece39f4863cf (patch)
tree1b4ab2d9dd5c889953f911dc1e0ef0c478462b84
parentacc7757312fe1a7a69448047d1dbea2ef1c31cde (diff)
downloadbusybox-w32-64c8b1762c269cd3d6d1bd58ba6cece39f4863cf.tar.gz
busybox-w32-64c8b1762c269cd3d6d1bd58ba6cece39f4863cf.tar.bz2
busybox-w32-64c8b1762c269cd3d6d1bd58ba6cece39f4863cf.zip
Another iteration -- adjust the init_module syscall a bit.
-Erik
-rw-r--r--insmod.c14
-rw-r--r--libbb/module_syscalls.c44
-rw-r--r--modutils/insmod.c14
3 files changed, 29 insertions, 43 deletions
diff --git a/insmod.c b/insmod.c
index abd639c6b..f1798ad09 100644
--- a/insmod.c
+++ b/insmod.c
@@ -62,6 +62,12 @@
62#include <sys/utsname.h> 62#include <sys/utsname.h>
63#include "busybox.h" 63#include "busybox.h"
64 64
65#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
66# define new_sys_init_module init_module
67#else
68# define old_sys_init_module init_module
69#endif
70
65#if defined(__powerpc__) 71#if defined(__powerpc__)
66#define BB_USE_PLT_ENTRIES 72#define BB_USE_PLT_ENTRIES
67#define BB_PLT_ENTRY_SIZE 16 73#define BB_PLT_ENTRY_SIZE 16
@@ -117,7 +123,7 @@
117#ifndef MODUTILS_MODULE_H 123#ifndef MODUTILS_MODULE_H
118static const int MODUTILS_MODULE_H = 1; 124static const int MODUTILS_MODULE_H = 1;
119 125
120#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $" 126#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
121 127
122/* This file contains the structures used by the 2.0 and 2.1 kernels. 128/* This file contains the structures used by the 2.0 and 2.1 kernels.
123 We do not use the kernel headers directly because we do not wish 129 We do not use the kernel headers directly because we do not wish
@@ -267,7 +273,7 @@ static const int NEW_MOD_AUTOCLEAN = 4;
267static const int NEW_MOD_VISITED = 8; 273static const int NEW_MOD_VISITED = 8;
268static const int NEW_MOD_USED_ONCE = 16; 274static const int NEW_MOD_USED_ONCE = 16;
269 275
270int init_module(const char *name, const struct new_module *); 276int new_sys_init_module(const char *name, const struct new_module *);
271int query_module(const char *name, int which, void *buf, size_t bufsize, 277int query_module(const char *name, int which, void *buf, size_t bufsize,
272 size_t *ret); 278 size_t *ret);
273 279
@@ -323,7 +329,7 @@ int delete_module(const char *);
323#ifndef MODUTILS_OBJ_H 329#ifndef MODUTILS_OBJ_H
324static const int MODUTILS_OBJ_H = 1; 330static const int MODUTILS_OBJ_H = 1;
325 331
326#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $" 332#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
327 333
328/* The relocatable object is manipulated using elfin types. */ 334/* The relocatable object is manipulated using elfin types. */
329 335
@@ -2515,7 +2521,7 @@ new_init_module(const char *m_name, struct obj_file *f,
2515 image = xmalloc(m_size); 2521 image = xmalloc(m_size);
2516 obj_create_image(f, image); 2522 obj_create_image(f, image);
2517 2523
2518 ret = init_module(m_name, (struct new_module *) image); 2524 ret = new_sys_init_module(m_name, (struct new_module *) image);
2519 if (ret) 2525 if (ret)
2520 perror_msg("init_module: %s", m_name); 2526 perror_msg("init_module: %s", m_name);
2521 2527
diff --git a/libbb/module_syscalls.c b/libbb/module_syscalls.c
index 87662ff21..3a06b21a0 100644
--- a/libbb/module_syscalls.c
+++ b/libbb/module_syscalls.c
@@ -32,43 +32,17 @@
32#include "libbb.h" 32#include "libbb.h"
33 33
34 34
35struct old_module_ref
36{
37 unsigned long module; /* kernel addresses */
38 unsigned long next;
39};
40
41struct old_module_symbol
42{
43 unsigned long addr;
44 unsigned long name;
45};
46
47struct old_symbol_table
48{
49 int size; /* total, including string table!!! */
50 int n_symbols;
51 int n_refs;
52 struct old_module_symbol symbol[0]; /* actual size defined by n_symbols */
53 struct old_module_ref ref[0]; /* actual size defined by n_refs */
54};
55
56struct old_mod_routines
57{
58 unsigned long init;
59 unsigned long cleanup;
60};
61
62#define __NR_old_sys_init_module __NR_init_module
63_syscall5(int, old_sys_init_module, const char *, name, char *, code,
64 unsigned, codesize, struct old_mod_routines *, routines,
65 struct old_symbol_table *, symtab);
66
67#if __GNU_LIBRARY__ < 5 35#if __GNU_LIBRARY__ < 5
68/* These syscalls are not included as part of libc5 */ 36/* These syscalls are not included as part of libc5 */
69_syscall1(int, delete_module, const char *, name); 37_syscall1(int, delete_module, const char *, name);
70_syscall1(int, get_kernel_syms, struct old_kernel_sym *, ks); 38_syscall1(int, get_kernel_syms, struct old_kernel_sym *, ks);
71 39
40/* This may have 5 arguments (for old 2.0 kernels) or 2 arguments
41 * (for 2.2 and 2.4 kernels). Use the greatest common denominator,
42 * and let the kernel cope with whatever it gets. Its good at that. */
43_syscall5(int, init_module, void *, first, void *, second, void *, third,
44 void *, fourth, void *, fifth);
45
72#ifndef __NR_query_module 46#ifndef __NR_query_module
73#warning This kernel does not support the query_module syscall 47#warning This kernel does not support the query_module syscall
74#warning -> The query_module system call is being stubbed out... 48#warning -> The query_module system call is being stubbed out...
@@ -85,11 +59,11 @@ _syscall5(int, query_module, const char *, name, int, which,
85#endif 59#endif
86 60
87/* Jump through hoops to fixup error return codes */ 61/* Jump through hoops to fixup error return codes */
88#define __NR__create_module __NR_create_module 62#define __NR___create_module __NR_create_module
89static inline _syscall2(long, _create_module, const char *, name, size_t, size) 63static inline _syscall2(long, __create_module, const char *, name, size_t, size)
90unsigned long create_module(const char *name, size_t size) 64unsigned long create_module(const char *name, size_t size)
91{ 65{
92 long ret = _create_module(name, size); 66 long ret = __create_module(name, size);
93 67
94 if (ret == -1 && errno > 125) { 68 if (ret == -1 && errno > 125) {
95 ret = -errno; 69 ret = -errno;
diff --git a/modutils/insmod.c b/modutils/insmod.c
index abd639c6b..f1798ad09 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -62,6 +62,12 @@
62#include <sys/utsname.h> 62#include <sys/utsname.h>
63#include "busybox.h" 63#include "busybox.h"
64 64
65#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
66# define new_sys_init_module init_module
67#else
68# define old_sys_init_module init_module
69#endif
70
65#if defined(__powerpc__) 71#if defined(__powerpc__)
66#define BB_USE_PLT_ENTRIES 72#define BB_USE_PLT_ENTRIES
67#define BB_PLT_ENTRY_SIZE 16 73#define BB_PLT_ENTRY_SIZE 16
@@ -117,7 +123,7 @@
117#ifndef MODUTILS_MODULE_H 123#ifndef MODUTILS_MODULE_H
118static const int MODUTILS_MODULE_H = 1; 124static const int MODUTILS_MODULE_H = 1;
119 125
120#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $" 126#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
121 127
122/* This file contains the structures used by the 2.0 and 2.1 kernels. 128/* This file contains the structures used by the 2.0 and 2.1 kernels.
123 We do not use the kernel headers directly because we do not wish 129 We do not use the kernel headers directly because we do not wish
@@ -267,7 +273,7 @@ static const int NEW_MOD_AUTOCLEAN = 4;
267static const int NEW_MOD_VISITED = 8; 273static const int NEW_MOD_VISITED = 8;
268static const int NEW_MOD_USED_ONCE = 16; 274static const int NEW_MOD_USED_ONCE = 16;
269 275
270int init_module(const char *name, const struct new_module *); 276int new_sys_init_module(const char *name, const struct new_module *);
271int query_module(const char *name, int which, void *buf, size_t bufsize, 277int query_module(const char *name, int which, void *buf, size_t bufsize,
272 size_t *ret); 278 size_t *ret);
273 279
@@ -323,7 +329,7 @@ int delete_module(const char *);
323#ifndef MODUTILS_OBJ_H 329#ifndef MODUTILS_OBJ_H
324static const int MODUTILS_OBJ_H = 1; 330static const int MODUTILS_OBJ_H = 1;
325 331
326#ident "$Id: insmod.c,v 1.56 2001/04/05 06:24:27 andersen Exp $" 332#ident "$Id: insmod.c,v 1.57 2001/04/05 07:33:10 andersen Exp $"
327 333
328/* The relocatable object is manipulated using elfin types. */ 334/* The relocatable object is manipulated using elfin types. */
329 335
@@ -2515,7 +2521,7 @@ new_init_module(const char *m_name, struct obj_file *f,
2515 image = xmalloc(m_size); 2521 image = xmalloc(m_size);
2516 obj_create_image(f, image); 2522 obj_create_image(f, image);
2517 2523
2518 ret = init_module(m_name, (struct new_module *) image); 2524 ret = new_sys_init_module(m_name, (struct new_module *) image);
2519 if (ret) 2525 if (ret)
2520 perror_msg("init_module: %s", m_name); 2526 perror_msg("init_module: %s", m_name);
2521 2527