[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2] ioemu: Enable guest OS to program D0-D3hot states of an assigned device
On Thu, Feb 05, 2009 at 07:23:11PM +0900, Yuji Shimada wrote: > We can clean up the existing code in pass-through.c in the same > manner. I will submit the patch to clean up the code. Thank you for clean up. There are another logic duplications with mask operations. I suppose helper functions like the following will help to reduce the code more. thanks, static void __pt_read_{byte, word, long}(uint{8, 16, 32}_t *value, uint{8, 16, 32}_t dev_value, uint{8, 16, 32}_t emu_mask, uint{8, 16, 32}_t valid_mask) { uint{8, 16, 32}_t valid_emu_mask = emu_mask & valid_mask; *value = ((*value & ~valid_emu_mask) | (dev_data & valid_emu_mask)); } static void __pt_write_cfg_{byte, word, long}(struct pt_reg_tbl *cfg_entry, uint{8, 16, 32}_t value uint{8, 16, 32}_t emu_mask, uint{8, 16, 32}_t ro_mask, uint{8, 16, 32}_t valid_mask) { uint{8, 16, 32}_t writable_mask = emu_mask & ~ro_mask & valid_mask; cfg_entry->data = ((value & writable_mask) | (cfg_entry->data & ~writable_mask)); } static void __pt_write_{byte, word, long}(uint{8, 16, 32}_t *value, uint{8, 16, 32}_t dev_value, uint{8, 16, 32}_t emu_mask, uint{8, 16, 32}_t valid_mask) { uint{8, 16, 32}_t throughable_mask = ~emu_mask & valid_mask; *value = ((*value & throughable_mask) | (dev_value & ~throughable_mask)); } -- yamahata _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |