Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

MacOS support #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

MacOS support #288

wants to merge 1 commit into from

Conversation

nevilad
Copy link
Contributor

@nevilad nevilad commented Apr 9, 2020

Added MacOS support. Please don't merge this PR yet, since it should be modified according last changes it haxm (cpuid feature setting addition).
Tested it on windows host with image from #149. It runs but ends in a damaged disk error window. Same with qemu+tcg, so this looks like installation iso issue, at least on my host.
MacOS can read/write different MSRs in different runs, when some MSR is not emulated, the guest crashes. To debug this, I've added logging of accesses to these MSRs. When you encounter crashes, look to the log.
MacOS writes data to UEFI vars flash. When these are written wrong (due to unexpected halt etc.), you may encounter display issues. The first sign of these is that the apple in not in the center of the monitor. In such a case restore UEFI vars flash to it's original file.
This qemu patch is needed to support UEFI in qemu for hax:
0001-Add-support-for-ROMD-regions-for-hax.patch.txt

Signed-off-by: Alexey Romko <nevilad@yahoo.com>
@@ -448,7 +448,7 @@ struct vcpu_t *vcpu_create(struct vm_t *vm, void *vm_host, int vcpu_id)
sizeof(struct vcpu_state_t), HAX_MEM_NONPAGE);
if (!vcpu->state)
goto fail_4;
memset(vcpu->state, 0, sizeof(struct vcpu_state_t));
memset(vcpu->state, 0, sizeof(struct vcpu_state_t)); //cr8 = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is unclear (without looking at the whole commit).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will remove it in the final version. This is the place where cr8 is initialized. I used it to analyze the cr8 support feature.

@wcwang
Copy link
Contributor

wcwang commented Apr 23, 2020

@nevilad, could you help to rebase the commit onto the latest release version so that it can be tested on macOS? Thanks.

@nevilad
Copy link
Contributor Author

nevilad commented Apr 23, 2020

This PR is not ready! I'm waiting for my set_cpuid feature, so the user can set Penryn cpu. Now it's hardcoded in this line:
state->_eax = 0x10673; //Penryn
Another thing is IA32_PERF_STATUS. I think it would be better to return as bus ratio part of the MSR the value from the underlying hardware, if it is new and contains this data in this MSR.

When you wan't check cr8 impact on booting empty multicore guests on MacOS, it is OK to test on this code, without latest changes from master.

@HaxmCI HaxmCI added CI:Build Pass CI:Build Pass CI:Mac Test Pass CI:Mac Test Pass and removed CI:Build Fail CI:Build Fail labels Mar 2, 2021
@HaxmCI HaxmCI added CI:Build Fail CI:Build Fail and removed CI:Build Pass CI:Build Pass CI:Mac Test Pass CI:Mac Test Pass labels May 24, 2021
@wcwang wcwang force-pushed the master branch 2 times, most recently from 563eb1b to 6b942e3 Compare November 25, 2022 03:23
@wcwang wcwang force-pushed the master branch 2 times, most recently from b73a231 to da1b8ec Compare January 26, 2023 02:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI:Build Fail CI:Build Fail
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants