mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
accel/tcg: Disconnect TargetPageDataNode from page size
Dynamically size the node for the runtime target page size. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com> Acked-by: Helge Deller <deller@gmx.de> Message-Id: <20240102015808.132373-29-richard.henderson@linaro.org>
This commit is contained in:
parent
8c45039f9e
commit
33402cea1f
1 changed files with 8 additions and 5 deletions
|
@ -864,7 +864,7 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, vaddr addr,
|
||||||
typedef struct TargetPageDataNode {
|
typedef struct TargetPageDataNode {
|
||||||
struct rcu_head rcu;
|
struct rcu_head rcu;
|
||||||
IntervalTreeNode itree;
|
IntervalTreeNode itree;
|
||||||
char data[TPD_PAGES][TARGET_PAGE_DATA_SIZE] __attribute__((aligned));
|
char data[] __attribute__((aligned));
|
||||||
} TargetPageDataNode;
|
} TargetPageDataNode;
|
||||||
|
|
||||||
static IntervalTreeRoot targetdata_root;
|
static IntervalTreeRoot targetdata_root;
|
||||||
|
@ -902,7 +902,8 @@ void page_reset_target_data(target_ulong start, target_ulong last)
|
||||||
n_last = MIN(last, n->last);
|
n_last = MIN(last, n->last);
|
||||||
p_len = (n_last + 1 - n_start) >> TARGET_PAGE_BITS;
|
p_len = (n_last + 1 - n_start) >> TARGET_PAGE_BITS;
|
||||||
|
|
||||||
memset(t->data[p_ofs], 0, p_len * TARGET_PAGE_DATA_SIZE);
|
memset(t->data + p_ofs * TARGET_PAGE_DATA_SIZE, 0,
|
||||||
|
p_len * TARGET_PAGE_DATA_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,7 +911,7 @@ void *page_get_target_data(target_ulong address)
|
||||||
{
|
{
|
||||||
IntervalTreeNode *n;
|
IntervalTreeNode *n;
|
||||||
TargetPageDataNode *t;
|
TargetPageDataNode *t;
|
||||||
target_ulong page, region;
|
target_ulong page, region, p_ofs;
|
||||||
|
|
||||||
page = address & TARGET_PAGE_MASK;
|
page = address & TARGET_PAGE_MASK;
|
||||||
region = address & TBD_MASK;
|
region = address & TBD_MASK;
|
||||||
|
@ -926,7 +927,8 @@ void *page_get_target_data(target_ulong address)
|
||||||
mmap_lock();
|
mmap_lock();
|
||||||
n = interval_tree_iter_first(&targetdata_root, page, page);
|
n = interval_tree_iter_first(&targetdata_root, page, page);
|
||||||
if (!n) {
|
if (!n) {
|
||||||
t = g_new0(TargetPageDataNode, 1);
|
t = g_malloc0(sizeof(TargetPageDataNode)
|
||||||
|
+ TPD_PAGES * TARGET_PAGE_DATA_SIZE);
|
||||||
n = &t->itree;
|
n = &t->itree;
|
||||||
n->start = region;
|
n->start = region;
|
||||||
n->last = region | ~TBD_MASK;
|
n->last = region | ~TBD_MASK;
|
||||||
|
@ -936,7 +938,8 @@ void *page_get_target_data(target_ulong address)
|
||||||
}
|
}
|
||||||
|
|
||||||
t = container_of(n, TargetPageDataNode, itree);
|
t = container_of(n, TargetPageDataNode, itree);
|
||||||
return t->data[(page - region) >> TARGET_PAGE_BITS];
|
p_ofs = (page - region) >> TARGET_PAGE_BITS;
|
||||||
|
return t->data + p_ofs * TARGET_PAGE_DATA_SIZE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void page_reset_target_data(target_ulong start, target_ulong last) { }
|
void page_reset_target_data(target_ulong start, target_ulong last) { }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue