* [Qemu-devel] [Bug 1809144] [NEW] SVM instructions fail with SVME bit enabled
@ 2018-12-19 17:31 Paolo Montesel
2018-12-19 18:14 ` Richard Henderson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Paolo Montesel @ 2018-12-19 17:31 UTC (permalink / raw)
To: qemu-devel
Public bug reported:
I was trying to use QEMU/TCG to emulate some stuff that uses SVM.
I know SVM is only partially implemented but I gave it a try anyway.
I found that if SVM is enabled in the same basic block in which there's a call to VMSAVE/etc,
the call fails as illegal op because the flags don't get updated correctly.
The pseudocode for the asm I'm running is:
```
EFER |= SVME; set the appropriate bit with wrmsr
vmsave
```
This is an example of the relevant translate.c code:
```
if (!(s->flags & HF_SVME_MASK) || !s->pe) {
goto illegal_op;
}
if (s->cpl != 0) {
gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
break;
}
```
s->flags doesn't get updated after the wrmsr instruction and so QEMU
raises an illegal opcode interrupt.
A quick fix is to make the tb end after `wrmsr` instructions, but it's an hack afaik.
I'm not too comfortable with QEMU's code, so I don't know what a proper fix would be.
Cheers,
thebabush
** Affects: qemu
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1809144
Title:
SVM instructions fail with SVME bit enabled
Status in QEMU:
New
Bug description:
I was trying to use QEMU/TCG to emulate some stuff that uses SVM.
I know SVM is only partially implemented but I gave it a try anyway.
I found that if SVM is enabled in the same basic block in which there's a call to VMSAVE/etc,
the call fails as illegal op because the flags don't get updated correctly.
The pseudocode for the asm I'm running is:
```
EFER |= SVME; set the appropriate bit with wrmsr
vmsave
```
This is an example of the relevant translate.c code:
```
if (!(s->flags & HF_SVME_MASK) || !s->pe) {
goto illegal_op;
}
if (s->cpl != 0) {
gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
break;
}
```
s->flags doesn't get updated after the wrmsr instruction and so QEMU
raises an illegal opcode interrupt.
A quick fix is to make the tb end after `wrmsr` instructions, but it's an hack afaik.
I'm not too comfortable with QEMU's code, so I don't know what a proper fix would be.
Cheers,
thebabush
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1809144/+subscriptions
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [Bug 1809144] [NEW] SVM instructions fail with SVME bit enabled
2018-12-19 17:31 [Qemu-devel] [Bug 1809144] [NEW] SVM instructions fail with SVME bit enabled Paolo Montesel
@ 2018-12-19 18:14 ` Richard Henderson
2021-04-20 7:57 ` [Bug 1809144] " Thomas Huth
2021-06-20 4:17 ` Launchpad Bug Tracker
2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2018-12-19 18:14 UTC (permalink / raw)
To: Bug 1809144, qemu-devel
On 12/19/18 9:31 AM, Paolo Montesel wrote:
> A quick fix is to make the tb end after `wrmsr` instructions, but it's an hack afaik.
No, that's exactly the correct solution.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug 1809144] Re: SVM instructions fail with SVME bit enabled
2018-12-19 17:31 [Qemu-devel] [Bug 1809144] [NEW] SVM instructions fail with SVME bit enabled Paolo Montesel
2018-12-19 18:14 ` Richard Henderson
@ 2021-04-20 7:57 ` Thomas Huth
2021-06-20 4:17 ` Launchpad Bug Tracker
2 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2021-04-20 7:57 UTC (permalink / raw)
To: qemu-devel
The QEMU project is currently considering to move its bug tracking to another system. For this we need to know which bugs are still valid and which could be closed already. Thus we are setting older bugs to "Incomplete" now.
If you still think this bug report here is valid, then please switch the state back to "New" within the next 60 days, otherwise this report will be marked as "Expired". Or mark it as "Fix Released" if the problem has been solved with a newer version of QEMU already. Thank you and sorry for the inconvenience.
** Changed in: qemu
Status: New => Incomplete
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1809144
Title:
SVM instructions fail with SVME bit enabled
Status in QEMU:
Incomplete
Bug description:
I was trying to use QEMU/TCG to emulate some stuff that uses SVM.
I know SVM is only partially implemented but I gave it a try anyway.
I found that if SVM is enabled in the same basic block in which there's a call to VMSAVE/etc,
the call fails as illegal op because the flags don't get updated correctly.
The pseudocode for the asm I'm running is:
```
EFER |= SVME; set the appropriate bit with wrmsr
vmsave
```
This is an example of the relevant translate.c code:
```
if (!(s->flags & HF_SVME_MASK) || !s->pe) {
goto illegal_op;
}
if (s->cpl != 0) {
gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
break;
}
```
s->flags doesn't get updated after the wrmsr instruction and so QEMU
raises an illegal opcode interrupt.
A quick fix is to make the tb end after `wrmsr` instructions, but it's an hack afaik.
I'm not too comfortable with QEMU's code, so I don't know what a proper fix would be.
Cheers,
thebabush
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1809144/+subscriptions
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug 1809144] Re: SVM instructions fail with SVME bit enabled
2018-12-19 17:31 [Qemu-devel] [Bug 1809144] [NEW] SVM instructions fail with SVME bit enabled Paolo Montesel
2018-12-19 18:14 ` Richard Henderson
2021-04-20 7:57 ` [Bug 1809144] " Thomas Huth
@ 2021-06-20 4:17 ` Launchpad Bug Tracker
2 siblings, 0 replies; 4+ messages in thread
From: Launchpad Bug Tracker @ 2021-06-20 4:17 UTC (permalink / raw)
To: qemu-devel
[Expired for QEMU because there has been no activity for 60 days.]
** Changed in: qemu
Status: Incomplete => Expired
--
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1809144
Title:
SVM instructions fail with SVME bit enabled
Status in QEMU:
Expired
Bug description:
I was trying to use QEMU/TCG to emulate some stuff that uses SVM.
I know SVM is only partially implemented but I gave it a try anyway.
I found that if SVM is enabled in the same basic block in which there's a call to VMSAVE/etc,
the call fails as illegal op because the flags don't get updated correctly.
The pseudocode for the asm I'm running is:
```
EFER |= SVME; set the appropriate bit with wrmsr
vmsave
```
This is an example of the relevant translate.c code:
```
if (!(s->flags & HF_SVME_MASK) || !s->pe) {
goto illegal_op;
}
if (s->cpl != 0) {
gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
break;
}
```
s->flags doesn't get updated after the wrmsr instruction and so QEMU
raises an illegal opcode interrupt.
A quick fix is to make the tb end after `wrmsr` instructions, but it's an hack afaik.
I'm not too comfortable with QEMU's code, so I don't know what a proper fix would be.
Cheers,
thebabush
To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1809144/+subscriptions
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-06-20 4:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19 17:31 [Qemu-devel] [Bug 1809144] [NEW] SVM instructions fail with SVME bit enabled Paolo Montesel
2018-12-19 18:14 ` Richard Henderson
2021-04-20 7:57 ` [Bug 1809144] " Thomas Huth
2021-06-20 4:17 ` Launchpad Bug Tracker
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.