mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-19 19:26:29 +00:00
hw: let assembler constants be upper-case (Ref #1180)
This commit is contained in:
parent
00ee2b565a
commit
031cabf862
@ -87,7 +87,7 @@ proc build_boot_image {binaries} {
|
||||
"\n" \
|
||||
"\n.section .data" \
|
||||
"\n" \
|
||||
"\n.p2align data_access_alignm_log2" \
|
||||
"\n.p2align DATA_ACCESS_ALIGNM_LOG2" \
|
||||
"\n.global _boot_modules_headers_begin" \
|
||||
"\n_boot_modules_headers_begin:" > $boot_modules
|
||||
|
||||
@ -113,7 +113,7 @@ proc build_boot_image {binaries} {
|
||||
foreach binary $binaries {
|
||||
if {$binary == "core"} { continue }
|
||||
exec echo -e \
|
||||
"\n.p2align data_access_alignm_log2" \
|
||||
"\n.p2align DATA_ACCESS_ALIGNM_LOG2" \
|
||||
"\n_boot_module_${i}_name:" \
|
||||
"\n.string \"${binary}\"" \
|
||||
"\n.byte 0" >> $boot_modules
|
||||
@ -131,7 +131,7 @@ proc build_boot_image {binaries} {
|
||||
foreach binary $binaries {
|
||||
if {$binary == "core"} { continue }
|
||||
exec echo -e \
|
||||
"\n.p2align min_page_size_log2" \
|
||||
"\n.p2align MIN_PAGE_SIZE_LOG2" \
|
||||
"\n_boot_module_${i}_begin:" \
|
||||
"\n.incbin \"[run_dir]/genode/${binary}\"" \
|
||||
"\n_boot_module_${i}_end:" >> $boot_modules
|
||||
|
@ -36,6 +36,6 @@
|
||||
***************************************************/
|
||||
|
||||
/* alignment constraints */
|
||||
.set min_page_size_log2, 12
|
||||
.set data_access_alignm_log2, 2
|
||||
.set MIN_PAGE_SIZE_LOG2, 12
|
||||
.set DATA_ACCESS_ALIGNM_LOG2, 2
|
||||
|
||||
|
@ -16,34 +16,34 @@
|
||||
***************************************************/
|
||||
|
||||
/* 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_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
|
||||
.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
|
||||
.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
|
||||
.set CONTEXT_PTR_SIZE, 1 * 4
|
||||
|
||||
|
||||
/*********************************************************
|
||||
@ -65,7 +65,7 @@
|
||||
.global _mt_client_context_ptr
|
||||
_mt_client_context_ptr:
|
||||
.rept PROCESSORS
|
||||
.space context_ptr_size
|
||||
.space CONTEXT_PTR_SIZE
|
||||
.endr
|
||||
|
||||
/* a globally mapped buffer per processor */
|
||||
@ -73,7 +73,7 @@
|
||||
.global _mt_buffer
|
||||
_mt_buffer:
|
||||
.rept PROCESSORS
|
||||
.space buffer_size
|
||||
.space BUFFER_SIZE
|
||||
.endr
|
||||
|
||||
.endm /* _mt_local_variables */
|
||||
|
@ -20,7 +20,7 @@
|
||||
***************/
|
||||
|
||||
/* size of local variables */
|
||||
.set buffer_size, 1 * 4
|
||||
.set BUFFER_SIZE, 1 * 4
|
||||
|
||||
|
||||
/************
|
||||
@ -63,13 +63,13 @@
|
||||
|
||||
/* load kernel cidr */
|
||||
adr sp, _mt_master_context_begin
|
||||
ldr sp, [sp, #contextidr_offset]
|
||||
ldr sp, [sp, #CONTEXTIDR_OFFSET]
|
||||
mcr p15, 0, sp, c13, c0, 1
|
||||
_flush_branch_predictor
|
||||
|
||||
/* load kernel section table */
|
||||
adr sp, _mt_master_context_begin
|
||||
ldr sp, [sp, #section_table_offset]
|
||||
ldr sp, [sp, #SECTION_TABLE_OFFSET]
|
||||
mcr p15, 0, sp, c2, c0, 0
|
||||
_flush_branch_predictor
|
||||
|
||||
@ -88,22 +88,22 @@
|
||||
stmia sp, {r0-r12}^
|
||||
|
||||
/* save user lr and sp */
|
||||
add r0, sp, #sp_offset
|
||||
add r0, sp, #SP_OFFSET
|
||||
stmia r0, {sp,lr}^
|
||||
|
||||
/* adjust and save user pc */
|
||||
.if \pc_adjust != 0
|
||||
sub lr, lr, #\pc_adjust
|
||||
.endif
|
||||
str lr, [sp, #pc_offset]
|
||||
str lr, [sp, #PC_OFFSET]
|
||||
|
||||
/* save user psr */
|
||||
mrs r0, spsr
|
||||
str r0, [sp, #psr_offset]
|
||||
str r0, [sp, #PSR_OFFSET]
|
||||
|
||||
/* save type of exception that interrupted the user */
|
||||
mov r0, #\exception_type
|
||||
str r0, [sp, #exception_type_offset]
|
||||
str r0, [sp, #EXCEPTION_TYPE_OFFSET]
|
||||
|
||||
/*
|
||||
* Switch to supervisor mode
|
||||
@ -118,7 +118,7 @@
|
||||
adr r0, _mt_master_context_begin
|
||||
|
||||
/* load kernel context */
|
||||
add r0, r0, #sp_offset
|
||||
add r0, r0, #SP_OFFSET
|
||||
ldm r0, {sp, lr, pc}
|
||||
|
||||
.endm
|
||||
@ -139,7 +139,7 @@
|
||||
* To enable such switching, the kernel context must be stored within this
|
||||
* region, thus one should map it solely accessable for privileged modes.
|
||||
*/
|
||||
.p2align min_page_size_log2
|
||||
.p2align MIN_PAGE_SIZE_LOG2
|
||||
.global _mt_begin
|
||||
_mt_begin:
|
||||
|
||||
@ -160,8 +160,8 @@
|
||||
b _fiq_entry /* 0x1c: fast interrupt request */
|
||||
|
||||
/* PICs that switch from a user exception to the kernel */
|
||||
_rst_entry: _user_to_kernel_pic rst_type, rst_pc_adjust
|
||||
_und_entry: _user_to_kernel_pic und_type, und_pc_adjust
|
||||
_rst_entry: _user_to_kernel_pic RST_TYPE, RST_PC_ADJUST
|
||||
_und_entry: _user_to_kernel_pic UND_TYPE, UND_PC_ADJUST
|
||||
_swi_entry:
|
||||
|
||||
/*
|
||||
@ -179,12 +179,12 @@
|
||||
/*movs pc, r14*/
|
||||
|
||||
/* slow high level service routine */
|
||||
_slow_swi_entry: _user_to_kernel_pic svc_type, svc_pc_adjust
|
||||
_slow_swi_entry: _user_to_kernel_pic SVC_TYPE, SVC_PC_ADJUST
|
||||
|
||||
_pab_entry: _user_to_kernel_pic pab_type, pab_pc_adjust
|
||||
_dab_entry: _user_to_kernel_pic dab_type, dab_pc_adjust
|
||||
_irq_entry: _user_to_kernel_pic irq_type, irq_pc_adjust
|
||||
_fiq_entry: _user_to_kernel_pic fiq_type, fiq_pc_adjust
|
||||
_pab_entry: _user_to_kernel_pic PAB_TYPE, PAB_PC_ADJUST
|
||||
_dab_entry: _user_to_kernel_pic DAB_TYPE, DAB_PC_ADJUST
|
||||
_irq_entry: _user_to_kernel_pic IRQ_TYPE, IRQ_PC_ADJUST
|
||||
_fiq_entry: _user_to_kernel_pic FIQ_TYPE, FIQ_PC_ADJUST
|
||||
|
||||
/* kernel must jump to this point to switch to a user context */
|
||||
.p2align 2
|
||||
@ -195,24 +195,24 @@
|
||||
ldr lr, _mt_client_context_ptr
|
||||
|
||||
/* buffer user pc */
|
||||
ldr r0, [lr, #pc_offset]
|
||||
ldr r0, [lr, #PC_OFFSET]
|
||||
adr r1, _mt_buffer
|
||||
str r0, [r1]
|
||||
|
||||
/* buffer user psr */
|
||||
ldr r0, [lr, #psr_offset]
|
||||
ldr r0, [lr, #PSR_OFFSET]
|
||||
msr spsr, r0
|
||||
|
||||
/* load user r0 ... r12 */
|
||||
ldm lr, {r0-r12}
|
||||
|
||||
/* load user sp and lr */
|
||||
add sp, lr, #sp_offset
|
||||
add sp, lr, #SP_OFFSET
|
||||
ldm sp, {sp,lr}^
|
||||
|
||||
/* get user cidr and section table */
|
||||
ldr sp, [lr, #contextidr_offset]
|
||||
ldr lr, [lr, #section_table_offset]
|
||||
ldr sp, [lr, #CONTEXTIDR_OFFSET]
|
||||
ldr lr, [lr, #SECTION_TABLE_OFFSET]
|
||||
|
||||
/********************************************************
|
||||
** From now on, until we leave kernel mode, we must **
|
||||
|
@ -21,15 +21,15 @@
|
||||
***************/
|
||||
|
||||
/* hardware names of processor modes */
|
||||
.set usr_mode, 16
|
||||
.set fiq_mode, 17
|
||||
.set irq_mode, 18
|
||||
.set svc_mode, 19
|
||||
.set abt_mode, 23
|
||||
.set und_mode, 27
|
||||
.set USR_MODE, 16
|
||||
.set FIQ_MODE, 17
|
||||
.set IRQ_MODE, 18
|
||||
.set SVC_MODE, 19
|
||||
.set ABT_MODE, 23
|
||||
.set UND_MODE, 27
|
||||
|
||||
/* size of local variables */
|
||||
.set buffer_size, 2 * 4
|
||||
.set BUFFER_SIZE, 2 * 4
|
||||
|
||||
|
||||
/************
|
||||
@ -48,7 +48,7 @@
|
||||
_get_processor_id \buf_reg
|
||||
|
||||
/* multiply processor name with pointer size to get offset of pointer */
|
||||
mov \target_reg, #context_ptr_size
|
||||
mov \target_reg, #CONTEXT_PTR_SIZE
|
||||
mul \buf_reg, \buf_reg, \target_reg
|
||||
|
||||
/* get base of the pointer array */
|
||||
@ -72,7 +72,7 @@
|
||||
_get_processor_id \buf_reg
|
||||
|
||||
/* multiply processor name with buffer size to get offset of buffer */
|
||||
mov \target_reg, #buffer_size
|
||||
mov \target_reg, #BUFFER_SIZE
|
||||
mul \buf_reg, \buf_reg, \target_reg
|
||||
|
||||
/* get base of the buffer array */
|
||||
@ -130,7 +130,7 @@
|
||||
*************************************************************************/
|
||||
|
||||
/* disable fast interrupts when not in fast-interrupt mode */
|
||||
.if \exception_type != fiq_type
|
||||
.if \exception_type != FIQ_TYPE
|
||||
cpsid f
|
||||
.endif
|
||||
|
||||
@ -139,8 +139,8 @@
|
||||
* buffer of this processor. Hence go to svc mode and buffer user r0 and
|
||||
* user r1 to globally mapped memory to be able to pollute r0 and r1.
|
||||
*/
|
||||
.if \exception_type != rst_type && \exception_type != svc_type
|
||||
cps #svc_mode
|
||||
.if \exception_type != RST_TYPE && \exception_type != SVC_TYPE
|
||||
cps #SVC_MODE
|
||||
.endif
|
||||
stm sp, {r0, r1}^
|
||||
|
||||
@ -148,25 +148,25 @@
|
||||
mov r0, sp
|
||||
|
||||
/* switch back to previous privileged mode */
|
||||
.if \exception_type == und_type
|
||||
cps #und_mode
|
||||
.if \exception_type == UND_TYPE
|
||||
cps #UND_MODE
|
||||
.endif
|
||||
.if \exception_type == pab_type
|
||||
cps #abt_mode
|
||||
.if \exception_type == PAB_TYPE
|
||||
cps #ABT_MODE
|
||||
.endif
|
||||
.if \exception_type == dab_type
|
||||
cps #abt_mode
|
||||
.if \exception_type == DAB_TYPE
|
||||
cps #ABT_MODE
|
||||
.endif
|
||||
.if \exception_type == irq_type
|
||||
cps #irq_mode
|
||||
.if \exception_type == IRQ_TYPE
|
||||
cps #IRQ_MODE
|
||||
.endif
|
||||
.if \exception_type == fiq_type
|
||||
cps #fiq_mode
|
||||
.if \exception_type == FIQ_TYPE
|
||||
cps #FIQ_MODE
|
||||
.endif
|
||||
|
||||
/* load kernel contextidr and base of the kernel section-table */
|
||||
adr sp, _mt_master_context_begin
|
||||
add sp, #contextidr_offset
|
||||
add sp, #CONTEXTIDR_OFFSET
|
||||
ldm sp, {r1, sp}
|
||||
|
||||
/* switch to kernel protection-domain */
|
||||
@ -184,7 +184,7 @@
|
||||
.if \pc_adjust != 0
|
||||
sub lr, lr, #\pc_adjust
|
||||
.endif
|
||||
str lr, [sp, #pc_offset]
|
||||
str lr, [sp, #PC_OFFSET]
|
||||
|
||||
/* move buffer pointer to lr to enable us to save user r0 - r12 via stm */
|
||||
mov lr, r0
|
||||
@ -196,7 +196,7 @@
|
||||
stm sp, {r0-r12}^
|
||||
|
||||
/* save user sp and user lr */
|
||||
add r0, sp, #sp_offset
|
||||
add r0, sp, #SP_OFFSET
|
||||
stm r0, {sp, lr}^
|
||||
|
||||
/* get user psr and type of exception that interrupted the user */
|
||||
@ -302,7 +302,7 @@
|
||||
* To enable such switching, the kernel context must be stored within this
|
||||
* region, thus one should map it solely accessable for privileged modes.
|
||||
*/
|
||||
.p2align min_page_size_log2
|
||||
.p2align MIN_PAGE_SIZE_LOG2
|
||||
.global _mt_begin
|
||||
_mt_begin:
|
||||
|
||||
@ -336,7 +336,7 @@
|
||||
and r9, r8, #0b11111
|
||||
|
||||
/* skip following instructions if previous mode was user mode */
|
||||
cmp r9, #usr_mode
|
||||
cmp r9, #USR_MODE
|
||||
beq 1f
|
||||
|
||||
/*
|
||||
@ -359,18 +359,18 @@
|
||||
|
||||
/* switch to kernel to handle the fast interrupt */
|
||||
1:
|
||||
_user_to_kernel_pic fiq_type, fiq_pc_adjust
|
||||
_user_to_kernel_pic FIQ_TYPE, FIQ_PC_ADJUST
|
||||
|
||||
/***************************************************************
|
||||
** Code that switches from a non-FIQ exception to the kernel **
|
||||
***************************************************************/
|
||||
|
||||
_rst_entry: _user_to_kernel_pic rst_type, rst_pc_adjust
|
||||
_und_entry: _user_to_kernel_pic und_type, und_pc_adjust
|
||||
_svc_entry: _user_to_kernel_pic svc_type, svc_pc_adjust
|
||||
_pab_entry: _user_to_kernel_pic pab_type, pab_pc_adjust
|
||||
_dab_entry: _user_to_kernel_pic dab_type, dab_pc_adjust
|
||||
_irq_entry: _user_to_kernel_pic irq_type, irq_pc_adjust
|
||||
_rst_entry: _user_to_kernel_pic RST_TYPE, RST_PC_ADJUST
|
||||
_und_entry: _user_to_kernel_pic UND_TYPE, UND_PC_ADJUST
|
||||
_svc_entry: _user_to_kernel_pic SVC_TYPE, SVC_PC_ADJUST
|
||||
_pab_entry: _user_to_kernel_pic PAB_TYPE, PAB_PC_ADJUST
|
||||
_dab_entry: _user_to_kernel_pic DAB_TYPE, DAB_PC_ADJUST
|
||||
_irq_entry: _user_to_kernel_pic IRQ_TYPE, IRQ_PC_ADJUST
|
||||
|
||||
/**************************************************************
|
||||
** Kernel-entry code that is common for all user exceptions **
|
||||
@ -379,7 +379,7 @@
|
||||
_common_user_to_kernel_pic:
|
||||
|
||||
/* save user psr and type of exception that interrupted the user */
|
||||
add sp, sp, #psr_offset
|
||||
add sp, sp, #PSR_OFFSET
|
||||
stm sp, {r0, r1}
|
||||
|
||||
/*********************************************************
|
||||
@ -395,18 +395,18 @@
|
||||
* exit stores a buffer pointer into its banked sp that is also
|
||||
* needed by the subsequent kernel entry.
|
||||
*/
|
||||
cps #svc_mode
|
||||
cps #SVC_MODE
|
||||
|
||||
/* get base of the kernel-stacks area and the kernel-stack size */
|
||||
adr r0, _mt_master_context_begin
|
||||
add r1, r0, #r12_offset
|
||||
add r1, r0, #R12_OFFSET
|
||||
ldm r1, {r2, r3}
|
||||
|
||||
/* determine top of the kernel stack of this processor and apply it as SP */
|
||||
_init_kernel_sp r3, r2
|
||||
|
||||
/* apply kernel lr and kernel pc */
|
||||
add r1, r0, #lr_offset
|
||||
add r1, r0, #LR_OFFSET
|
||||
ldm r1, {lr, pc}
|
||||
|
||||
_mt_local_variables
|
||||
@ -424,23 +424,23 @@
|
||||
_get_buffer_ptr sp, r0
|
||||
|
||||
/* buffer user pc and base of user section-table globally mapped */
|
||||
ldr r0, [lr, #pc_offset]
|
||||
ldr r1, [lr, #section_table_offset]
|
||||
ldr r0, [lr, #PC_OFFSET]
|
||||
ldr r1, [lr, #SECTION_TABLE_OFFSET]
|
||||
stm sp, {r0, r1}
|
||||
|
||||
/* buffer user psr in spsr */
|
||||
ldr r0, [lr, #psr_offset]
|
||||
ldr r0, [lr, #PSR_OFFSET]
|
||||
msr spsr, r0
|
||||
|
||||
/* setup banked user sp and banked user lr */
|
||||
add r0, lr, #sp_offset
|
||||
add r0, lr, #SP_OFFSET
|
||||
ldm r0, {sp, lr}^
|
||||
|
||||
/* setup user r0 to r12 */
|
||||
ldm lr, {r0-r12}^
|
||||
|
||||
/* load user contextidr */
|
||||
ldr lr, [lr, #contextidr_offset]
|
||||
ldr lr, [lr, #CONTEXTIDR_OFFSET]
|
||||
|
||||
/********************************************************
|
||||
** From now on, until we leave kernel mode, we must **
|
||||
@ -473,15 +473,15 @@
|
||||
b _mon_dab_entry /* data abort */
|
||||
nop /* reserved */
|
||||
b _mon_irq_entry /* interrupt request */
|
||||
_vm_to_kernel fiq_type, 4 /* fast interrupt request */
|
||||
_vm_to_kernel FIQ_TYPE, 4 /* fast interrupt request */
|
||||
|
||||
/* PICs that switch from a vm exception to the kernel */
|
||||
_mon_rst_entry: _vm_to_kernel rst_type, 0
|
||||
_mon_und_entry: _vm_to_kernel und_type, 4
|
||||
_mon_svc_entry: _vm_to_kernel svc_type, 0
|
||||
_mon_pab_entry: _vm_to_kernel pab_type, 4
|
||||
_mon_dab_entry: _vm_to_kernel dab_type, 8
|
||||
_mon_irq_entry: _vm_to_kernel irq_type, 4
|
||||
_mon_rst_entry: _vm_to_kernel RST_TYPE, 0
|
||||
_mon_und_entry: _vm_to_kernel UND_TYPE, 4
|
||||
_mon_svc_entry: _vm_to_kernel SVC_TYPE, 0
|
||||
_mon_pab_entry: _vm_to_kernel PAB_TYPE, 4
|
||||
_mon_dab_entry: _vm_to_kernel DAB_TYPE, 8
|
||||
_mon_irq_entry: _vm_to_kernel IRQ_TYPE, 4
|
||||
|
||||
/* kernel must jump to this point to switch to a vm */
|
||||
.p2align 2
|
||||
|
Loading…
Reference in New Issue
Block a user