1. System Call 정의 <linux-nova/dedup/dedup.c>
#include<linux/kernel.h>
#include<linux/syscalls.h>
SYSCALL_DEFINE0(dedup){
printk("dedup\n");
return 0;
}
2. Makefile for system Call <linux-nova/dedup/Makefile>
obj-y := dedup.o
3. Makefile for "linux-nova" <linux-nova/Makefile>
...
core-y += kernel/ certs/ nm/ fs/ ipc/ security/ crypto/ block/ dedup/
4. System call header file <linux-nova/include/linux/syscalls.h>
...
asmlinkage long sys_dedup(void);
#endif
5. System call table <linux-nova/arch/x86/entry/syscalls/syscall_64.tbl>
...
333 common io_pgetevents __x64_sys_io_pgetevents
334 common rseq __x64_sys_rseq
335 common dedup __x64_sys_dedup
...
after 'make' it will be added to <linux-nova/arch/x86/include/genereated/asm/syscalls_64.h>
6. Rebuild Kerenel
7. Test system call
#include <stdio.h>
#include <linux/kernel.h>
#include <sys/syscall.h>
#include <unistd.h>
int main() {
long int temp = syscall(335);
if(! temp){
printf("System Call well Implemented! Returned: % ld\n", temp);
}
else {
printf("Fail...\n");
}
return 0;
}
8. Result
'DeNOVA Test' 카테고리의 다른 글
6. Radix Tree추가해보기 2부 (실제 코딩) (0) | 2021.07.20 |
---|---|
5. Radix Tree추가해보기 1부 (Free list로 탐색) (0) | 2021.07.20 |
4. Module 수정 + test (0) | 2021.07.17 |
2. NOVA fs mounting (0) | 2021.07.17 |
1. NOVA Vanilla Code Build (0) | 2021.07.16 |