From a492466dadbc0962ef1601e76738040ad6c118f0 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 27 Nov 2009 14:07:05 +0000 Subject: [PATCH] Created new private system header computed_asm_macros.h defining the macro we use for the asm_offsets.cpp file, so it can be reused elsewhere. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34311 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/system/computed_asm_macros.h | 13 +++++++++++++ src/system/kernel/arch/m68k/asm_offsets.cpp | 12 +++++++----- src/system/kernel/arch/x86/asm_offsets.cpp | 11 ++++++----- 3 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 headers/private/system/computed_asm_macros.h diff --git a/headers/private/system/computed_asm_macros.h b/headers/private/system/computed_asm_macros.h new file mode 100644 index 0000000000..46595abfe2 --- /dev/null +++ b/headers/private/system/computed_asm_macros.h @@ -0,0 +1,13 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _SYSTEM_COMPUTED_ASM_MACROS_H +#define _SYSTEM_COMPUTED_ASM_MACROS_H + + +#define DEFINE_COMPUTED_ASM_MACRO(macro, value) \ + asm volatile("#define " #macro " %0" : : "i" (value)) + + +#endif /* _SYSTEM_COMPUTED_ASM_MACROS_H */ diff --git a/src/system/kernel/arch/m68k/asm_offsets.cpp b/src/system/kernel/arch/m68k/asm_offsets.cpp index ec2ceabe25..4651bf4887 100644 --- a/src/system/kernel/arch/m68k/asm_offsets.cpp +++ b/src/system/kernel/arch/m68k/asm_offsets.cpp @@ -1,20 +1,22 @@ /* - * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2007-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ -// This file is used to get C structure offsets into assembler code. +// This file is used to get C structure offsets into assembly code. // The build system assembles the file and processes the output to create -// a header file with macro definitions, that can be included from assembler +// a header file with macro definitions, that can be included from assembly // code. + +#include + #include #include #include -#define DEFINE_MACRO(macro, value) \ - asm volatile("#define " #macro " %0" : : "i" (value)) +#define DEFINE_MACRO(macro, value) DEFINE_COMPUTED_ASM_MACRO(macro, value) #define DEFINE_OFFSET_MACRO(prefix, structure, member) \ DEFINE_MACRO(prefix##_##member, offsetof(struct structure, member)); diff --git a/src/system/kernel/arch/x86/asm_offsets.cpp b/src/system/kernel/arch/x86/asm_offsets.cpp index da2d6bf326..816c136344 100644 --- a/src/system/kernel/arch/x86/asm_offsets.cpp +++ b/src/system/kernel/arch/x86/asm_offsets.cpp @@ -1,22 +1,23 @@ /* - * Copyright 2007, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2007-2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ -// This file is used to get C structure offsets into assembler code. +// This file is used to get C structure offsets into assembly code. // The build system assembles the file and processes the output to create -// a header file with macro definitions, that can be included from assembler +// a header file with macro definitions, that can be included from assembly // code. +#include + #include #include #include #include -#define DEFINE_MACRO(macro, value) \ - asm volatile("#define " #macro " %0" : : "i" (value)) +#define DEFINE_MACRO(macro, value) DEFINE_COMPUTED_ASM_MACRO(macro, value) #define DEFINE_OFFSET_MACRO(prefix, structure, member) \ DEFINE_MACRO(prefix##_##member, offsetof(struct structure, member));