From 3c7ed6b8cd505f696c9c2b6d90723094f334b348 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 6 Jul 2005 18:46:04 +0000 Subject: 2005-07-06 Markku Puro * .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac, clock/clockdrv.c, console/conio.c, console/console.c, console/defaultfont.c, include/arm_mode_bits.h, include/asm_macros.h, include/bsp.h, include/bspopts.h.in, include/conio.h, include/gba.h, include/gba_registers.h, include/tm27.h, irq/bsp_irq_asm.S, irq/bsp_irq_init.c, irq/irq.c, irq/irq.h, irq/irq_asm.S, irq/irq_init.c, start/logo.S, start/start.S, startup/bspstart.c, startup/cpu.c, startup/cpu_asm.S, startup/exit.c, startup/linkcmds, timer/timer.c: New files. --- c/src/lib/libbsp/arm/gba/startup/cpu_asm.S | 86 ++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 c/src/lib/libbsp/arm/gba/startup/cpu_asm.S (limited to 'c/src/lib/libbsp/arm/gba/startup/cpu_asm.S') diff --git a/c/src/lib/libbsp/arm/gba/startup/cpu_asm.S b/c/src/lib/libbsp/arm/gba/startup/cpu_asm.S new file mode 100644 index 0000000000..d4ea836960 --- /dev/null +++ b/c/src/lib/libbsp/arm/gba/startup/cpu_asm.S @@ -0,0 +1,86 @@ +/** + * @file cpu_asm.S + * + * This file contains the implementation of exception handlers. + */ +/* + * RTEMS GBA BSP + * + * Copyright (c) 2002 by Advent Networks, Inc. + * Jay Monkman + * + * COPYRIGHT (c) 2000 Canon Research Centre France SA. + * Emmanuel Raguet, mailto:raguet@crf.canon.fr + * + * Copyright (c) 2004 + * Markku Puro + * + * The license and distribution terms for this file may be + * found in found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#define __asm__ +#include +#include +#include +/* @cond INCLUDE_ASM */ + +/** + * This routine performs a normal non-FP context. + * function void _CPU_Context_switch( run_context, heir_context ) + * R0 = run_context R1 = heir_context + * + * This function copies the current registers to where r0 points, then + * restores the ones from where r1 points. + * + * Using the ldm/stm opcodes save 2-3 us on 100 MHz ARM9TDMI with + * a 16 bit data bus. + * + */ + .align +/* .section .iwram */ +PUBLIC_ARM_FUNCTION(_CPU_Context_switch) +/* Start saving context */ + mrs r2, cpsr + stmia r0, {r2, r4, r5, r6, r7, r8, r9, r10, r11, r13, r14} +/* Start restoring context */ +_restore: + ldmia r1, {r2, r4, r5, r6, r7, r8, r9, r10, r11, r13, r14} + msr cpsr, r2 + mov pc, lr +LABEL_END(_CPU_Context_switch) + +/** + * This function copies the restores the registers from where r0 points. + * function void _CPU_Context_restore( new_context ) + * It must match _CPU_Context_switch() + * + */ +PUBLIC_ARM_FUNCTION(_CPU_Context_restore) + mov r1, r0 + b _restore +LABEL_END(_CPU_Context_restore) + +/** + * function _Exception_Handler_Undef_Swi + * Can't use exception vectors in GBA + * @todo _Exception_Handler_Undef_Swi: Unused handler needed by ../score/cpu_asm.S + * + */ + .global _Exception_Handler_Undef_Swi +_Exception_Handler_Undef_Swi: + mov pc, lr + +/** + * function _Exception_Handler_Abort + * Can't use exception vectors in GBA + * @todo _Exception_Handler_Abort: Unused handler needed by ../score/cpu_asm.S + * + */ + .global _Exception_Handler_Abort +_Exception_Handler_Abort: + mov pc, lr +/* @endcond */ -- cgit v1.2.3