Hello everyone. I am trying to make a new kernel call in minix, which will get an integer as input and return the mux of this integer * 4260.
I have made the nessecary additions (according to other existing kernel calls) in:
Makefile (cd /usr/src/kernel/system)
com.h (cd /usr/src/include/minix)
system.h and system.c (cd /usr/src/kernel)
Now, I have also created two .c files
The following one, do_mux.c is in /usr/src/kernel/system:
Code:
Code:
#if USE_MUX
PUBLIC int do_mux(m_ptr)
message *m_ptr;
{
int num;
num = m_ptr->m1_i1; /* num takes the value of m1_i1 of passed message structure */
/* in which m_ptr points to */
return num * 4260; /* return the mux of given number x AM number */
}
#endif /* USE_MUX */
and this one, 3.c is in /usr/src/kernel
Code:
Code:
#include <lib.h>
#include <minix/com.h>
#include <stdio.h>
#include <stdlib.h>
#include <minix/syslib.h>
int my_mux(int num)
{
message m; /* creates the message structure which will pass to kernel call do_mux */
m.m1_i1 = num; /* stores the value of num into an integer member of message structure m */
/* in order to pass its value into the kernel call */
return (_taskcall(SYSTASK, SYS_MUX, &m)); /* invokes do_mux kernel call */
}
int main(int argc, char *argv[2])
{
int number = atoi(argv[1]); /* converts the second argument passed into its integer representation */
printf("\n%d*4260 = %d\n", number, my_mux(number)); /* prints the mux of the given number x 4260 calculated by the kernel call do_mux */
return 0; /* terminates */
}
The thing was, after saying 'make hdboot' (for the changes to work), and rebooting minix, to run
3.c and get for example, if I run it with 1 as input,
1x4260=4260
Instead, with whatever input i run it, it prints =-104.
I know that -104 means CALL DENIED, but I really dont know how to fix this...
Any ideas? sorry for the extra large post