From: Avi Kivity <avi@qumranet.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: kvm-devel <kvm@vger.kernel.org>,
Mohammed Gamal <m.gamal005@gmail.com>,
Anthony Liguori <anthony@codemonkey.ws>,
Rik van Riel <riel@surriel.com>
Subject: Re: [PATCH 2/2] VMX: Reinject real mode exception
Date: Sun, 13 Jul 2008 18:28:38 +0300 [thread overview]
Message-ID: <487A1F26.7060700@qumranet.com> (raw)
In-Reply-To: <4879F4C0.1090609@web.de>
[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]
Jan Kiszka wrote:
> Avi Kivity wrote:
>
>> Jan Kiszka wrote:
>>
> ...
>
>>> @@ -2234,6 +2252,24 @@ static int handle_rmode_exception(struct
>>> if (((vec == GP_VECTOR) || (vec == SS_VECTOR)) && err_code == 0)
>>> if (emulate_instruction(vcpu, NULL, 0, 0, 0) == EMULATE_DONE)
>>> return 1;
>>> + /*
>>> + * Forward all other exceptions that are valid in real mode.
>>> + * FIXME: Breaks guest debugging in real mode, need to be fixed with
>>> + * the required debugging infrastructure rework.
>>> + */
>>> + switch (vec) {
>>> + case DF_VECTOR:
>>> + case SS_VECTOR:
>>> + case GP_VECTOR:
>>> + kvm_queue_exception_e(vcpu, vec, err_code);
>>>
>>>
>> These don't actually queue an error code in real mode. Compare the
>> 'Real-Address Mode Exceptions' section with the 'Protected Mode
>> Exceptions' section for most instructions in the Intel manual.
>>
>
> Unless you can points out a better reference, I prefer following chapter
> 5.15 of the System Programming Guide on this. And that one doesn't make
> a difference when it says, e.g., "Exception Error Code: Zero. The
> processor always pushes an error code of 0 onto the stack of the
> doublefault handler."
>
>
Well, xen and bochs do not push an error code for real mode #GP. I
tried running the attached test program but it doesn't work on real
hardware (it does work on bochs).
--
error compiling committee.c: too many arguments to function
[-- Attachment #2: Makefile --]
[-- Type: text/plain, Size: 327 bytes --]
all: real-mode-exception.iso
real-mode-exception.o: real-mode-exception.S
as -o $@ $^
real-mode-exception.boot: real-mode-exception.o real-mode-exception.ld
ld -T real-mode-exception.ld -o $@ real-mode-exception.o
dd < /dev/zero >> $@ count=2879
real-mode-exception.iso: real-mode-exception.boot
mkisofs -o $@ -b $^ $^
[-- Attachment #3: real-mode-exception.ld --]
[-- Type: text/plain, Size: 222 bytes --]
OUTPUT_FORMAT(binary)
SECTIONS
{
. = 0x7c00;
stext = .;
.text : { *(.init) *(.text) }
. = ALIGN(4K);
.data : { *(.data) }
. = ALIGN(16);
.bss : { *(.bss) }
. = ALIGN(4K);
edata = .;
}
[-- Attachment #4: real-mode-exception.S --]
[-- Type: text/plain, Size: 396 bytes --]
.code16
start:
ljmp $0, $restart
restart:
mov $0x39, %al
mov $10, %ah
mov $0, %bx
mov $20, %cx
int $0x10
mov $0, %ax
mov %ax, %ds
movw $gp_handler, 13*4
mov %cs, 13*4+2
mov %sp, %dx
addr32 testb $0, 0x100000
loop: jmp loop
gp_handler:
sub %sp, %dx
shr $1, %dx
add $48, %dl
mov %dl, %al
mov $10, %ah
mov $0, %bx
mov $10, %cx
int $0x10
jmp loop
. = 0x1fe
.byte 0x55, 0xaa
next prev parent reply other threads:[~2008-07-13 15:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-13 11:40 [PATCH 2/2] VMX: Reinject real mode exception Jan Kiszka
2008-07-13 12:06 ` Avi Kivity
2008-07-13 12:27 ` Jan Kiszka
2008-07-13 15:28 ` Avi Kivity [this message]
2008-07-13 15:31 ` Avi Kivity
2008-07-13 18:47 ` Nakajima, Jun
2008-07-13 19:22 ` Mohammed Gamal
2008-07-14 10:04 ` Avi Kivity
2008-07-14 10:28 ` Jan Kiszka
2008-07-14 11:30 ` Avi Kivity
2008-07-14 16:00 ` Nakajima, Jun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=487A1F26.7060700@qumranet.com \
--to=avi@qumranet.com \
--cc=anthony@codemonkey.ws \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=m.gamal005@gmail.com \
--cc=riel@surriel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox