← Back to team overview

t-kernel-zh team mailing list archive

[Open T-Kernel] 删除汇编文件中的宏定义 _in_asm_source_

 

在原版的 T-Kernel 中,以在汇编文件开头部分定义一个

 #define _in_asm_source_

来标识目前是一个汇编文件。在 Open T-Kernel 为避免在
工程中存在大量的重复相同的定义,将这个宏定义移至顶
层的 Makefile,为了 Linux 内核代码移植方便,保留了
Linux 内核的汇编文件检查标志:

Makefile
 KBUILD_CFLAGS_KERNEL :=
 KBUILD_AFLAGS   := -D__ASSEMBLY__ -D_in_asm_source_
 KBUILD_AFLAGS_MODULE  := -DMODULE

目前工程中已经清除所有源文件中的宏,主要有两个补丁:

----8<---------------------------------------------

>From a416b63bc3cbec68bb4187e07b14f067294f05cd Mon Sep 17 00:00:00 2001
From: Du Huanpeng <u74147@xxxxxxxxx>
Date: Sat, 7 Jan 2017 16:43:33 +0800
Subject: [PATCH] Makefile: add _in_asm_source_ macro in top Makefile

Signed-off-by: Du Huanpeng <u74147@xxxxxxxxx>
---
 tkernel_source/Makefile.linux | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tkernel_source/Makefile.linux b/tkernel_source/Makefile.linux
index a73b1f6..d9b1ff4 100644
--- a/tkernel_source/Makefile.linux
+++ b/tkernel_source/Makefile.linux
@@ -445,7 +445,7 @@ KBUILD_CFLAGS   := -Wall -Wundef -Wno-strict-prototypes -Wno-trigraphs \
 
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=
-KBUILD_AFLAGS   := -D__ASSEMBLY__
+KBUILD_AFLAGS   := -D__ASSEMBLY__ -D_in_asm_source_
 KBUILD_AFLAGS_MODULE  := -DMODULE
 KBUILD_CFLAGS_MODULE  := -DMODULE
 KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
-- 
2.7.4

----8<---------------------------------------------
----8<---------------------------------------------

>From 9584ea485b4ee52cdc1ed0a0fee736714157fa5a Mon Sep 17 00:00:00 2001
From: Du Huanpeng <u74147@xxxxxxxxx>
Date: Sun, 8 Jan 2017 23:55:49 +0800
Subject: [PATCH] t-kernel: remove _in_asm_source_ define in source

Signed-off-by: Du Huanpeng <u74147@xxxxxxxxx>
---
 tkernel_source/lib/libtm/tm_command.S                 | 2 +-
 tkernel_source/lib/libtm/tm_exit.S                    | 2 +-
 tkernel_source/lib/libtm/tm_extsvc.S                  | 2 +-
 tkernel_source/lib/libtm/tm_getchar.S                 | 2 +-
 tkernel_source/lib/libtm/tm_getline.S                 | 2 +-
 tkernel_source/lib/libtm/tm_infodisk.S                | 2 +-
 tkernel_source/lib/libtm/tm_monitor.S                 | 2 +-
 tkernel_source/lib/libtm/tm_putchar.S                 | 2 +-
 tkernel_source/lib/libtm/tm_putstring.S               | 2 +-
 tkernel_source/lib/libtm/tm_readdisk.S                | 2 +-
 tkernel_source/lib/libtm/tm_writedisk.S               | 2 +-
 tkernel_source/sysdepend/arm/kernel/cpu/cpu_support.S | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tkernel_source/lib/libtm/tm_command.S b/tkernel_source/lib/libtm/tm_command.S
