Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • D dynamorio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,467
    • Issues 1,467
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 44
    • Merge requests 44
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DynamoRIO
  • dynamorio
  • Issues
  • #4930
Closed
Open
Issue created May 28, 2021 by Abhinav Anil Sharma@abhinav92003Contributor

[AArch64] Q/GE flags not saved/restored in drreg

Today on AArch64, drreg uses mrs and msr to read and write aflags respectively via DR_REG_NZCV. This leaves out the Q (saturation) and GE (greater-or-equal) flags, which are considered a part of aflags by DR. https://github.com/DynamoRIO/dynamorio/blob/e8fc651f485f858127bf2394defc382d5cdff641/core/ir/instr_api.h#L2433

This causes issues with liveness analysis, which thinks that aflags are always live, and therefore always stores them to a slot in drreg_reserve_aflags. So, this optimisation is never invoked: https://github.com/DynamoRIO/dynamorio/blob/e8fc651f485f858127bf2394defc382d5cdff641/ext/drreg/drreg.c#L1616

We should either start saving/restoring Q and GE flags too, or if they are not required, skip them from liveness analysis to avoid the extra aflags spills/restores in drreg.

To read/write the Q flag, we may have to use FPSR: https://developer.arm.com/documentation/100076/0100/instruction-set-overview/overview-of-aarch64-state/the-q-flag-in-aarch64-state

I couldn't find any documentation yet for the GE flag. Though DR does have it in code: https://github.com/DynamoRIO/dynamorio/blob/e8fc651f485f858127bf2394defc382d5cdff641/core/ir/instr_api.h#L2443

Assignee
Assign to
Time tracking