Re: [PATCH v2] x86: reduce dependencies on x86_emulate/x86_emulate.h

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 12.08.2026 15:39, Andrew Cooper wrote:
> On 12/08/2026 2:24 pm, Jan Beulich wrote:
>> Split out struct x86_event to an entirely separate header, and move a few
>> other items describing the architecture to a new x86-types.h. With a few
>> forward decls of structures and with a fair number of new #include-s in
>> .c files, the inclusion of x86_emulate.h (and hence
>> x86_emulate/x86_emulate.h) can be dropped from all header files except
>> hvm/emulate.h; it needs additionally adding to hvm/ioreq.h though.
>>
>> Signed-off-by: Jan Beulich <[email protected]>
> 
> Reviewed-by: Andrew Cooper <[email protected]>

Thanks.

>> --- /dev/null
>> +++ b/xen/arch/x86/include/asm/x86-event.h
>> @@ -0,0 +1,31 @@
>> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>> +/*
>> + * x86-event.h
>> + *
>> + * Helper definitions for event handling, which aren't prescribed by the
>> + * architecture itself.
>> + */
>> +
>> +#ifndef X86_X86_EVENT_H
>> +#define X86_X86_EVENT_H
>> +
>> +#ifdef __XEN__
>> +# include <xen/types.h>
>> +#else
>> +# include <stdint.h>
>> +#endif
>> +
>> +#define X86_EVENT_NO_EC (-1)        /* No error code. */
>> +
>> +struct x86_event {
>> +    int16_t       vector;
>> +    uint8_t       type;         /* X86_ET_* */
>> +    uint8_t       insn_len;     /* Instruction length */
>> +    int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
>> +    union {
>> +        unsigned long cr2;         /* #PF */
>> +        unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity) */
> 
> With the advent of FRED, this probably wants to become event_data (or
> just data) and drop the union.
> 
> It's also the XFD_ERR mask for #NM, and the NMI Source Bitmap (on
> capable hardware), and I think we're better off pointing to the FRED
> spec than keeping an out-of-date list of what's in it.

Yes, perhaps that's going to be better.

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.