[PATCH 3/3] c6x: generate uapi and kapi headers

From: Firoz Khan
Date: Mon Jan 07 2019 - 09:53:43 EST


Unified system call table generation script need to be invoked
to generated the uapi and kapi headers. The Makefile changes
present in this patch will invoke the scripts and generate uapi
and kapi header files.

The generated files - unistd_*.h and syscall_table_*.h files
will be included by unistd.h and sys_c6x.c files by replacing
asm-generic/unistd.h file.

Signed-off-by: Firoz Khan <firoz.khan@xxxxxxxxxx>
---
arch/c6x/Makefile | 3 +++
arch/c6x/include/asm/Kbuild | 1 +
arch/c6x/include/uapi/asm/Kbuild | 1 +
arch/c6x/include/uapi/asm/unistd.h | 14 +++++++++-----
arch/c6x/kernel/sys_c6x.c | 3 ++-
5 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/arch/c6x/Makefile b/arch/c6x/Makefile
index b7aa854..acc9c91 100644
--- a/arch/c6x/Makefile
+++ b/arch/c6x/Makefile
@@ -53,6 +53,9 @@ dtbImage.%: vmlinux
archclean:
$(Q)$(MAKE) $(clean)=$(boot)

+archheaders:
+ $(Q)$(MAKE) $(build)=arch/c6x/kernel/syscalls all
+
define archhelp
@echo ' vmlinux.bin - Binary kernel image (arch/$(ARCH)/boot/vmlinux.bin)'
@echo ' dtbImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in'
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index 33a2c94..3d551e6 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -1,3 +1,4 @@
+generated-y += syscall_table.h
generic-y += atomic.h
generic-y += barrier.h
generic-y += bugs.h
diff --git a/arch/c6x/include/uapi/asm/Kbuild b/arch/c6x/include/uapi/asm/Kbuild
index 6c6f630..28823e3 100644
--- a/arch/c6x/include/uapi/asm/Kbuild
+++ b/arch/c6x/include/uapi/asm/Kbuild
@@ -1,5 +1,6 @@
include include/uapi/asm-generic/Kbuild.asm

+generated-y += unistd_32.h
generic-y += kvm_para.h
generic-y += shmparam.h
generic-y += ucontext.h
diff --git a/arch/c6x/include/uapi/asm/unistd.h b/arch/c6x/include/uapi/asm/unistd.h
index 9e9ffe5..4633005 100644
--- a/arch/c6x/include/uapi/asm/unistd.h
+++ b/arch/c6x/include/uapi/asm/unistd.h
@@ -20,9 +20,13 @@
#define __ARCH_WANT_SYS_CLONE
#define __ARCH_NOMMU

-/* Use the standard ABI for syscalls. */
-#include <asm-generic/unistd.h>
+#include <asm/bitsperlong.h>

-/* C6X-specific syscalls. */
-#define __NR_cache_sync (__NR_arch_specific_syscall + 0)
-__SYSCALL(__NR_cache_sync, sys_cache_sync)
+#ifndef __SYSCALL
+#define __SYSCALL(x, y)
+#endif
+
+#if __BITS_PER_LONG == 32
+#define __NR_cache_sync __NR_arch_specific_syscall0
+#include <asm/unistd_32.h>
+#endif
diff --git a/arch/c6x/kernel/sys_c6x.c b/arch/c6x/kernel/sys_c6x.c
index a742ae25..3e4b4e4 100644
--- a/arch/c6x/kernel/sys_c6x.c
+++ b/arch/c6x/kernel/sys_c6x.c
@@ -70,5 +70,6 @@ asmlinkage int sys_cache_sync(unsigned long s, unsigned long e)
*/
void *sys_call_table[__NR_syscalls] = {
[0 ... __NR_syscalls-1] = sys_ni_syscall,
-#include <asm/unistd.h>
+#define sys_arch_specific_syscall0 sys_cache_sync
+#include <asm/syscall_table.h>
};
--
1.9.1