Clean up some of the exception handling code in the new MicroBlaze port.

pull/4/head
Richard Barry 14 years ago
parent f90794f05a
commit 3d5656e37e

@ -73,8 +73,8 @@ stacked register values. */
#define portexR11_STACK_OFFSET 12 #define portexR11_STACK_OFFSET 12
#define portexR12_STACK_OFFSET 13 #define portexR12_STACK_OFFSET 13
#define portexR15_STACK_OFFSET 16 #define portexR15_STACK_OFFSET 16
#define portexR18_STACK_OFFSET 18 #define portexR18_STACK_OFFSET 19
#define portexMSR_STACK_OFFSET 19 #define portexMSR_STACK_OFFSET 20
#define portexR19_STACK_OFFSET -1 #define portexR19_STACK_OFFSET -1
/* This is defined to equal the size, in bytes, of the stack frame generated by /* This is defined to equal the size, in bytes, of the stack frame generated by
@ -90,9 +90,9 @@ exceptions, or the application defined configuration constant
configINSTALL_EXCEPTION_HANDLERS is not set to 1. */ configINSTALL_EXCEPTION_HANDLERS is not set to 1. */
#if ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) #if ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 )
/* These variables are set in the exception entry code, before /* This variable is set in the exception entry code, before
vPortExceptionHandler is called. */ vPortExceptionHandler is called. */
unsigned long *pulStackPointerOnFunctionEntry = NULL, ulBTROnFunctionEntry = 0UL; unsigned long *pulStackPointerOnFunctionEntry = NULL;
/* This is the structure that is filled with the MicroBlaze context as it /* This is the structure that is filled with the MicroBlaze context as it
existed immediately prior to the exception occurrence. A pointer to this existed immediately prior to the exception occurrence. A pointer to this
@ -159,8 +159,7 @@ extern void *pxCurrentTCB;
xRegisterDump.ulR13_read_write_small_data_area = mfgpr( R13 ); xRegisterDump.ulR13_read_write_small_data_area = mfgpr( R13 );
xRegisterDump.ulR14_return_address_from_interrupt = mfgpr( R14 ); xRegisterDump.ulR14_return_address_from_interrupt = mfgpr( R14 );
xRegisterDump.ulR16_return_address_from_trap = mfgpr( R16 ); xRegisterDump.ulR16_return_address_from_trap = mfgpr( R16 );
xRegisterDump.ulR17_return_address_from_some_exceptions = mfgpr( R17 ); xRegisterDump.ulR17_return_address_from_exceptions = mfgpr( R17 );
xRegisterDump.ulR18 = mfgpr( R18 );
xRegisterDump.ulR20 = mfgpr( R20 ); xRegisterDump.ulR20 = mfgpr( R20 );
xRegisterDump.ulR21 = mfgpr( R21 ); xRegisterDump.ulR21 = mfgpr( R21 );
xRegisterDump.ulR22 = mfgpr( R22 ); xRegisterDump.ulR22 = mfgpr( R22 );
@ -174,7 +173,6 @@ extern void *pxCurrentTCB;
xRegisterDump.ulR30 = mfgpr( R30 ); xRegisterDump.ulR30 = mfgpr( R30 );
xRegisterDump.ulR31 = mfgpr( R31 ); xRegisterDump.ulR31 = mfgpr( R31 );
xRegisterDump.ulR1_SP = ( ( unsigned long ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE; xRegisterDump.ulR1_SP = ( ( unsigned long ) pulStackPointerOnFunctionEntry ) + portexASM_HANDLER_STACK_FRAME_SIZE;
xRegisterDump.ulBTR = ulBTROnFunctionEntry;
xRegisterDump.ulEAR = mfear(); xRegisterDump.ulEAR = mfear();
xRegisterDump.ulESR = mfesr(); xRegisterDump.ulESR = mfesr();
xRegisterDump.ulEDR = mfedr(); xRegisterDump.ulEDR = mfedr();
@ -182,7 +180,7 @@ extern void *pxCurrentTCB;
/* Move the saved program counter back to the instruction that was executed /* Move the saved program counter back to the instruction that was executed
when the exception occurred. This is only valid for certain types of when the exception occurred. This is only valid for certain types of
exception. */ exception. */
xRegisterDump.ulPC = xRegisterDump.ulR17_return_address_from_some_exceptions - portexINSTRUCTION_SIZE; xRegisterDump.ulPC = xRegisterDump.ulR17_return_address_from_exceptions - portexINSTRUCTION_SIZE;
#if XPAR_MICROBLAZE_0_USE_FPU == 1 #if XPAR_MICROBLAZE_0_USE_FPU == 1
{ {

@ -115,7 +115,6 @@ back into the caller stack. */
.extern ulTaskSwitchRequested .extern ulTaskSwitchRequested
.extern vPortExceptionHandler .extern vPortExceptionHandler
.extern pulStackPointerOnFunctionEntry .extern pulStackPointerOnFunctionEntry
.extern ulBTROnFunctionEntry
.global _interrupt_handler .global _interrupt_handler
.global VPortYieldASM .global VPortYieldASM
@ -350,8 +349,6 @@ vPortExceptionHandlerEntry:
/* Take a copy of the stack pointer before vPortExecptionHandler is called, /* Take a copy of the stack pointer before vPortExecptionHandler is called,
storing its value prior to the function stack frame being created. */ storing its value prior to the function stack frame being created. */
swi r1, r0, pulStackPointerOnFunctionEntry swi r1, r0, pulStackPointerOnFunctionEntry
mfs r18, RBTR
swi r18, r0, ulBTROnFunctionEntry
bralid r15, vPortExceptionHandler bralid r15, vPortExceptionHandler
or r0, r0, r0 or r0, r0, r0

@ -168,7 +168,7 @@ typedef struct PORT_REGISTER_DUMP
unsigned long ulR14_return_address_from_interrupt; unsigned long ulR14_return_address_from_interrupt;
unsigned long ulR15_return_address_from_subroutine; unsigned long ulR15_return_address_from_subroutine;
unsigned long ulR16_return_address_from_trap; unsigned long ulR16_return_address_from_trap;
unsigned long ulR17_return_address_from_some_exceptions; unsigned long ulR17_return_address_from_exceptions; /* The exception entry code can copy the BTR in here for exceptions that occur in the delay slot of branch instructions. */
unsigned long ulR18; unsigned long ulR18;
unsigned long ulR19; unsigned long ulR19;
unsigned long ulR20; unsigned long ulR20;
@ -185,7 +185,6 @@ typedef struct PORT_REGISTER_DUMP
unsigned long ulR31; unsigned long ulR31;
unsigned long ulPC; unsigned long ulPC;
unsigned long ulESR; unsigned long ulESR;
unsigned long ulBTR;
unsigned long ulMSR; unsigned long ulMSR;
unsigned long ulEAR; unsigned long ulEAR;
unsigned long ulFSR; unsigned long ulFSR;

@ -102,6 +102,7 @@
/* BSP includes. */ /* BSP includes. */
#include "xtmrctr.h" #include "xtmrctr.h"
#include "microblaze_exceptions_g.h"
/* Kernel includes. */ /* Kernel includes. */
#include "FreeRTOS.h" #include "FreeRTOS.h"

Loading…
Cancel
Save