직접 만든 system call 호출의 리턴값이 항상 -1이 되는 이유....

terachul의 이미지

새로운 system call을 추가했습니다.

그리고 커널 컴파일까지 잘 됬고 확인까지 했습니다.

그런데 사용자 프로그램에 집어넣고 결과값을 보니 무조껀 -1이 반환되더군요 -_-;;

소스코드의 정보는 다음과 같습니다.

Kernel 버전 : 2.6.19

systemcall app: newcall.c
=========================
#include
#include
#include
#include
#include

asmlinkage int sys_newcall(int i, int j){
return i*j;
}

user app: test.c
=================
#include
#include
#include
#include

#define __NR_newcall 320

int main(){
int a, b, m;

printf("input two number :");
scanf("%d %d", &a, &b);

m = syscall(__NR_newcall, a, b);

printf("syscall multiply -> %d\n", m);

return 0;
}