index c242dd9..85f5361 100644
--- a/tkernel_source/lib/libtm/tm_command.S
+++ b/tkernel_source/lib/libtm/tm_command.S
@@ -17,7 +17,7 @@
  *
  *	Execute monitor command
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_exit.S b/tkernel_source/lib/libtm/tm_exit.S
index 33c60e4..f07a6c3 100644
--- a/tkernel_source/lib/libtm/tm_exit.S
+++ b/tkernel_source/lib/libtm/tm_exit.S
@@ -17,7 +17,7 @@
  *
  *	System terminates
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_extsvc.S b/tkernel_source/lib/libtm/tm_extsvc.S
index 3e7705a..eb50da4 100644
--- a/tkernel_source/lib/libtm/tm_extsvc.S
+++ b/tkernel_source/lib/libtm/tm_extsvc.S
@@ -17,7 +17,7 @@
  *
  *	Extended service call
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_getchar.S b/tkernel_source/lib/libtm/tm_getchar.S
index 661991d..97d9313 100644
--- a/tkernel_source/lib/libtm/tm_getchar.S
+++ b/tkernel_source/lib/libtm/tm_getchar.S
@@ -17,7 +17,7 @@
  *
  *	Input single character from console
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_getline.S b/tkernel_source/lib/libtm/tm_getline.S
index 56feaa0..2377b90 100644
--- a/tkernel_source/lib/libtm/tm_getline.S
+++ b/tkernel_source/lib/libtm/tm_getline.S
@@ -17,7 +17,7 @@
  *
  *	Input single line from console
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_infodisk.S b/tkernel_source/lib/libtm/tm_infodisk.S
index f8c4d04..285cff4 100644
--- a/tkernel_source/lib/libtm/tm_infodisk.S
+++ b/tkernel_source/lib/libtm/tm_infodisk.S
@@ -17,7 +17,7 @@
  *
  *	Get disk information
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_monitor.S b/tkernel_source/lib/libtm/tm_monitor.S
index fc2669e..9a9bbea 100644
--- a/tkernel_source/lib/libtm/tm_monitor.S
+++ b/tkernel_source/lib/libtm/tm_monitor.S
@@ -17,7 +17,7 @@
  *
  *	Enter monitor
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_putchar.S b/tkernel_source/lib/libtm/tm_putchar.S
index 29deb45..3f279d8 100644
--- a/tkernel_source/lib/libtm/tm_putchar.S
+++ b/tkernel_source/lib/libtm/tm_putchar.S
@@ -17,7 +17,7 @@
  *
  *	Output single character to console
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_putstring.S b/tkernel_source/lib/libtm/tm_putstring.S
index cc3e377..2c1e623 100644
--- a/tkernel_source/lib/libtm/tm_putstring.S
+++ b/tkernel_source/lib/libtm/tm_putstring.S
@@ -17,7 +17,7 @@
  *
  *	Input single line from console
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_readdisk.S b/tkernel_source/lib/libtm/tm_readdisk.S
index 71fdca8..36e2534 100644
--- a/tkernel_source/lib/libtm/tm_readdisk.S
+++ b/tkernel_source/lib/libtm/tm_readdisk.S
@@ -17,7 +17,7 @@
  *
  *	Read from disk
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/lib/libtm/tm_writedisk.S b/tkernel_source/lib/libtm/tm_writedisk.S
index 7e4f454..d49d80b 100644
--- a/tkernel_source/lib/libtm/tm_writedisk.S
+++ b/tkernel_source/lib/libtm/tm_writedisk.S
@@ -17,7 +17,7 @@
  *
  *	Write to disk
  */
-#define	_in_asm_source_
+
 
 #include "tmon.h"
 
diff --git a/tkernel_source/sysdepend/arm/kernel/cpu/cpu_support.S b/tkernel_source/sysdepend/arm/kernel/cpu/cpu_support.S
index 52b5875..d9cb035 100644
--- a/tkernel_source/sysdepend/arm/kernel/cpu/cpu_support.S
+++ b/tkernel_source/sysdepend/arm/kernel/cpu/cpu_support.S
@@ -18,7 +18,7 @@
  *
  *	CPU operation specific to EM1-D512, etc.
  */
-#define	_in_asm_source_
+
 
 #include <machine.h>
 #include <tk/errno.h>
-- 
2.7.4

----8<---------------------------------------------

-- 
Copyright (c) 2017 duhuanpeng <u74147@xxxxxxxxx>