stacktrace.cc (8706:b1838faf3bcc) stacktrace.cc (8852:c744483edfcf)
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;

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

43using namespace std;
44namespace X86ISA
45{
46 ProcessInfo::ProcessInfo(ThreadContext *_tc)
47 : tc(_tc)
48 {
49 Addr addr = 0;
50
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;

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

43using namespace std;
44namespace X86ISA
45{
46 ProcessInfo::ProcessInfo(ThreadContext *_tc)
47 : tc(_tc)
48 {
49 Addr addr = 0;
50
51 FSTranslatingPortProxy* vp;
51 FSTranslatingPortProxy &vp = tc->getVirtProxy();
52
52
53 vp = tc->getVirtProxy();
54
55 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_size", addr))
56 panic("thread info not compiled into kernel\n");
53 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_size", addr))
54 panic("thread info not compiled into kernel\n");
57 thread_info_size = vp->readGtoH<int32_t>(addr);
55 thread_info_size = vp.readGtoH<int32_t>(addr);
58
59 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_size", addr))
60 panic("thread info not compiled into kernel\n");
56
57 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_size", addr))
58 panic("thread info not compiled into kernel\n");
61 task_struct_size = vp->readGtoH<int32_t>(addr);
59 task_struct_size = vp.readGtoH<int32_t>(addr);
62
63 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_task", addr))
64 panic("thread info not compiled into kernel\n");
60
61 if (!tc->getSystemPtr()->kernelSymtab->findAddress("thread_info_task", addr))
62 panic("thread info not compiled into kernel\n");
65 task_off = vp->readGtoH<int32_t>(addr);
63 task_off = vp.readGtoH<int32_t>(addr);
66
67 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_pid", addr))
68 panic("thread info not compiled into kernel\n");
64
65 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_pid", addr))
66 panic("thread info not compiled into kernel\n");
69 pid_off = vp->readGtoH<int32_t>(addr);
67 pid_off = vp.readGtoH<int32_t>(addr);
70
71 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
72 panic("thread info not compiled into kernel\n");
68
69 if (!tc->getSystemPtr()->kernelSymtab->findAddress("task_struct_comm", addr))
70 panic("thread info not compiled into kernel\n");
73 name_off = vp->readGtoH<int32_t>(addr);
71 name_off = vp.readGtoH<int32_t>(addr);
74 }
75
76 Addr
77 ProcessInfo::task(Addr ksp) const
78 {
79 Addr base = ksp & ~0x3fff;
80 if (base == ULL(0xfffffc0000000000))
81 return 0;
82
83 Addr tsk;
84
72 }
73
74 Addr
75 ProcessInfo::task(Addr ksp) const
76 {
77 Addr base = ksp & ~0x3fff;
78 if (base == ULL(0xfffffc0000000000))
79 return 0;
80
81 Addr tsk;
82
85 FSTranslatingPortProxy* vp;
83 FSTranslatingPortProxy &vp = tc->getVirtProxy();
84 tsk = vp.readGtoH<Addr>(base + task_off);
86
85
87 vp = tc->getVirtProxy();
88 tsk = vp->readGtoH<Addr>(base + task_off);
89
90 return tsk;
91 }
92
93 int
94 ProcessInfo::pid(Addr ksp) const
95 {
96 Addr task = this->task(ksp);
97 if (!task)
98 return -1;
99
100 uint16_t pd;
101
86 return tsk;
87 }
88
89 int
90 ProcessInfo::pid(Addr ksp) const
91 {
92 Addr task = this->task(ksp);
93 if (!task)
94 return -1;
95
96 uint16_t pd;
97
102 FSTranslatingPortProxy* vp;
98 FSTranslatingPortProxy &vp = tc->getVirtProxy();
99 pd = vp.readGtoH<uint16_t>(task + pid_off);
103
100
104 vp = tc->getVirtProxy();
105 pd = vp->readGtoH<uint16_t>(task + pid_off);
106
107 return pd;
108 }
109
110 string
111 ProcessInfo::name(Addr ksp) const
112 {
113 Addr task = this->task(ksp);
114 if (!task)

--- 113 unchanged lines hidden ---
101 return pd;
102 }
103
104 string
105 ProcessInfo::name(Addr ksp) const
106 {
107 Addr task = this->task(ksp);
108 if (!task)

--- 113 unchanged lines hidden ---