Deleted Added
sdiff udiff text old ( 2680:246e7104f744 ) new ( 2684:71f3cabf891f )
full compact
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 33 unchanged lines hidden (view full) ---

42using namespace std;
43using namespace AlphaISA;
44
45ProcessInfo::ProcessInfo(ThreadContext *_tc)
46 : tc(_tc)
47{
48 Addr addr = 0;
49
50 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_size", addr))
51 panic("thread info not compiled into kernel\n");
52 thread_info_size = gtoh(tc->getVirtPort()->read<int32_t>(addr));
53
54 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_size", addr))
55 panic("thread info not compiled into kernel\n");
56 task_struct_size = gtoh(tc->getVirtPort()->read<int32_t>(addr));
57
58 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_task", addr))
59 panic("thread info not compiled into kernel\n");
60 task_off = gtoh(tc->getVirtPort()->read<int32_t>(addr));
61
62 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_pid", addr))
63 panic("thread info not compiled into kernel\n");
64 pid_off = gtoh(tc->getVirtPort()->read<int32_t>(addr));
65
66 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
67 panic("thread info not compiled into kernel\n");
68 name_off = gtoh(tc->getVirtPort()->read<int32_t>(addr));
69}
70
71Addr
72ProcessInfo::task(Addr ksp) const
73{
74 Addr base = ksp & ~0x3fff;
75 if (base == ULL(0xfffffc0000000000))
76 return 0;
77
78 return gtoh(tc->getVirtPort()->read<Addr>(base + task_off));
79}
80
81int
82ProcessInfo::pid(Addr ksp) const
83{
84 Addr task = this->task(ksp);
85 if (!task)
86 return -1;
87
88 return gtoh(tc->getVirtPort()->read<uint16_t>(task + pid_off));
89}
90
91string
92ProcessInfo::name(Addr ksp) const
93{
94 Addr task = this->task(ksp);
95 if (!task)
96 return "console";

--- 250 unchanged lines hidden ---