1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
;/***************************************************************************
; * Copyright (c) 2024 Microsoft Corporation
; *
; * This program and the accompanying materials are made available under the
; * terms of the MIT License which is available at
; * https://opensource.org/licenses/MIT.
; *
; * SPDX-License-Identifier: MIT
; **************************************************************************/
;
;
;/**************************************************************************/
;/**************************************************************************/
;/** */
;/** ThreadX Component */
;/** */
;/** Initialize */
;/** */
;/**************************************************************************/
;/**************************************************************************/
#ifdef TX_INCLUDE_USER_DEFINE_FILE
#include "tx_user.h"
#endif
;/**************************************************************************/
;/* */
;/* FUNCTION RELEASE */
;/* */
;/* _tx_initialize_fast_interrupt_setup ARC_HS/MetaWare */
;/* 6.2.1 */
;/* AUTHOR */
;/* */
;/* William E. Lamie, Microsoft Corporation */
;/* */
;/* DESCRIPTION */
;/* */
;/* This function initializes register bank 1 for fast interrupt use. */
;/* The initialization includes setting the stack pointer to the value */
;/* supplied by the caller. */
;/* */
;/* INPUT */
;/* */
;/* stack_ptr Pointer to stack for bank 1 */
;/* */
;/* OUTPUT */
;/* */
;/* None */
;/* */
;/* CALLS */
;/* */
;/* None */
;/* */
;/* CALLED BY */
;/* */
;/* Application */
;/* */
;/**************************************************************************/
;VOID _tx_initialize_fast_interrupt_setup(VOID *stack_ptr)
;{
.global _tx_initialize_fast_interrupt_setup
.type _tx_initialize_fast_interrupt_setup, @function
_tx_initialize_fast_interrupt_setup:
;
; /* Assume this routine is being called from initialization, with interrupts
; disabled and from register bank 0. Also assume that the stack pointer
; input is valid, i.e., there is no error checking on the validity of
; register_bank. */
;
sub sp, sp, 8 ; Build a small stack frame to hold the setup information
st gp, [sp, 0] ; Save gp in the frame
st r0, [sp, 4] ; Save sp in the frame
mov ilink, sp ; Move the stack frame into ilink
mov r1, 1 ; Select register bank 1
asl r2, r1, 16 ; Move the register bank bits over to proper location
lr r3, [status32] ; Pickup status32 register
or r3, r3, r2 ; Build new status32 register
kflag r3 ; Move to the hardware register bank
mov r0, ilink ; Place stack pointer in r0
ld sp, [r0, 4] ; Setup stack pointer for this hardware register bank
mov fp, 0 ; Setup fp
ld gp, [r0, 0] ; Setup gp
mov blink, 0 ; Setup blink
mov r0, 0 ; Clear r0
sub sp, sp, 8 ; Reserve space for saving ilink and status32.p0 on thread preemption
lr r3, [status32] ; Pickup status32 register
bclr r3, r3, 16 ; Build register bank 0 value
bclr r3, r3, 17 ;
bclr r3, r3, 18 ;
kflag r3 ; Move back to register bank 0
j_s.d [blink] ; Return to caller
add sp, sp, 8 ;
;}
.end
|