summaryrefslogtreecommitdiff
path: root/Userland/DevTools/Profiler
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-07-20 13:40:35 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-20 15:12:19 +0200
commit60b52cfb02a9a0a4e844f11c186e8b61eaa158ac (patch)
tree1005a659c5658f91d7347df852457b1cf62c24eb /Userland/DevTools/Profiler
parent4fdee56ba35b7d42ed8f729ec60ebbec86adbf5f (diff)
downloadserenity-60b52cfb02a9a0a4e844f11c186e8b61eaa158ac.zip
Userland: Hardcode the x86_64 kernel base address for now
Diffstat (limited to 'Userland/DevTools/Profiler')
-rw-r--r--Userland/DevTools/Profiler/DisassemblyModel.cpp8
-rw-r--r--Userland/DevTools/Profiler/Profile.cpp11
-rw-r--r--Userland/DevTools/Profiler/ProfileModel.cpp8
3 files changed, 23 insertions, 4 deletions
diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp
index 7dd9b99502..20dc66237e 100644
--- a/Userland/DevTools/Profiler/DisassemblyModel.cpp
+++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp
@@ -40,7 +40,13 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
OwnPtr<ELF::Image> kernel_elf;
const ELF::Image* elf;
FlatPtr base_address = 0;
- if (m_node.address() >= 0xc0000000) {
+ // FIXME: Use /proc for this
+#if ARCH(I386)
+ FlatPtr kernel_base = 0xc0000000;
+#else
+ FlatPtr kernel_base = 0x2000000000;
+#endif
+ if (m_node.address() >= kernel_base) {
if (!m_kernel_file) {
auto file_or_error = MappedFile::map("/boot/Kernel.debug");
if (file_or_error.is_error())
diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp
index b16d319dc1..d66391ad8a 100644
--- a/Userland/DevTools/Profiler/Profile.cpp
+++ b/Userland/DevTools/Profiler/Profile.cpp
@@ -301,6 +301,13 @@ Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const St
continue;
}
+ // FIXME: Use /proc for this
+#if ARCH(I386)
+ FlatPtr kernel_base = 0xc0000000;
+#else
+ FlatPtr kernel_base = 0x2000000000;
+#endif
+
auto* stack = perf_event.get_ptr("stack");
VERIFY(stack);
auto& stack_array = stack->as_array();
@@ -311,7 +318,7 @@ Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const St
FlyString object_name;
String symbol;
- if (ptr >= 0xc0000000) {
+ if (ptr >= kernel_base) {
if (kernel_elf) {
symbol = kernel_elf->symbolicate(ptr, &offset);
} else {
@@ -338,7 +345,7 @@ Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const St
continue;
FlatPtr innermost_frame_address = event.frames.at(1).address;
- event.in_kernel = innermost_frame_address >= 0xc0000000;
+ event.in_kernel = innermost_frame_address >= kernel_base;
events.append(move(event));
}
diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp
index 055106f98b..abd791f4a9 100644
--- a/Userland/DevTools/Profiler/ProfileModel.cpp
+++ b/Userland/DevTools/Profiler/ProfileModel.cpp
@@ -105,7 +105,13 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
if (node->is_root()) {
return GUI::FileIconProvider::icon_for_executable(node->process().executable);
}
- if (node->address() >= 0xc0000000)
+ // FIXME: Use /proc for this
+#if ARCH(I386)
+ FlatPtr kernel_base = 0xc0000000;
+#else
+ FlatPtr kernel_base = 0x2000000000;
+#endif
+ if (node->address() >= kernel_base)
return m_kernel_frame_icon;
return m_user_frame_icon;
}