vancouver: coding style

This commit is contained in:
Norman Feske 2013-02-13 13:01:34 +01:00
parent b0d23abaa7
commit 4b8f991f52

View File

@ -97,7 +97,7 @@ volatile bool console_init = false;
volatile bool disk_init = false; volatile bool disk_init = false;
/* Timer Service */ /* timer service */
using Genode::Thread; using Genode::Thread;
using Genode::Alarm_scheduler; using Genode::Alarm_scheduler;
using Genode::Alarm; using Genode::Alarm;
@ -240,7 +240,6 @@ class Guest_memory
((Genode::addr_t) _local_addr)+backing_store_size-fb_size); ((Genode::addr_t) _local_addr)+backing_store_size-fb_size);
} catch (Genode::Rm_session::Region_conflict) { } } catch (Genode::Rm_session::Region_conflict) { }
} }
~Guest_memory() ~Guest_memory()
@ -277,8 +276,9 @@ class Guest_memory
Genode::Dataspace_capability fb_ds() { return _fb_ds; } Genode::Dataspace_capability fb_ds() { return _fb_ds; }
}; };
class Vcpu_thread : Genode::Thread<STACK_SIZE> {
class Vcpu_thread : Genode::Thread<STACK_SIZE>
{
private: private:
/** /**
@ -338,12 +338,12 @@ class Vcpu_thread : Genode::Thread<STACK_SIZE> {
if (!ec_cap.valid() || sel_ec != ec_cap.local_name()) if (!ec_cap.valid() || sel_ec != ec_cap.local_name())
Logging::panic("Could not collocate EC cap"); Logging::panic("Could not collocate EC cap");
} }
void entry() { } void entry() { }
}; };
class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>, class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
public StaticReceiver<Vcpu_dispatcher> public StaticReceiver<Vcpu_dispatcher>
{ {
@ -561,10 +561,12 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
if (utcb->inj_info & 0x80000000) { if (utcb->inj_info & 0x80000000) {
utcb->mtd |= MTD_INJ; utcb->mtd |= MTD_INJ;
Logging::printf("EPT violation during IDT vectoring.\n"); Logging::printf("EPT violation during IDT vectoring.\n");
CpuMessage _win(CpuMessage::TYPE_CALC_IRQWINDOW, static_cast<CpuState *>(utcb), utcb->mtd); CpuMessage _win(CpuMessage::TYPE_CALC_IRQWINDOW,
static_cast<CpuState *>(utcb), utcb->mtd);
_win.mtr_out = MTD_INJ; _win.mtr_out = MTD_INJ;
if (!_vcpu->executor.send(_win, true)) if (!_vcpu->executor.send(_win, true))
Logging::panic("nobody to execute %s at %x:%x\n", __func__, utcb->cs.sel, utcb->eip); Logging::panic("nobody to execute %s at %x:%x\n",
__func__, utcb->cs.sel, utcb->eip);
} }
Nova::Utcb * u = (Nova::Utcb *)utcb; Nova::Utcb * u = (Nova::Utcb *)utcb;
@ -582,12 +584,14 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
is_in, io_order, port); is_in, io_order, port);
Utcb *utcb = _utcb_of_myself(); Utcb *utcb = _utcb_of_myself();
CpuMessage msg(is_in, static_cast<CpuState *>(utcb), io_order, port, &utcb->eax, utcb->mtd); CpuMessage msg(is_in, static_cast<CpuState *>(utcb), io_order,
port, &utcb->eax, utcb->mtd);
_skip_instruction(msg); _skip_instruction(msg);
{ {
Genode::Lock::Guard l(global_lock); Genode::Lock::Guard l(global_lock);
if (!_vcpu->executor.send(msg, true)) if (!_vcpu->executor.send(msg, true))
Logging::panic("nobody to execute %s at %x:%x\n", __func__, msg.cpu->cs.sel, msg.cpu->eip); Logging::panic("nobody to execute %s at %x:%x\n",
__func__, msg.cpu->cs.sel, msg.cpu->eip);
} }
utcb->mtd = msg.mtr_out; utcb->mtd = msg.mtr_out;
@ -694,7 +698,8 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
void _vmx_pause() void _vmx_pause()
{ {
Utcb *utcb = _utcb_of_myself(); Utcb *utcb = _utcb_of_myself();
CpuMessage msg(CpuMessage::TYPE_SINGLE_STEP, static_cast<CpuState *>(utcb), utcb->mtd); CpuMessage msg(CpuMessage::TYPE_SINGLE_STEP,
static_cast<CpuState *>(utcb), utcb->mtd);
_skip_instruction(msg); _skip_instruction(msg);
} }
@ -741,7 +746,6 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
if (!_handle_map_memory(utcb->qual[0] & 0x38)) if (!_handle_map_memory(utcb->qual[0] & 0x38))
/* this is an access to MMIO */ /* this is an access to MMIO */
_handle_vcpu(NO_SKIP, CpuMessage::TYPE_SINGLE_STEP); _handle_vcpu(NO_SKIP, CpuMessage::TYPE_SINGLE_STEP);
} }
void _vmx_cpuid() void _vmx_cpuid()
@ -800,11 +804,9 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
Native_capability thread(tid().ec_sel); Native_capability thread(tid().ec_sel);
Native_capability handler = Native_capability handler =
_cap_session.alloc(thread, (Nova::mword_t)portal_entry, _cap_session.alloc(thread, (Nova::mword_t)portal_entry, mtd.value());
mtd.value());
if (!handler.valid() || if (!handler.valid() || exc_base + EV != handler.local_name())
exc_base + EV != handler.local_name())
Logging::panic("Could not get EC cap"); Logging::panic("Could not get EC cap");
} }
@ -871,6 +873,7 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
Mtd const mtd_all(Mtd::ALL); Mtd const mtd_all(Mtd::ALL);
Mtd const mtd_cpuid(Mtd::EIP | Mtd::ACDB | Mtd::IRQ); Mtd const mtd_cpuid(Mtd::EIP | Mtd::ACDB | Mtd::IRQ);
Mtd const mtd_irq(Mtd::IRQ); Mtd const mtd_irq(Mtd::IRQ);
/* /*
* Register vCPU event handlers * Register vCPU event handlers
*/ */
@ -996,8 +999,10 @@ class Vcpu_dispatcher : public Genode::Thread<STACK_SIZE>,
} }
}; };
const void * _forward_pkt; const void * _forward_pkt;
class Machine : public StaticReceiver<Machine> class Machine : public StaticReceiver<Machine>
{ {
private: private:
@ -1215,7 +1220,7 @@ class Machine : public StaticReceiver<Machine>
((Genode::uint64_t)_nic->mac_address().addr[4] & 0xff) << 8 | ((Genode::uint64_t)_nic->mac_address().addr[4] & 0xff) << 8 |
((Genode::uint64_t)_nic->mac_address().addr[5] & 0xff); ((Genode::uint64_t)_nic->mac_address().addr[5] & 0xff);
/* Start receiver thread for this MAC */ /* start receiver thread for this MAC */
Vancouver_network * netreceiver = new Vancouver_network(_motherboard, _nic); Vancouver_network * netreceiver = new Vancouver_network(_motherboard, _nic);
return true; return true;
@ -1502,14 +1507,12 @@ class Machine : public StaticReceiver<Machine>
} }
}; };
extern unsigned long _prog_img_beg; /* begin of program image (link address) */ extern unsigned long _prog_img_beg; /* begin of program image (link address) */
extern unsigned long _prog_img_end; /* end of program image */ extern unsigned long _prog_img_end; /* end of program image */
namespace Genode { namespace Genode { Rm_session *env_context_area_rm_session(); }
Rm_session *env_context_area_rm_session();
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
@ -1575,14 +1578,15 @@ int main(int argc, char **argv)
static Machine machine(boot_modules, guest_memory); static Machine machine(boot_modules, guest_memory);
/* Create Console Thread */ /* create console thread */
Vancouver_console vcon(machine.get_mb(), fb_size, guest_memory.fb_ds()); Vancouver_console vcon(machine.get_mb(), fb_size, guest_memory.fb_ds());
/* Create Disk Thread */ /* create disk thread */
Vancouver_disk vdisk(machine.get_mb(), guest_memory.backing_store_local_base(), Vancouver_disk vdisk(machine.get_mb(),
guest_memory.backing_store_local_base(),
guest_memory.backing_store_fb_local_base()); guest_memory.backing_store_fb_local_base());
/* Wait for services */ /* wait for services */
while (!console_init || !disk_init); while (!console_init || !disk_init);
machine.setup_devices(Genode::config()->xml_node().sub_node("machine")); machine.setup_devices(Genode::config()->xml_node().sub_node("machine"));