LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Openrisc > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: Heiko Panther<heiko.panther@w...>
    Date: Tue Jan 27 13:30:45 CET 2004
    Subject: [openrisc] eCos crash when not optimizing
    Top
    Got this one too. In the HAL architecture of eCos, vectors.S, routine
    cyg_hal_default_interrupt_vsr. r4 contains the all-important vector
    number, which is clobbered by a call to _cyg_instrument for a -O0 build.
    Here's my quick fix:

    FUNC_START(cyg_hal_default_interrupt_vsr)

    # Stash away pointer to saved regs for later
    l.or r31,r3,r3
    # and the vector number too!
    l.or r29,r4,r4

    (...)

    #if defined(CYGPKG_KERNEL_INSTRUMENT) &&
    defined(CYGDBG_KERNEL_INSTRUMENT_INTR)
    # Log the interrupt if kernel tracing is enabled
    l.ori r3,r0,0x0301 # arg1 = type = INTR,RAISE
    # arg2 = vector number
    l.ori r5,r0,0 # arg3 = 0
    l.jal _cyg_instrument # call instrument function
    l.nop

    # and because _cyg_instrument might have destroyed r4, get it back
    l.or r4, r29, r29
    #endif

    Note also the added l.nop.

    Regards,
    Heiko



    >>-----Original Message-----
    >>From: openrisc-bounces@o...
    >>[mailto:openrisc-bounces@o...]On Behalf Of Heiko Panther
    >>Sent: 16 January 2004 12:06
    >>To: openrisc@o...
    >>Subject: [openrisc] eCos crash when not optimizing
    >>
    >>
    >>I'm on to this weird bug, which probably was there in my system from the
    >>start. It only happens when I _don't_ optimize, when I use -O0. So I
    >>compiled with -O2 all the time until now.
    >>
    >>The problem seems to be that when eCos enables the tick timer, I
    >>instantly receive an exception. All the values from the saved registers
    >>look screwed up, like this (printed out from cyg_hal_exception_handler()):
    >>
    >>vector 0xfffffdf7, sp 0x04083004, fp 0x04083004, lr 0xffff6324, sr
    >>0xbdfffee3, pc 0xffffffbf, eear 0xbffdf2e7
    >>
    >>Can anyone find some sense in this? I mean, why do I get an exception
    >>with this totally insane vector? Obviously, stack and frame pointer are
    >>bogus too, since they don't point to RAM but to code in ROM (they point
    >>to the beginning of _cyg_hal_default_exception_vsr ).
    >>

    Follow upAuthor
    [openrisc] eCos crash when not optimizingRobert Cragie

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.