ACPI: Fix offsets when mapping I/O mem

Fixes #309
This commit is contained in:
Sebastian Sumpf 2012-08-17 15:19:01 +02:00 committed by Norman Feske
parent 9486022164
commit de5d5c2a1e
1 changed files with 6 additions and 2 deletions

View File

@ -127,7 +127,7 @@ class Table_wrapper
*/
void _map(size_t size)
{
_io_mem = new (env()->heap()) Io_mem_connection(_base, size + _offset());
_io_mem = new (env()->heap()) Io_mem_connection(_base - _offset(), size + _offset());
Io_mem_dataspace_capability io_ds = _io_mem->dataspace();
if (!io_ds.valid())
throw -1;
@ -206,7 +206,11 @@ class Table_wrapper
Table_wrapper(addr_t base)
: _base(base), _io_mem(0), _table(0)
{
_map(0x1000);
/*
* Try to map one page only, if table is on page boundary, map two pages
*/
size_t map_size = 0x1000 - _offset();
_map(map_size < 8 ? 0x1000 : map_size);
/* remap if table size is larger than current size */
if (_offset() + _table->size > 0x1000) {