Adding new System Call in Minix

有些话、适合烂在心里 提交于 2019-12-23 01:46:28

问题


I am trying to create a new system call in Minix 3.3. At first i just want to create simple printmsg() call that will write "Hello World" on screen.
I looked various tutorials on internet and still couldn't find out solution.

  • I defined my sys call number in callnr.h like this #define PM_PRINTMSG (PM BASE + 48) and i increased number of sys calls #define NR_PM_CALLS 49.

  • In table.c I added CALL(PM_PRINTMSG) = doprintmsg.

  • In proto.h I described function prototype `int do_printmsg(void);

  • Function implementation is written in misc.c. I added #include <stdio.h> and made Hello World function int do printmsg(){ printf("I am a system call"); return 0; }

When I test my system call in user program _syscall(PM_PROC_NR, PM_PRINTMSG, &m); I don't get any errors but no printf is displayed.

So, is it possible to printf messages from system calls since i had to add <stdio.h> myself in misc.c or i missed some steps. I forgot to mention that i go in /usr/src/releasetools and type make services and make install respectively to recompile kernel.


回答1:


I figured out what was the problem, so i will post answer if someone needs this in future. I did everything well in this example but i failed to compile kernel.
The location was correct which is usr/src/releasetools, but command needed is make hdboot. Also i figured out my PC somehow wasnt working well with this virtual machines and i had many errors while compiling even though i didn't change anything. When i switched to laptop everything worked fine.
My conclusion is sometimes there is just something wrong on your machine so you should try and test problems on different ones



来源:https://stackoverflow.com/questions/32508440/adding-new-system-call-in-minix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!