Commit c8e135bc authored by Stewart Brodie's avatar Stewart Brodie
Browse files

IRQ management support added.

Detail:
  IRQ management code has been added, provided irqs_on/irqs_off
    and ensure_irqs_on/ensure_irqs_off/restore_irqs.
  Removed the hardwiring of No26bitCode from sixtyfour.s :-)
  Missing #endif's added to other header files.
Admin:
  Code examined in decaof to validate output.
  Required by ShareFS 3.45 et al.

Version 0.02. Tagged as 'AsmUtils-0_02'
parent d6adadd8
......@@ -13,5 +13,5 @@
| limitations under the License.
|
Dir <Obey$Dir>
amu_machine export_libs
amu_machine export_hdrs
amu_machine export_libs
......@@ -41,10 +41,8 @@ LB = libfile
TOUCH = create
WIPE = -wipe
# Defining this macro has the effect of suppressing the warning
# about use of the UMULL instruction in s.sixtyfour in the case
# where No26bitCode is true.
OBJASMCPU = -CPU arm7m
# No specific preference
OBJASMCPU =
CCFLAGS = -c -depend !Depend -ffaho ${INCLUDES} ${DFLAGS}
ASFLAGS = -depend !Depend -Stamp -quit ${OBJASMCPU}
......@@ -78,14 +76,16 @@ TARGETZ = alf.${COMPONENTZ}
SOURCE =
EXPORTS =
OBJS= o.callbacks o.sixtyfour o.heapswis o.rminfo
OBJS= o.callbacks o.sixtyfour o.heapswis o.rminfo o.irqs
OBJSZ= oz.callbacks oz.sixtyfour oz.heapswis oz.rminfo
OBJSZ= oz.callbacks oz.sixtyfour oz.heapswis oz.rminfo oz.irqs
HDRS= h.callbacks h.sixtyfour h.heapswis h.rminfo
HDRS= h.callbacks h.sixtyfour h.heapswis h.rminfo h.irqs
LIBS = ${TARGET} ${TARGETZ}
LOCALDIRS = o._dirs
#
# Rule patterns
#
......@@ -96,7 +96,7 @@ LIBS = ${TARGET} ${TARGETZ}
#
# build a the library:
#
all: ${LIBS}
all: ${LIBS}
#
# RISC OS ROM build rules:
......@@ -120,17 +120,19 @@ export_hdrs: ${HDRS} export_dirs
${CP} h.sixtyfour ${LIBDIR}.h.sixtyfour ${CPFLAGS}
${CP} h.rminfo ${LIBDIR}.h.rminfo ${CPFLAGS}
${CP} h.heapswis ${LIBDIR}.h.heapswis ${CPFLAGS}
${CP} VersionNum ${LIBDIR}.VersionNum ${CPFLAGS}
${CP} h.irqs ${LIBDIR}.h.irqs ${CPFLAGS}
${CP} VersionNum ${LIBDIR}.VersionNum ${CPFLAGS}
@echo ${COMPONENT}: export complete (hdrs)
export_libs: ${LIBS} export_dirs
${CP} alf ${LIBDIR}.o ${CPFLAGS}
@echo ${COMPONENT}: export complete (libs)
local_dirs:
${LOCALDIRS}:
${MKDIR} o
${MKDIR} oz
${MKDIR} alf
${TOUCH} $@
export_dirs:
${MKDIR} ${LIBDIR}.h
......@@ -138,10 +140,10 @@ export_dirs:
#
# Final link
#
${TARGET}: ${OBJS} local_dirs
${TARGET}: ${OBJS} ${LOCALDIRS}
${LB} ${LBFLAGS} -o $@ ${OBJS}
${TARGETZ}: ${OBJSZ} local_dirs
${TARGETZ}: ${OBJSZ} ${LOCALDIRS}
${LB} ${LBFLAGS} -o $@ ${OBJSZ}
# Dynamic dependencies:
/* (0.01)
/* (0.02)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.01
#define Module_MajorVersion_CMHG 0.02
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 26 Nov 1999
#define Module_Date_CMHG 29 Nov 1999
#define Module_MajorVersion "0.01"
#define Module_Version 1
#define Module_MajorVersion "0.02"
#define Module_Version 2
#define Module_MinorVersion ""
#define Module_Date "26 Nov 1999"
#define Module_Date "29 Nov 1999"
#define Module_FullVersion "0.01"
#define Module_FullVersion "0.02"
......@@ -23,6 +23,7 @@
#ifdef __cplusplus
extern "C" {
#endif
/* All of these calls do the same thing - the aliases are provided
* until all code can be modified to call the function the same
......
......@@ -23,6 +23,7 @@
#ifdef __cplusplus
extern "C" {
#endif
/* Fast veneers to OS_Heap used by various components in the build.
* These functions correspond to the R0 sub-reason codes of OS_Heap,
......
/* Copyright 1999 Pace Micro Technology plc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* AsmUtils (irqs.h)
*
* Copyright (C) Pace Micro Technology plc. 1999
*
*/
#ifndef asmutils_irqs_h_inluded
#define asmutils_irqs_h_inluded
#ifdef __cplusplus
extern "C" {
#endif
/* Support for interrupt status management */
/* Firstly, the Acorn Network Computing way of doing it
* irqs_off returns a value which is to be passed to irqs_on to restore
* the state that existed before irqs_off was called. The value is
* opaque (and WILL differ depending on the No32bitCode/No26bitCode macros)
* and may not be inspected - even to determine whether it is zero or not -
* as it may contain further information.
*/
extern int irqs_off(void);
extern void irqs_on(int);
/* Secondly, the other common method which provides an extra alternative:
* ensure_irqs_off forces IRQs to be disabled, restore_irqs takes the
* return value from the former and restores the IRQ state, ensure_irqs_on
* always enables IRQs and returns a value that can be passed to
* restore_irqs later to restore the state.
*
* As for the ANC veneers, the value returned is opaque and must not be
* interpreted in any way.
*/
extern int ensure_irqs_off(void);
extern int ensure_irqs_on(void);
extern void restore_irqs(int);
#ifdef __cplusplus
}
#endif
#endif
; Copyright 1999 Pace Micro Technology plc
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
; http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; irqs.s
;
; The code from this source file has been taken from the ANC interrupt
; management code and from ART interrupt management code.
;
; See irqs.h for interface details
;
; NOTE 1: Counter-intuitively, irqs_on matches restore_irqs and NOT
; ensure_irqs_on.
;
; NOTE 2: This code prefers to use 32-bit code where possible.
;
GET Hdr:ListOpts
GET Hdr:Macros
GET Hdr:System
GET Hdr:APCS.<APCS>
EXPORT irqs_off
EXPORT irqs_on
EXPORT ensure_irqs_off
EXPORT ensure_irqs_on
EXPORT restore_irqs
AREA |AsmUtils$irqs$$Code|, CODE, READONLY, PIC
; ensure_irqs_off/ irqs_off: Disable IRQs, returning a value
; suitable for passing to restore_irqs/irqs_on.
ensure_irqs_off
irqs_off
[ No26bitCode :LOR: :LNOT: No32bitCode
MRS r0, CPSR
ORR r1, r0, #I32_bit ; set IRQs
TEQ r0, r1 ; any change?
MSRNE CPSR_c, r1 ; disable IRQs if enabled before
AND r0, r0, #I32_bit ; return previous state of bit
Return ,LinkNotStacked
|
AND r0, lr, # I_bit
ORRS pc, lr, # I_bit
]
; restore_irqs/irqs_on: Re-enable IRQs if they were enabled prior to
; the earlier call to ensure_irqs_off/ensure_irqs_on/irqs_off
restore_irqs
irqs_on
[ No26bitCode :LOR: :LNOT: No32bitCode
MRS r1, CPSR ; obtain current PSR
BIC r2, r1, #I32_bit ; clear IRQ bit
ORR r2, r2, r0 ; restore state from parameter
TEQ r1, r2 ; changed?
MSRNE CPSR_c, r2 ; update PSR if it has changed
Return ,LinkNotStacked
|
BIC lr, lr, # I_bit
ORRS pc, lr, r0
]
; ensure_irqs_on: Enable IRQs, returning a value
; suitable for passing to restore_irqs/irqs_on
ensure_irqs_on
[ No26bitCode :LOR: :LNOT: No32bitCode
MRS r0, CPSR
BIC r1, r0, #I32_bit ; enable IRQs
TEQ r0, r1 ; any change?
MSRNE CPSR_c, r1 ; enable IRQs if disabled before
AND r0, r0, #I32_bit ; return previous state of bit
Return ,LinkNotStacked
|
AND r0, lr, # I_bit
BICS pc, lr, # I_bit
]
END
......@@ -23,8 +23,6 @@
GET Hdr:Machine.<Machine>
GET Hdr:APCS.<APCS>
No26bitCode SETL {TRUE}
; Long multiplier ----------------------------------------
; Taken from Acorn Assembler manual.
; extern u_int64_t *ui64_multiply_uu(u_int64_t *, unsigned, unsigned);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment