#define __KERNEL__ #include #undef __KERNEL__ #include #include #include #include #include #include #include #include #include #include "constable.h" #include "linker.h" struct fcs_s { struct fcs_s *next; char *name; struct fctab_s *code; }; static struct fcs_s *fcs_tab = NULL; udata load_force_code(char *file) { struct fcs_s *p; for (p = fcs_tab; p != NULL; p = p->next) { if (p->name == file) return (udata) p; } if ((p = malloc(sizeof(struct fcs_s))) == NULL) return 0; if ((p->code = object_to_string(file)) == NULL) { free(p); return 0; } p->name = file; p->next = fcs_tab; fcs_tab = p; return (udata) p; } #include "dloader.c" udata force_do(struct med_s * m, udata fc, var_t * arg, int n) { int av[n], ac, l; struct fcs_s *p = (struct fcs_s *) fc; struct medusa_packet msg; if (p == NULL) return 0; ac = 0; while (n > 0) { if (arg->typ == VT_INT) av[ac++] = arg->d; arg++; n--; } l = sizeof(dloader) + p->code->total_len + ac * 4; { char buf[l]; memcpy(buf, dloader, sizeof(dloader)); memcpy(buf + sizeof(dloader), p->code, p->code->total_len); ((struct fctab_s *) (buf + sizeof(dloader)))->argc = (u32) ac; memcpy(buf + sizeof(dloader) + p->code->total_len, av, ac * 4); msg.cmd = MED_FORCE; msg.u.r_cmd.proc.pid = m->proc.pid; msg.data_len = l; med_cmd(&msg, buf); } return 1; } int force_init(void) { return 0; }