x86_machine.hpp
00001 #if !defined(__X86_MACHINE_HPP__)
00002 #define __X86_MACHINE_HPP__
00003
00004
00005
00006
00007 #include "core/machine/arch/x86/i440fx/i440fx_host_bridge.hpp"
00008 #include "core/machine/machine_base.hpp"
00009
00013 struct x86_machine : public machine_base
00014 {
00015 protected:
00019 static const struct initial_ioport_state
00020 {
00021 l4_port_t from, to;
00022 ioport_flags flags;
00023 } initial_iospace_state[];
00024
00028 static const struct initial_irq_state
00029 {
00030 l4_irq_t irq;
00031 irq_flags flags;
00032 } initial_irq_states[];
00033
00038 i440fx_host_bridge host_bridge;
00039
00040 public:
00041 x86_machine(void);
00042
00043
00044
00045
00046 int handle_io_page_fault(x86_context &ctx);
00047 int emulate_instruction(x86_context &ctx);
00048
00049 protected:
00050
00051
00052
00053 virtual int init_iospace(void);
00054 virtual int init_irqs(void);
00055
00056
00057
00058
00059 virtual inline const char *name(void) const
00060 {
00061 #if defined(ARCH_x86)
00062 return "x86 machine";
00063 #elif defined(ARCH_amd64)
00064 return "AMD64 machine";
00065 #endif
00066 }
00067
00068 virtual inline pci_bridge &get_host_bridge(void)
00069 {
00070 return host_bridge;
00071 }
00072 };
00073
00074
00075
00076
00077 #if L4VMM_BUILD_ENABLE_UDIS86
00078 #include "core/machine/arch/x86/io_page_fault_udis86.hpp"
00079 #else
00080 #include "core/machine/arch/x86/io_page_fault.hpp"
00081 #endif
00082
00083 inline int x86_machine::emulate_instruction(x86_context &ctx)
00084 {
00085 if (likely(ctx.is_io_page_fault()))
00086 return handle_io_page_fault(ctx);
00087
00088 if (config.is(L4VMM_INVALID_INSTRUCTION_WARNING))
00089 log::error("cannot handle instruction at "l4_gva_fmt":\n"
00090 " trapno: "l4_umword_fmt" err: "l4_umword_fmt"\n"
00091 " eflags: "l4_umword_fmt" pfa: "l4_umword_fmt"\n"
00092 " eax: "l4_umword_fmt" ebx: "l4_umword_fmt"\n"
00093 " ecx: "l4_umword_fmt" edx: "l4_umword_fmt"\n"
00094 " esi: "l4_umword_fmt" edi: "l4_umword_fmt"\n"
00095 " ebp: "l4_umword_fmt" esp: "l4_umword_fmt"\n"
00096 #if defined(ARCH_amd64)
00097 " r8: "l4_umword_fmt" r9: "l4_umword_fmt"\n"
00098 " r10: "l4_umword_fmt" r11: "l4_umword_fmt"\n"
00099 " r12: "l4_umword_fmt" r13: "l4_umword_fmt"\n"
00100 " r14: "l4_umword_fmt" r15: "l4_umword_fmt"\n"
00101 #endif
00102 ,
00103 ctx.eip(),
00104 ctx.trapno(), ctx.err(), ctx.eflags(), ctx.pfa(),
00105 ctx.eax(), ctx.ebx(), ctx.ecx(), ctx.edx(),
00106 ctx.esi(), ctx.edi(), ctx.ebp(), ctx.esp()
00107 #if defined(ARCH_amd64)
00108 ,
00109 ctx.r8(), ctx.r9(), ctx.r10(), ctx.r11(),
00110 ctx.r12(), ctx.r13(), ctx.r14(), ctx.r15()
00111 #endif
00112 );
00113
00114 return -L4_ENOTSUPP;
00115 }
00116
00117 #endif
00118
00119
00120