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

AVR support #2021

Open
wants to merge 31 commits into
base: dev
Choose a base branch
from
Open

Conversation

glennsec
Copy link

@glennsec glennsec commented Oct 2, 2024

Hi, this adds support for AVR (#939), while keeping XMEGA bits (with DES instruction) currently separate. This PR is rebased against the current dev branch, while original support was developed and more thoroughly tested against unicorn 2.0.x.

break;

// Initialize registers
uint8_t regs[32];
Copy link
Member

Choose a reason for hiding this comment

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

please move all the variable declaration to the beginning of the function

Copy link
Author

Choose a reason for hiding this comment

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

done

@aquynh
Copy link
Member

aquynh commented Oct 3, 2024

Thanks for the contribution!

  • please update README to add this new architecture.
  • please add your name to CREDITS.TXT.

@aquynh
Copy link
Member

aquynh commented Oct 3, 2024

can you look at the issues of the CI?

@bet4it
Copy link
Contributor

bet4it commented Oct 3, 2024

You need to add Rust bindings manually😅

@glennsec
Copy link
Author

glennsec commented Oct 9, 2024

Thanks for the contribution!

  • please update README to add this new architecture.
  • please add your name to CREDITS.TXT.

done

@glennsec
Copy link
Author

glennsec commented Oct 9, 2024

can you look at the issues of the CI?

Fixed all of those except arm64 & ppc64 failures. The arm64 bits may be fixed by #1935 ?

@wtdcode
Copy link
Member

wtdcode commented Oct 10, 2024

can you look at the issues of the CI?

Fixed all of those except arm64 & ppc64 failures. The arm64 bits may be fixed by #1935 ?

There are also macos failures.

@glennsec
Copy link
Author

can you look at the issues of the CI?

Fixed all of those except arm64 & ppc64 failures. The arm64 bits may be fixed by #1935 ?

There are also macos failures.

Hi, this is related to the tcg/aarch64 backend issue mentioned in #1908 with proposed fix in #1935. I have another patch suggestion that fixes the issue, as you can see in the last CI run at https://github.com/glennsec/unicorn/actions/runs/11298077207
(still, ppc64 needs similar treatment).

@glennsec
Copy link
Author

See #2028. Feel free to integrate whichever (vs. #1935) suits you best. Thanks.

Directly jump into the slow path when there is any hookmem enabled. This
fixes unicorn-engine#1908.

Signed-off-by: Glenn Baker <[email protected]>
Directly jump into the slow path when there is any hookmem enabled.

Signed-off-by: Glenn Baker <[email protected]>
@glennsec
Copy link
Author

See #2028. Feel free to integrate whichever (vs. #1935) suits you best. Thanks.

@wtdcode : I have updated the branch against #1935 (which applies on top of current dev branch) to include aarch64 & ppc64 fixes. Thanks.

@wtdcode
Copy link
Member

wtdcode commented Oct 22, 2024

See #2028. Feel free to integrate whichever (vs. #1935) suits you best. Thanks.

@wtdcode : I have updated the branch against #1935 (which applies on top of current dev branch) to include aarch64 & ppc64 fixes. Thanks.

I will have a check this week.

glennsec and others added 14 commits October 22, 2024 16:26
Use has_hookmem() helper to determine wether "slow-path" TLB read is
needed. Add this helper to x86 architecture as well so that to check for
all hookmem.

Signed-off-by: Glenn Baker <[email protected]>
It's the same implementation for all architectures, so factor out
has_hookmem() into tcg_uc_has_hookmem().

Signed-off-by: Glenn Baker <[email protected]>
Add AVR related definitions into QEMU, make AVR support buildable.

[AM: Remove word 'Atmel' from filenames and all elements of code]
Suggested-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Michael Rolnik <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
Message-Id: <[email protected]>
[PMD: Fixed @avr tag in qapi/machine.json]
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>

(cherry picked from commit 42f3ff001339e37df4f13b709d2db00a488ee45c)
Signed-off-by: Glenn Baker <[email protected]>
Signed-off-by: Glenn Baker <[email protected]>
This is needed because the AVR CPU has separate code and data address
spaces that both start from zero. Use 0x08000000 base for Flash memory
and 0x00000000 base for CPU registers, IO registers and SRAM as the
fast case.

Signed-off-by: Glenn Baker <[email protected]>
Separate AVR architectures ("avr5", "avr51", "avr6", etc.) from actual
MCU models. Only list the most representative MCU models.

Signed-off-by: Glenn Baker <[email protected]>
Signed-off-by: Glenn Baker <[email protected]>
Signed-off-by: Glenn Baker <[email protected]>
Signed-off-by: Glenn Baker <[email protected]>
@in7egral
Copy link

I'm looking forward for this PR, as my idaemu fork will be redesigned soon, and I wish to add AVR as well.

@aquynh @wtdcode what's have to be done for merge?

@wtdcode
Copy link
Member

wtdcode commented Nov 11, 2024

I'm looking forward for this PR, as my idaemu fork will be redesigned soon, and I wish to add AVR as well.

@aquynh @wtdcode what's have to be done for merge?

Thanks for reaching out. Unfortunately I'm getting sick recently. Please allow me a few days before coming back.

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.

6 participants