Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  cmpxchg-emu.c

  Sprache: C
 

// SPDX-License-Identifier: GPL-2.0+
/*
 * Emulated 1-byte cmpxchg operation for architectures lacking direct
 * support for this size.  This is implemented in terms of 4-byte cmpxchg
 * operations.
 *
 * Copyright (C) 2024 Paul E. McKenney.
 */


#include <linux/types.h>
#include <linux/export.h>
#include <linux/instrumented.h>
#include <linux/atomic.h>
#include <linux/panic.h>
#include <linux/bug.h>
#include <asm-generic/rwonce.h>
#include <linux/cmpxchg-emu.h>

union u8_32 {
 u8 b[4];
 u32 w;
};

/* Emulate one-byte cmpxchg() in terms of 4-byte cmpxchg. */
uintptr_t cmpxchg_emu_u8(volatile u8 *p, uintptr_t old, uintptr_t new)
{
 u32 *p32 = (u32 *)(((uintptr_t)p) & ~0x3);
 int i = ((uintptr_t)p) & 0x3;
 union u8_32 old32;
 union u8_32 new32;
 u32 ret;

 ret = READ_ONCE(*p32);
 do {
  old32.w = ret;
  if (old32.b[i] != old)
   return old32.b[i];
  new32.w = old32.w;
  new32.b[i] = new;
  instrument_atomic_read_write(p, 1);
  ret = data_race(cmpxchg(p32, old32.w, new32.w)); // Overridden above.
 } while (ret != old32.w);
 return old;
}
EXPORT_SYMBOL_GPL(cmpxchg_emu_u8);

Messung V0.5 in Prozent
C=96 H=89 G=92

¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet am  2026-06-08) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik