Code Monkey home page Code Monkey logo

Comments (4)

kito-cheng avatar kito-cheng commented on June 30, 2024

cc. @cmuellner @apazos @topperc @asb @aswaterman

from riscv-elf-psabi-doc.

apazos avatar apazos commented on June 30, 2024

Thanks @kito-cheng for posting this issue.

A few remarks about the clipped figures from the PDF file posted in the discussion:

  • The current ABI states that β€œthe frame pointer register will point to the Canonical Frame Address or CFA, which is the stack pointer value on entry to the current procedure.”
  • In the alternative ABI "the frame pointer points to the saved return address in the CM.PUSH/CM.POP stack frame".
  • If we opt for an alternative ABI for no-omit-frame-pointer + Zcmp and rely on the linker to do compatibility checks for ABI mix, I think we would need an ELF attribute that indicates that the frame pointer is enabled so the linker can implement the proper checks.

from riscv-elf-psabi-doc.

james-ball-qualcomm avatar james-ball-qualcomm commented on June 30, 2024

The previously attached PDF of the slides is out of date. Please use the latest version at:
https://docs.google.com/presentation/d/1Qk-pNJ5svY8trYW3Smk073ok9pcEJFc5hsx4rbOoj5M

from riscv-elf-psabi-doc.

sorear avatar sorear commented on June 30, 2024

I would suggest to point the fp within each stack frame one word after the saved s0 value, so that -XLEN/8(fp) is the saved fp and -2*XLEN/8(fp) is the saved ra. This allows stack trace code to support both conventions (mixed, even) in the common case that stack bounds are known:

[unwind psuedocode]
while ((fp - stack_base) < stack_size) {
    if ((fp[-1] - stack_base) < stack_size) {
        ra = fp[-2]; fp = fp[-1]; /* Zcmp optimized convention */
    } else {
        ra = fp[-1]; fp = fp[-2]; /* ABI 1.1 convention */
    }
    print(ra);
}

This works because valid stack addresses are disjoint from valid instruction addresses.

A preprocessor define will be needed to communicate the use of the new ABI to unwinders when there is not enough information at runtime to distinguish stack and instruction addresses. It might be worth defining an ELF attribute for future-proofing, although mixing code using both frame pointer conventions may not be an error.

from riscv-elf-psabi-doc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.