diff --git a/repos/base-hw/run/env b/repos/base-hw/run/env index ebfc90093..7e6e711fe 100644 --- a/repos/base-hw/run/env +++ b/repos/base-hw/run/env @@ -85,8 +85,6 @@ proc build_boot_image {binaries} { "\n /* core includes */" \ "\n.include \"macros.s\"" \ "\n" \ - "\n_common_constants" \ - "\n" \ "\n.section .data" \ "\n" \ "\n.p2align data_access_alignm_log2" \ diff --git a/repos/base-hw/src/core/arm/macros.s b/repos/base-hw/src/core/arm/macros.s index 2387ebf11..10b50df8d 100644 --- a/repos/base-hw/src/core/arm/macros.s +++ b/repos/base-hw/src/core/arm/macros.s @@ -13,11 +13,6 @@ .include "macros_arm.s" - -/******************* - ** Common macros ** - *******************/ - /** * Determine the top of the kernel stack of this processor and apply it as SP * @@ -36,82 +31,11 @@ .endm -/****************************************** - ** Macros regarding the mode transition ** - ******************************************/ +/*************************************************** + ** Constant values that are pretty commonly used ** + ***************************************************/ -/** - * Constant values that the mode transition uses - */ -.macro _mt_constants +/* alignment constraints */ +.set min_page_size_log2, 12 +.set data_access_alignm_log2, 2 - /* kernel names of exceptions that can interrupt a user */ - .set rst_type, 1 - .set und_type, 2 - .set svc_type, 3 - .set pab_type, 4 - .set dab_type, 5 - .set irq_type, 6 - .set fiq_type, 7 - - .set rst_pc_adjust, 0 - .set und_pc_adjust, 4 - .set svc_pc_adjust, 0 - .set pab_pc_adjust, 4 - .set dab_pc_adjust, 8 - .set irq_pc_adjust, 4 - .set fiq_pc_adjust, 4 - - /* offsets of the member variables in a processor context */ - .set r12_offset, 12 * 4 - .set sp_offset, 13 * 4 - .set lr_offset, 14 * 4 - .set pc_offset, 15 * 4 - .set psr_offset, 16 * 4 - .set exception_type_offset, 17 * 4 - .set contextidr_offset, 18 * 4 - .set section_table_offset, 19 * 4 - - /* size of local variables */ - .set context_ptr_size, 1 * 4 -.endm - -/** - * Constant values that are pretty commonly used - */ -.macro _common_constants - - /* alignment constraints */ - .set min_page_size_log2, 12 - .set data_access_alignm_log2, 2 -.endm - -/** - * Local data structures that the mode transition uses - */ -.macro _mt_local_variables - - /* space for a copy of the kernel context */ - .p2align 2 - .global _mt_master_context_begin - _mt_master_context_begin: - .space 32 * 4 - .global _mt_master_context_end - _mt_master_context_end: - - /* space for a client context-pointer per processor */ - .p2align 2 - .global _mt_client_context_ptr - _mt_client_context_ptr: - .rept PROCESSORS - .space context_ptr_size - .endr - - /* a globally mapped buffer per processor */ - .p2align 2 - .global _mt_buffer - _mt_buffer: - .rept PROCESSORS - .space buffer_size - .endr -.endm diff --git a/repos/base-hw/src/core/arm/mode_transition.s b/repos/base-hw/src/core/arm/mode_transition.s new file mode 100644 index 000000000..256c3864a --- /dev/null +++ b/repos/base-hw/src/core/arm/mode_transition.s @@ -0,0 +1,79 @@ +/* + * \brief Mode transition definitions used by all ARM architectures + * \author Stefan Kalkowski + * \date 2014-06-12 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +/*************************************************** + ** Constant values that the mode transition uses ** + ***************************************************/ + +/* kernel names of exceptions that can interrupt a user */ +.set rst_type, 1 +.set und_type, 2 +.set svc_type, 3 +.set pab_type, 4 +.set dab_type, 5 +.set irq_type, 6 +.set fiq_type, 7 + +.set rst_pc_adjust, 0 +.set und_pc_adjust, 4 +.set svc_pc_adjust, 0 +.set pab_pc_adjust, 4 +.set dab_pc_adjust, 8 +.set irq_pc_adjust, 4 +.set fiq_pc_adjust, 4 + +/* offsets of the member variables in a processor context */ +.set r12_offset, 12 * 4 +.set sp_offset, 13 * 4 +.set lr_offset, 14 * 4 +.set pc_offset, 15 * 4 +.set psr_offset, 16 * 4 +.set exception_type_offset, 17 * 4 +.set contextidr_offset, 18 * 4 +.set section_table_offset, 19 * 4 + +/* size of local variables */ +.set context_ptr_size, 1 * 4 + + +/********************************************************* + ** Local data structures that the mode transition uses ** + *********************************************************/ + +.macro _mt_local_variables + + /* space for a copy of the kernel context */ + .p2align 2 + .global _mt_master_context_begin + _mt_master_context_begin: + .space 32 * 4 + .global _mt_master_context_end + _mt_master_context_end: + + /* space for a client context-pointer per processor */ + .p2align 2 + .global _mt_client_context_ptr + _mt_client_context_ptr: + .rept PROCESSORS + .space context_ptr_size + .endr + + /* a globally mapped buffer per processor */ + .p2align 2 + .global _mt_buffer + _mt_buffer: + .rept PROCESSORS + .space buffer_size + .endr + +.endm /* _mt_local_variables */ diff --git a/repos/base-hw/src/core/arm_v6/mode_transition.s b/repos/base-hw/src/core/arm_v6/mode_transition.s index 4f3becae3..07ef3109b 100644 --- a/repos/base-hw/src/core/arm_v6/mode_transition.s +++ b/repos/base-hw/src/core/arm_v6/mode_transition.s @@ -11,6 +11,7 @@ * under the terms of the GNU General Public License version 2. */ +.include "arm/mode_transition.s" .include "macros.s" @@ -21,9 +22,6 @@ /* size of local variables */ .set buffer_size, 1 * 4 -/* common constants */ -_mt_constants - /************ ** Macros ** diff --git a/repos/base-hw/src/core/arm_v7/mode_transition.s b/repos/base-hw/src/core/arm_v7/mode_transition.s index db9cea9f7..49f7f77f9 100644 --- a/repos/base-hw/src/core/arm_v7/mode_transition.s +++ b/repos/base-hw/src/core/arm_v7/mode_transition.s @@ -12,6 +12,7 @@ * under the terms of the GNU General Public License version 2. */ +.include "arm/mode_transition.s" .include "macros.s" @@ -30,10 +31,6 @@ /* size of local variables */ .set buffer_size, 2 * 4 -/* common constants */ -_mt_constants -_common_constants - /************ ** Macros **