Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

some questions about registers in nios2

i have some questions about registers in nios2

1: the GP(r26)' function like PC as in X86 architecture ?

2: (r15-r8) is named Caller-Saved registers ,their function ?

3:(r16_r23),their function ?

4: when call a function, the rule of saving registers is what? between r2 to

r25 ,which should be saved ?

5: when an interrupt happen or call function , the differences between the saving registers and restore register action.

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    originally posted by wkongwkong@Jun 22 2006, 11:15 PM

    i have some questions about registers in nios2

    1: the gp(r26)' function like pc as in x86 architecture ?

    2: (r15-r8) is named caller-saved registers ,their function ?

    3:(r16_r23),their function ?

    4: when call a function, the rule of saving registers is what? between r2 to

    r25 ,which should be saved ?

    5: when an interrupt happen or call function , the differences between the saving registers and restore register action.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=16354)

    --- quote end ---

    --- Quote End ---

    1. I&#39;m rusty on my x86 so I&#39;m not sure of the answer to this.

    2. Caller saved registers have to be saved by the calling function. So if you&#39;re writing in assembler you don&#39;t have to bother saving them.

    3. They&#39;re just registers that you can do with what you will

    4. When calling a function if doing it from assembler you should save the caller saved registers. If you do the call from C the compiler looks after this for you.

    5. If you want to know which registers are saved for an IRQ look in the file alt_exception_entry.S in the nios2 component