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

Periodic maintenance PR #1376

Merged
merged 24 commits into from
Sep 26, 2023
Merged

Periodic maintenance PR #1376

merged 24 commits into from
Sep 26, 2023

Conversation

elicn
Copy link
Member

@elicn elicn commented Aug 24, 2023

Yet another maintenance PR including bug fixes and various improvements.

Highlights:

  • General
    • Refactored system calls ABI to be cleaner and more maintainable
    • qltool tweaks
    • Refreshed many tests
  • POSIX
    • Extracted msq and shm functionalities
    • Fixed fd args signed int handling

New Features:

  • Users may now specify a CPU model on Qiling init for Unicorn to use. Specifying a CPU model provides users with better control over the ISA supported by the underlying Unicorn instance.
from qiling import Qiling
from qiling.arch.models import X86_CPU_MODEL

ql = Qiling(['my_program'], r'./examples/rootfs/x8664_linux', cputype=X86_CPU_MODEL.INTEL_SKYLAKE_CLIENT)
ql.run()

@elicn elicn requested review from xwings and wtdcode August 24, 2023 23:58
from typing import Union


class X86_CPU_MODEL(Enum):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to sync this automatically from Unicorn? Or is it blocked by #1629?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is unrelated.
I did consider building the enumeration in runtime through reflection / introspection but that would miss the point of simplifying the usage by enabling IDE hints: When the enumeration is available in editing time the IDE can assist with autocompletion and linting. If the enumeration is built in runtime, the IDE doesn't know what to expect there.

I agree that enumerating everything in runtime is more maintainable and elegant (?), but I think usability comes first. See a past PR with a similar idea that got rejected: #581

I think that the way it is now, backed up by tests, should cover the advantages of both methods.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would miss the point of simplifying the usage by enabling IDE hints

This can be done by adding the interfaces in unicorn. Like

def cpus() -> [CPU1|CPU2|CPU3]
     # auto generated enums
     return ....

I think that the way it is now, backed up by tests, should cover the advantages of both methods.

I agree. I'm also fine with this approach anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a toally different story.
Unicorn doesn't use Enums, only integer values, and could improve a lot if it goes that path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a toally different story. Unicorn doesn't use Enums, only integer values, and could improve a lot if it goes that path.

Cool, I will try to do that in 2.1.0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I planned on doing that at some point, but first I wanted to make sure I am not doing that for nothing. The original PR is pending for more than a year now..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for long delay as too many things happened last year. I promise that PR will go to 2.1.0 as I’m trying to work on it.

@xwings xwings merged commit 9b37c3b into qilingframework:dev Sep 26, 2023
5 checks passed
@elicn elicn deleted the periodic branch September 26, 2023 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants