Skip to content

Commit

Permalink
syscall_nr->name tables: update to v6.7 and simplify ARM naming
Browse files Browse the repository at this point in the history
Handwavy: AArch32 is an execution state of a 64 bit arm processor when
it is running a 32 bit process (backwards compatible with old arm/thumb
machine code). For such a process, the linux syscall table is the same
as that for the older 32 bit armv7 ISAs. So we can drop one of the
tables.

Also, simplify the naming of the tables since the current names are
mixing different terminologies. Go with labels that humans understand,
even if they're not pedantically correct.

Bloaty report for stripped libperfetto.so built with clang-release on
x86_64:
    FILE SIZE        VM SIZE
 --------------  --------------
  +1.0%    +800  +1.0%    +800    [section .rodata]
  +300%     +24  +300%     +24    [LOAD #1 [R]]
  -0.0%     -16  -0.0%     -16    [section .data.rel.ro]
  -0.0%     -16  -0.0%     -16    [section .eh_frame]
  -0.0%     -24  -0.0%     -24    [section .rela.dyn]
  -0.0%     -32  -0.0%     -32    [section .text]
  +0.0%    +736  +0.0%    +736    TOTAL


Change-Id: Iab947b1a6455fd0c69ef30a52807b6945201e7fc
  • Loading branch information
rsavitski committed Feb 12, 2024
1 parent 7fcd1eb commit 9eea3e6
Show file tree
Hide file tree
Showing 6 changed files with 1,748 additions and 1,819 deletions.
20 changes: 8 additions & 12 deletions src/kernel_utils/syscall_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ namespace perfetto {

SyscallTable::SyscallTable(Architecture arch) {
switch (arch) {
case Architecture::kArmEabi:
*this = SyscallTable::Load<SyscallTable_armeabi>();
case Architecture::kArm64:
*this = SyscallTable::Load<SyscallTable_arm64>();
break;
case Architecture::kAarch32:
*this = SyscallTable::Load<SyscallTable_aarch32>();
break;
case Architecture::kAarch64:
*this = SyscallTable::Load<SyscallTable_aarch64>();
case Architecture::kArm32:
*this = SyscallTable::Load<SyscallTable_arm32>();
break;
case Architecture::kX86_64:
*this = SyscallTable::Load<SyscallTable_x86_64>();
Expand All @@ -51,11 +48,10 @@ SyscallTable::SyscallTable(Architecture arch) {

Architecture SyscallTable::ArchFromString(base::StringView machine) {
if (machine == "aarch64") {
return Architecture::kAarch64;
} else if (machine == "armv8l") {
return Architecture::kArmEabi;
} else if (machine == "armv7l") {
return Architecture::kAarch32;
return Architecture::kArm64;
} else if (machine == "armv8l" || machine == "armv7l") {
// armv8l is a 32 bit userspace process on a 64 bit kernel
return Architecture::kArm32;
} else if (machine == "x86_64") {
return Architecture::kX86_64;
} else if (machine == "i686") {
Expand Down
5 changes: 2 additions & 3 deletions src/kernel_utils/syscall_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ static constexpr size_t kMaxSyscalls = 550;

enum class Architecture {
kUnknown = 0,
kArmEabi, // 32-bit kernel running a 32-bit process (most old devices).
kAarch32, // 64-bit kernel running a 32-bit process (should be rare).
kAarch64, // 64-bit kernel running a 64-bit process (most new devices).
kArm64,
kArm32,
kX86_64,
kX86,
};
Expand Down
Loading

0 comments on commit 9eea3e6

Please sign in to comment.