Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/arch/powerpc/kernel/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 1 kB image not shown  

Quelle  static_call.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
#include <linux/memory.h>
#include <linux/static_call.h>

#include <asm/text-patching.h>

void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
{
 int err;
 bool is_ret0 = (func == __static_call_return0);
 unsigned long _tramp = (unsigned long)tramp;
 unsigned long _func = (unsigned long)func;
 unsigned long _ret0 = _tramp + PPC_SCT_RET0;
 bool is_short = is_offset_in_branch_range((long)func - (long)(site ? : tramp));

 mutex_lock(&text_mutex);

 if (site && tail) {
  if (!func)
   err = patch_instruction(site, ppc_inst(PPC_RAW_BLR()));
  else if (is_ret0)
   err = patch_branch(site, _ret0, 0);
  else if (is_short)
   err = patch_branch(site, _func, 0);
  else if (tramp)
   err = patch_branch(site, _tramp, 0);
  else
   err = 0;
 } else if (site) {
  if (!func)
   err = patch_instruction(site, ppc_inst(PPC_RAW_NOP()));
  else if (is_ret0)
   err = patch_instruction(site, ppc_inst(PPC_RAW_LI(_R3, 0)));
  else if (is_short)
   err = patch_branch(site, _func, BRANCH_SET_LINK);
  else if (tramp)
   err = patch_branch(site, _tramp, BRANCH_SET_LINK);
  else
   err = 0;
 } else if (tramp) {
  if (func && !is_short) {
   err = patch_ulong(tramp + PPC_SCT_DATA, _func);
   if (err)
    goto out;
  }

  if (!func)
   err = patch_instruction(tramp, ppc_inst(PPC_RAW_BLR()));
  else if (is_ret0)
   err = patch_branch(tramp, _ret0, 0);
  else if (is_short)
   err = patch_branch(tramp, _func, 0);
  else
   err = patch_instruction(tramp, ppc_inst(PPC_RAW_NOP()));
 } else {
  err = 0;
 }

out:
 mutex_unlock(&text_mutex);

 if (err)
  panic("%s: patching failed %pS at %pS\n", __func__, func, tramp);
}
EXPORT_SYMBOL_GPL(arch_static_call_transform);

Messung V0.5
C=99 H=93 G=95

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.