linux_sysvec.c (1f7642e05899dbd6cf3b20cf1aeea48abec421b1) linux_sysvec.c (060e48824720626ae71cbff2328ec91f4aab1839)
1/*-
2 * Copyright (c) 1994-1996 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 79 unchanged lines hidden (view full) ---

88#define __LINUX_NPXCW__ 0x37f
89
90extern char linux_sigcode[];
91extern int linux_szsigcode;
92
93extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
94
95SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
1/*-
2 * Copyright (c) 1994-1996 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 79 unchanged lines hidden (view full) ---

88#define __LINUX_NPXCW__ 0x37f
89
90extern char linux_sigcode[];
91extern int linux_szsigcode;
92
93extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL];
94
95SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler);
96SET_DECLARE(linux_device_handler_set, struct linux_device_handler);
96
97static int linux_fixup(register_t **stack_base,
98 struct image_params *iparams);
99static int elf_linux_fixup(register_t **stack_base,
100 struct image_params *iparams);
101static void linux_prepsyscall(struct trapframe *tf, int *args, u_int *code,
102 caddr_t *params);
103static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);

--- 778 unchanged lines hidden (view full) ---

882 };
883
884static int
885linux_elf_modevent(module_t mod, int type, void *data)
886{
887 Elf32_Brandinfo **brandinfo;
888 int error;
889 struct linux_ioctl_handler **lihp;
97
98static int linux_fixup(register_t **stack_base,
99 struct image_params *iparams);
100static int elf_linux_fixup(register_t **stack_base,
101 struct image_params *iparams);
102static void linux_prepsyscall(struct trapframe *tf, int *args, u_int *code,
103 caddr_t *params);
104static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask);

--- 778 unchanged lines hidden (view full) ---

883 };
884
885static int
886linux_elf_modevent(module_t mod, int type, void *data)
887{
888 Elf32_Brandinfo **brandinfo;
889 int error;
890 struct linux_ioctl_handler **lihp;
891 struct linux_device_handler **ldhp;
890
891 error = 0;
892
893 switch(type) {
894 case MOD_LOAD:
895 for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
896 ++brandinfo)
897 if (elf32_insert_brand_entry(*brandinfo) < 0)
898 error = EINVAL;
899 if (error == 0) {
900 SET_FOREACH(lihp, linux_ioctl_handler_set)
901 linux_ioctl_register_handler(*lihp);
892
893 error = 0;
894
895 switch(type) {
896 case MOD_LOAD:
897 for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
898 ++brandinfo)
899 if (elf32_insert_brand_entry(*brandinfo) < 0)
900 error = EINVAL;
901 if (error == 0) {
902 SET_FOREACH(lihp, linux_ioctl_handler_set)
903 linux_ioctl_register_handler(*lihp);
904 SET_FOREACH(ldhp, linux_device_handler_set)
905 linux_device_register_handler(*ldhp);
902 if (bootverbose)
903 printf("Linux ELF exec handler installed\n");
904 } else
905 printf("cannot insert Linux ELF brand handler\n");
906 break;
907 case MOD_UNLOAD:
908 for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
909 ++brandinfo)
910 if (elf32_brand_inuse(*brandinfo))
911 error = EBUSY;
912 if (error == 0) {
913 for (brandinfo = &linux_brandlist[0];
914 *brandinfo != NULL; ++brandinfo)
915 if (elf32_remove_brand_entry(*brandinfo) < 0)
916 error = EINVAL;
917 }
918 if (error == 0) {
919 SET_FOREACH(lihp, linux_ioctl_handler_set)
920 linux_ioctl_unregister_handler(*lihp);
906 if (bootverbose)
907 printf("Linux ELF exec handler installed\n");
908 } else
909 printf("cannot insert Linux ELF brand handler\n");
910 break;
911 case MOD_UNLOAD:
912 for (brandinfo = &linux_brandlist[0]; *brandinfo != NULL;
913 ++brandinfo)
914 if (elf32_brand_inuse(*brandinfo))
915 error = EBUSY;
916 if (error == 0) {
917 for (brandinfo = &linux_brandlist[0];
918 *brandinfo != NULL; ++brandinfo)
919 if (elf32_remove_brand_entry(*brandinfo) < 0)
920 error = EINVAL;
921 }
922 if (error == 0) {
923 SET_FOREACH(lihp, linux_ioctl_handler_set)
924 linux_ioctl_unregister_handler(*lihp);
925 SET_FOREACH(ldhp, linux_device_handler_set)
926 linux_device_unregister_handler(*ldhp);
921 if (bootverbose)
922 printf("Linux ELF exec handler removed\n");
923 } else
924 printf("Could not deinstall ELF interpreter entry\n");
925 break;
926 default:
927 return EOPNOTSUPP;
928 }
929 return error;
930}
931
932static moduledata_t linux_elf_mod = {
933 "linuxelf",
934 linux_elf_modevent,
935 0
936};
937
938DECLARE_MODULE(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);
927 if (bootverbose)
928 printf("Linux ELF exec handler removed\n");
929 } else
930 printf("Could not deinstall ELF interpreter entry\n");
931 break;
932 default:
933 return EOPNOTSUPP;
934 }
935 return error;
936}
937
938static moduledata_t linux_elf_mod = {
939 "linuxelf",
940 linux_elf_modevent,
941 0
942};
943
944DECLARE_MODULE(linuxelf, linux_elf_mod, SI_SUB_EXEC, SI_ORDER_ANY);