Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modular Jasmin (jexport ABI) #860

Open
cassiersg opened this issue Jul 10, 2024 · 0 comments
Open

Modular Jasmin (jexport ABI) #860

cassiersg opened this issue Jul 10, 2024 · 0 comments

Comments

@cassiersg
Copy link
Collaborator

Summary of discussion in Bristol

Goals:

  1. make reg alloc less fragile (e.g., we don't want a tiny change in SHA-3 to break Dilithium build)
  2. be able to swap implementation of a function "at link time" (e.g., externally-provided SHA-3 library with a custom assembly wrapper to match the C ABI, assembly stub that implement syscalls)

Main idea: define "jexport" functions, that follow a Jasmin-defined ABI for Jasmin -> Jasmin calls.

Concrete plan:

  1. Define the "jexport" ABI. - This solves goal 1. (although the lack of private functions would make it possible for Jasmin programmers to mess up - but that's not a blocking issue).
  2. Have separate compilation units, and have a file format for compiled units. - That unlocks goal 2.: we can generate such a file by hand/ with another tool. (This generated file is trusted.)

Open questions:

  • How to put speculation flags in the ABI?
  • Caller-saved vs callee-saved registers
  • jexport function would not benefit of reg optimization when returning reg ptr. We can probably work without this optimization.
  • stack alignment: can we specify it to be constant (per platform), like 16 (x86_64), 4 (arm-m4)? otherwise it would have to be part of each function ABI
  • stack allocation: if done by the caller, need to include the "own" stack usage in ABI
  • stack clearing: can be done by adding total stack usage in the ABI ?
  • file format: meta-data in comments of assembly file?
  • how to define and manage compilation units (syntax? per-file?)
  • is there a relationship between compilation units and namespaces?

cc @eponier @bgregoir @cryptojedi @Rixxc @mbbarbosa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant