2 * Kernel-based Virtual Machine test driver
4 * This test driver provides a simple way of testing kvm, without a full
7 * Copyright (C) 2006 Qumranet
11 * Avi Kivity <avi@qumranet.com>
12 * Yaniv Kamay <yaniv@qumranet.com>
14 * This work is licensed under the GNU LGPL license, version 2.
23 struct io_table_entry
*io_table_lookup(struct io_table
*io_table
, uint64_t addr
)
27 for (i
= 0; i
< io_table
->nr_entries
; i
++) {
28 if (io_table
->entries
[i
].start
<= addr
&&
29 addr
< io_table
->entries
[i
].end
)
30 return &io_table
->entries
[i
];
36 int io_table_register(struct io_table
*io_table
, uint64_t start
, uint64_t size
,
37 io_table_handler_t
*handler
, void *opaque
)
39 struct io_table_entry
*entry
;
41 if (io_table
->nr_entries
== MAX_IO_TABLE
)
44 entry
= &io_table
->entries
[io_table
->nr_entries
];
45 io_table
->nr_entries
++;
48 entry
->end
= start
+ size
;
49 entry
->handler
= handler
;
50 entry
->opaque
= opaque
;