mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:47:34 +00:00
Userland: Use /proc/kernel_base to determine the kernel base address
This removes all the hard-coded kernel base addresses from userspace tools. One downside for this is that e.g. Profiler no longer uses a different color for kernel symbols when run as a non-root user.
This commit is contained in:
parent
6115258a5c
commit
60d6137e73
9 changed files with 63 additions and 48 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "Profile.h"
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <LibGUI/FileIconProvider.h>
|
||||
#include <LibSymbolication/Symbolication.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -105,13 +106,8 @@ GUI::Variant ProfileModel::data(const GUI::ModelIndex& index, GUI::ModelRole rol
|
|||
if (node->is_root()) {
|
||||
return GUI::FileIconProvider::icon_for_executable(node->process().executable);
|
||||
}
|
||||
// FIXME: Use /proc for this
|
||||
#if ARCH(I386)
|
||||
FlatPtr kernel_base = 0xc0000000;
|
||||
#else
|
||||
FlatPtr kernel_base = 0x2000000000;
|
||||
#endif
|
||||
if (node->address() >= kernel_base)
|
||||
auto maybe_kernel_base = Symbolication::kernel_base();
|
||||
if (maybe_kernel_base.has_value() && node->address() >= maybe_kernel_base.value())
|
||||
return m_kernel_frame_icon;
|
||||
return m_user_frame_icon;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue