;===========================================================================
;
;FILE: bridle_asmutils.s
;
;SERVICES: ARM assembly utilities for BRIDLE
;
;DESCRIPTION
;
;
;
;INITIALIZATION AND SEQUENCING REQUIREMENTS:  N/A
;
;
;        Copyright © 1999-2003 QUALCOMM Incorporated.
;               All Rights Reserved.
;            QUALCOMM Proprietary/GTDR
;==========================================================================
   EXPORT bridle_get_cpsr
   EXPORT bridle_access_abort
   AREA ARMUTILS, CODE, READONLY
   CODE32
;============================================================================
;                       bridle_get_cpsr
;
;  Gets the Current Program Status Register 
;============================================================================
bridle_get_cpsr
     MRS r0, CPSR
     BX  lr
     
;============================================================================
;                       bridle_access_abort
;
;  Aborts the caller by switching to user mode  and writing to an illegal
;  address.
;============================================================================

      AREA    BRIDLEDATA_ABORT, CODE, READONLY
      CODE32                         ; 32 bit ARM instruction set.

bridle_abort_badaddr
      DCD     0xEBADACC

bridle_access_abort
      LDR   r12, =bridle_abort_badaddr
      LDR   r12, [r12]                ;load 0xEBADACC in r12
      MOV   r4,  r12
      MOV   r5,  r12
      MOV   r6,  r12
      MOV   r7,  r12
      MOV   r8,  r12
      MOV   r9,  r12
      MOV   r10, r12
      MOV   r11, r12
      MSR   cpsr_cxsf, #0x10
      STR   r0,  [r12]

      END
