summaryrefslogtreecommitdiff
path: root/src/arch/generic/linux/threadinfo.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/generic/linux/threadinfo.hh')
-rw-r--r--src/arch/generic/linux/threadinfo.hh43
1 files changed, 13 insertions, 30 deletions
diff --git a/src/arch/generic/linux/threadinfo.hh b/src/arch/generic/linux/threadinfo.hh
index 1595da499..626de58e8 100644
--- a/src/arch/generic/linux/threadinfo.hh
+++ b/src/arch/generic/linux/threadinfo.hh
@@ -58,9 +58,7 @@ class ThreadInfo
return false;
}
- CopyOut(tc, &data, addr, sizeof(T));
-
- data = TheISA::gtoh(data);
+ data = tc->getVirtProxy().read<T>(addr, TheISA::GuestByteOrder);
return true;
}
@@ -98,29 +96,23 @@ class ThreadInfo
// Note that in Linux 4.10 the thread_info struct will no longer have a
// pointer to the task_struct for arm64. See:
// https://patchwork.kernel.org/patch/9333699/
- int32_t offset;
+ int32_t offset = 0;
if (!get_data("thread_info_task", offset))
return 0;
if (!thread_info)
thread_info = curThreadInfo();
- Addr addr;
- CopyOut(tc, &addr, thread_info + offset, sizeof(addr));
-
- return addr;
+ return tc->getVirtProxy().read<Addr>(thread_info + offset);
}
int32_t
curTaskPIDFromTaskStruct(Addr task_struct) {
- int32_t offset;
+ int32_t offset = 0;
if (!get_data("task_struct_pid", offset))
return -1;
- int32_t pid;
- CopyOut(tc, &pid, task_struct + offset, sizeof(pid));
-
- return pid;
+ return tc->getVirtProxy().read<int32_t>(task_struct + offset);
}
int32_t
@@ -132,14 +124,11 @@ class ThreadInfo
int32_t
curTaskTGIDFromTaskStruct(Addr task_struct)
{
- int32_t offset;
+ int32_t offset = 0;
if (!get_data("task_struct_tgid", offset))
return -1;
- int32_t tgid;
- CopyOut(tc, &tgid, task_struct + offset, sizeof(tgid));
-
- return tgid;
+ return tc->getVirtProxy().read<int32_t>(task_struct + offset);
}
int32_t
@@ -151,16 +140,13 @@ class ThreadInfo
int64_t
curTaskStartFromTaskStruct(Addr task_struct)
{
- int32_t offset;
+ int32_t offset = 0;
if (!get_data("task_struct_start_time", offset))
return -1;
- int64_t data;
// start_time is actually of type timespec, but if we just
// grab the first long, we'll get the seconds out of it
- CopyOut(tc, &data, task_struct + offset, sizeof(data));
-
- return data;
+ return tc->getVirtProxy().read<int64_t>(task_struct + offset);
}
int64_t
@@ -172,8 +158,8 @@ class ThreadInfo
std::string
curTaskNameFromTaskStruct(Addr task_struct)
{
- int32_t offset;
- int32_t size;
+ int32_t offset = 0;
+ int32_t size = 0;
if (!get_data("task_struct_comm", offset))
return "FailureIn_curTaskName";
@@ -182,7 +168,7 @@ class ThreadInfo
return "FailureIn_curTaskName";
char buffer[size + 1];
- CopyStringOut(tc, buffer, task_struct + offset, size);
+ tc->getVirtProxy().readString(buffer, task_struct + offset, size);
return buffer;
}
@@ -200,10 +186,7 @@ class ThreadInfo
if (!get_data("task_struct_mm", offset))
return -1;
- int32_t mm_ptr;
- CopyOut(tc, &mm_ptr, task_struct + offset, sizeof(mm_ptr));
-
- return mm_ptr;
+ return tc->getVirtProxy().read<int32_t>(task_struct + offset);
}
int32_t