public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "james chen" <james_ch1@sina.com>
To: <ecos-discuss@sources.redhat.com>
Subject: [ECOS]exception stack
Date: Wed, 14 Feb 2001 08:34:00 -0000	[thread overview]
Message-ID: <000701c09632$ed1ce940$c408aa0a@inc.inventec> (raw)

Hello,

    In vectors.S (hal/arm/arch/current/src/vectors.S), sp register in each
ARM state had been initialized during rest vector, but in
undefined_instruction code, the first instruction is initializing the sp
register again with different stack, the undef_exception_stack is larger
than exception_stack. Is it done for special reason or other? may anyone
tell me why, thanks!

========================================================
        .global start
start:
        // initialize interrupt/exception environments
        ldr     sp,.__startup_stack
        mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
        msr     cpsr,r0
        ldr     sp,.__exception_stack
        mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
        msr     cpsr,r0
        ldr     sp,.__exception_stack

        // initialize CPSR (machine state register)
        mov     r0,#(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SUPERVISOR_MODE)
        msr     cpsr,r0

        // Note: some functions in LIBGCC1 will cause a "restore from
SPSR"!!
        msr     spsr,r0

        // initialize stack
        ldr     sp,.__startup_stack

       .................

//
// Exception handlers
// Assumption: get here from a Supervisor context [mode]
//
        .code   32
undefined_instruction:
        ldr     sp,.__undef_exception_stack     // get good stack
        stmfd   sp!,{r0,fp,ip,lr}
        mrs     r0,spsr
        stmfd   sp!,{r0}
        mov     ip,sp                   // save SP which will vanish with

                                        //   mode switch
       .......

// -------------------------------------------------------------------------
// Temporary interrupt stack

        .section ".bss"

// Small stacks, only used for saving information between CPU modes
__exception_stack_base:
        .rept   32
        .long   0
        .endr
__exception_stack:
        .rept   32
        .long   0
        .endr
__undef_exception_stack:
     .........


                 reply	other threads:[~2001-02-14  8:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000701c09632$ed1ce940$c408aa0a@inc.inventec' \
    --to=james_ch1@sina.com \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).