ASELSANMicrokernel
S82 · SOURCE-BOUND GATE EVIDENCE

G8g per-CPU timer storage/API kapısı yeşil; runtime hâlâ STOP

Operations --test hedefi → focused test içindeki include_str!/#[path] bağı → kaynak kesiti Bu sayfa yalnız S82 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.

S82Focused kod testiOperations id exactsource SHA exacttest target exact

operation: rpi5-g8g-timer-storage-source-green

uygulama/model · focused test · Operations · 3 exact excerpt

sequence-bound=true · implementation-bound=false
01 · Testin bağlı olduğu uygulama/model kodu

Kapının yürüttüğü gerçek kaynak

tam Rust öğesiL27–L134
kernel/src/arch/aarch64/timer.rs::RPI5_G8G_PERIODIC_TIMER_SLOTS

/// G8g keeps one periodic-timer bookkeeping record for each possible RPi5
/// processing element.  The four entries are deliberately explicit: an
/// invalid CPU ID must never wrap or fall back to CPU0.
pub const RPI5_G8G_PERIODIC_TIMER_SLOTS: usize = 4;
pub const RPI5_G8G_CPU0_SLOT: usize = 0;
pub const RPI5_G8G_CPU1_SLOT: usize = 1;
pub const RPI5_G8G_SNAPSHOT_RETRY_LIMIT: usize = 8;

const _: () = assert!(RPI5_G8G_PERIODIC_TIMER_SLOTS == crate::percpu::MAX_CPUS);
#[cfg(feature = "board-rpi5")]
const _: () = assert!(RPI5_G8G_PERIODIC_TIMER_SLOTS == crate::g8_contract::EXPECTED_CPU_COUNT);

#[repr(C, align(64))]
struct PerCpuPeriodicTimer {
    generation: AtomicU64,
    frequency: AtomicU64,
    period: AtomicU64,
    start_count: AtomicU64,
    next_cval: AtomicU64,
    ticks: AtomicU64,
}

impl PerCpuPeriodicTimer {
    const fn new() -> Self {
        Self {
            generation: AtomicU64::new(0),
            frequency: AtomicU64::new(0),
            period: AtomicU64::new(0),
            start_count: AtomicU64::new(0),
            next_cval: AtomicU64::new(0),
            ticks: AtomicU64::new(0),
        }
    }

    /// Load one stable even generation before a writer calculates its full
    /// update. The later CAS rejects any writer that changed the slot in the
    /// meantime.
    fn generation_for_write(&self) -> Result<u64, &'static str> {
        let generation = self.generation.load(Ordering::Acquire);
        if generation & 1 != 0 {
            return Err("periodic timer slot writer is active");
        }
        generation
            .checked_add(2)
            .ok_or("periodic timer generation overflow")?;
        Ok(generation)
    }

    /// Publish the writer-active odd generation only after every fallible
    /// calculation and validation in the caller has succeeded.
    fn begin_write(
        &self,
        observed_generation: u64,
    ) -> Result<PeriodicTimerWriteEpoch, &'static str> {
        if observed_generation & 1 != 0 {
            return Err("periodic timer generation is odd");
        }
        let odd_generation = observed_generation
            .checked_add(1)
            .ok_or("periodic timer odd generation overflow")?;
        let next_even_generation = odd_generation
            .checked_add(1)
            .ok_or("periodic timer even generation overflow")?;
        self.generation
            .compare_exchange(
                observed_generation,
                odd_generation,
                Ordering::AcqRel,
                Ordering::Acquire,
            )
            .map_err(|_| "periodic timer writer generation changed")?;
        Ok(PeriodicTimerWriteEpoch {
            next_even_generation,
        })
    }

    /// Complete a writer publication with an even release generation.
    fn finish_write(&self, epoch: PeriodicTimerWriteEpoch) {
        self.generation
            .store(epoch.next_even_generation, Ordering::Release);
    }

    #[cfg(feature = "board-rpi5")]
    fn snapshot(&self) -> Result<PerCpuPeriodicTimerSnapshot, &'static str> {
        for _attempt in 0..RPI5_G8G_SNAPSHOT_RETRY_LIMIT {
            let before = self.generation.load(Ordering::Acquire);
            if before & 1 != 0 {
                core::hint::spin_loop();
                continue;
            }
            let snapshot = PerCpuPeriodicTimerSnapshot {
                frequency: self.frequency.load(Ordering::Relaxed),
                period: self.period.load(Ordering::Relaxed),
                start_count: self.start_count.load(Ordering::Relaxed),
                next_cval: self.next_cval.load(Ordering::Relaxed),
                ticks: self.ticks.load(Ordering::Relaxed),
            };
            core::sync::atomic::fence(Ordering::Acquire);
            let after = self.generation.load(Ordering::Acquire);
            if before == after && after & 1 == 0 {
                return Ok(snapshot);
            }
            core::hint::spin_loop();
        }
        Err("periodic timer snapshot remained unstable")
    }
}
snippet sha256: 0c71078e4cc1file sha256: 35edb3758192
02 · Doğrulayan test kodu

Operations komutuna bağlı focused test

tam Rust öğesiL86–L133
simulation/tests/rpi5_g8g_source.rs::four_explicit_periodic_slots_replace_the_global_timer_state

#[test]
fn four_explicit_periodic_slots_replace_the_global_timer_state() {
    for token in [
        "pub const RPI5_G8G_PERIODIC_TIMER_SLOTS: usize = 4;",
        "pub const RPI5_G8G_CPU0_SLOT: usize = 0;",
        "pub const RPI5_G8G_CPU1_SLOT: usize = 1;",
        "pub const RPI5_G8G_SNAPSHOT_RETRY_LIMIT: usize = 8;",
        "RPI5_G8G_PERIODIC_TIMER_SLOTS == crate::percpu::MAX_CPUS",
        "RPI5_G8G_PERIODIC_TIMER_SLOTS == crate::g8_contract::EXPECTED_CPU_COUNT",
        "#[repr(C, align(64))]",
        "struct PerCpuPeriodicTimer",
        "generation: AtomicU64",
        "frequency: AtomicU64",
        "period: AtomicU64",
        "start_count: AtomicU64",
        "next_cval: AtomicU64",
        "ticks: AtomicU64",
        "generation: AtomicU64::new(0)",
        "struct PeriodicTimerWriteEpoch",
        "static PER_CPU_PERIODIC_TIMERS:",
        "fn rpi5_g8g_periodic_slot(",
        "pub fn rpi5_g8g_periodic_snapshot(",
        ".get(cpu_id)",
        ".ok_or(\"invalid periodic timer CPU id\")",
    ] {
        assert!(
            TIMER.contains(token),
            "missing per-CPU timer contract {token}"
        );
    }
    assert_eq!(
        TIMER.matches("PerCpuPeriodicTimer::new(),").count(),
        4,
        "periodic timer slots must be explicit rather than synthesized or aliased",
    );
    for legacy in [
        "static PERIOD_TICKS: AtomicU64",
        "static FREQ_HZ: AtomicU64",
        "static START_COUNT: AtomicU64",
        "static NEXT_CVAL: AtomicU64",
    ] {
        assert!(
            !TIMER.contains(legacy),
            "legacy global timer state remains after slot split: {legacy}",
        );
    }
}
snippet sha256: e1c536639769file sha256: efa713406257
03 · Kapı kimlik kaydı

Operations sıra, kimlik ve başlık bağı

tam Operations kaydıL29595–L29682
website/src/lib/operations.ts::rpi5-g8g-timer-storage-source-green
  {
    id: "rpi5-g8g-timer-storage-source-green",
    date: "2026-08-21",
    sequence: 82,
    status: "partial",
    title: "G8g per-CPU timer storage/API kapısı yeşil; runtime hâlâ STOP",
    summary:
      "Sıra 81 contract/parser temelinden sonraki ilk source kapısı tamamlandı. Dört explicit cache-line hizalı periodic timer slotu, invalid-ID fail-closed lookup, CPU0 compatibility delegasyonu ve yalnız exact BCM2712 CPU1 kimliğine register yazma yetkisi eklendi. Alanlar bounded even/odd generation protokolüyle tutarlı yayımlanıyor; CPU0 rearm hata yolu timer'ı off+masked bırakıp terminal WFE'ye geçerek phantom global tick'i engelliyor. G8g source 7/7, contract hedefi 25/25 + CLI, tam simulation 200/200, beş board/feature compile profili ve mevcut G8–G8f production layout zinciri 6/6 PASS verdi. Bu yalnız dormant storage/API kanıtıdır: rpi5_g8g.rs, G8f handoff, IRQ interceptor, G8g layout, image, microSD, UART ve fiziksel BOOT8G henüz yoktur.",
    evidence: [
      "Immutable fiziksel prerequisite Sequence 80 BOOT8F raw'ıdır: 17.363 B / e70e1a9a2cf35f9079ee1b1a73d992106bf5ee9a19f1bbf2628582e836ea5068 ve SCOPE=QUIESCENT_ATOMIC_HANDOFF_ONLY.",
      "Timer implementation exact 18.090 B / 1946b2c304385cacbe8dd15cd6bc449dff14a88dec30a7a4d4ac0aa3a078448c; dört explicit `repr(C, align(64))` slot ve bounded fail-closed lookup içerir.",
      "Final G8g source test exact 21.888 B / 854a9c4b2002a4660ecdc56ad6387abdc995ceedf434d0e3cbf665d962792e93; ilk RED 2/6 PASS + 4/6 beklenen FAIL, final 7/7 PASS'tir.",
      "G8b one-shot function sınırı harden edildi: source regression exact 6.696 B / 22d6f31b54403436ae8dfff751b6b3449fe72ab34c2f9956451ee9c6f502e09d ve 8/8 PASS.",
      "Writer publication exact stable-even Acquire→even/odd AcqRel CAS→field/register writes→ISB→next-even Release sırasındadır.",
      "Snapshot en çok sekiz turda generation Acquire→Relaxed fields→Acquire fence→generation Acquire sırasını kullanır; yalnız aynı çift generation kabul edilir.",
      "CPU0 init/accessor/rearm imzaları slot 0'a delege olur; checked CVAL/local tick ilerlemesi korunur ve hata yolu CNTV_CTL_EL0=0b10→ISB→terminal WFE ile dispatcher'a dönmez.",
      "CPU1 register-yazma API'leri exact slot 1 ve BCM2712 MPIDR_EL1=0x100 ister. CPU2/3 yalnız snapshot/storage slotudur; invalid ID, CPU2/3 ve wrong-current-CPU ilk yazımdan önce reddedilir.",
      "`make verify-rpi5-g8g-contract` G8f UART 9/9 + G8g source 7/7 + G8g UART 9/9 = 25/25 PASS ve CLI example check PASS verdi.",
      "Tam simulation matrisi 200/200; rustfmt, diff-check ve forbidden-alias taraması PASS verdi.",
      "board-rpi5, board-rpi5+smp, board-qemu, board-qemu+smp ve board-rpi4 compile profilleri PASS; iki SMP sonucu compile-only'dir ve runtime GO değildir.",
      "Fresh production RPi5 ELF exact 7.523.072 B / 5ef0ece32d82236d1dc3697c55500257dfbeb5bd72389d32770bb3a672aad695; mevcut G8/G8b/G8c/G8d/G8e/G8f layout kapıları 6/6 PASS.",
      "Sequence 82 source proof exact 5.039 B / 1b7dfda7c371d9f86d4cd07f6ee275276df718bf7a662d692e122aa03517a42b; ayrıntılı SMP roadmap exact 18.508 B / 21bd79da398063cd28326524091220d847ab0c628ec2b3c967dea240ae86fdd6.",
      "Timeline Sıra 82'yi aktif GREEN checkpoint, Sıra 80'i son fiziksel BOOT8F ve Sıra 83'ü dormant bounded runtime source TDD olarak gösterir; kesintisiz başarı yolu Sıra 92'ye kadar ayrı kabul/STOP kapılarıdır.",
    ],
    terminalSessionsNote:
      "Oturumlar source-TDD, eşzamanlılık/fail-closed hardening ve compile/layout regresyonunu gösterir. Bunlar runtime veya fiziksel BOOT8G kanıtı değildir.",
    terminalSessions: [
      {
        id: "g8g-storage-source-tdd",
        title: "Dört explicit slot ve fail-closed timer API source-TDD",
        commandLines: [
          "cargo test -p aselsan_microkernel_simulation --test rpi5_g8g_source",
          "cargo test -p aselsan_microkernel_simulation --test rpi5_g8b_source",
          "make verify-rpi5-g8g-contract",
        ],
        outputLines: [
          "initial source RED=2/6 PASS + 4/6 expected FAIL",
          "final rpi5_g8g_source=7/7 PASS · rpi5_g8b_source=8/8 PASS",
          "G8f UART 9/9 + G8g source 7/7 + G8g UART 9/9=25/25 PASS",
          "verify_rpi5_g8g_log cargo_check_exit=0",
        ],
        exitCode: 0,
        outputMode: "complete",
      },
      {
        id: "g8g-storage-concurrency-hardening",
        title: "Seqlock snapshot ve terminal CPU0 hata yolu incelemesi",
        commandLines: [
          "audit writer/read publication order and bounded retries",
          "audit invalid/current-CPU rejection before every mutation",
          "audit CPU0 rearm failure cannot reach global TICKS increment",
        ],
        outputLines: [
          "writer=AcqRel CAS → fields/registers → ISB → Release · PASS",
          "reader=Acquire → fields → Acquire fence → Acquire · PASS",
          "invalid/CPU2_3/wrong-current writes=0 · PASS",
          "CPU0 error=off+masked terminal WFE · phantom global tick=NO",
        ],
        exitCode: 0,
        outputMode: "selected",
      },
      {
        id: "g8g-storage-regression-matrix",
        title: "Simulation, beş compile profili ve G8–G8f layout zinciri",
        commandLines: [
          "cargo test -p aselsan_microkernel_simulation",
          "cargo check board-rpi5, board-rpi5+smp, board-qemu, board-qemu+smp and board-rpi4",
          "make kernel-rpi5; run production G8 through G8f layout gates",
        ],
        outputLines: [
          "simulation=200/200 PASS · compile profiles=5/5 PASS",
          "production historical layout=G8/G8b/G8c/G8d/G8e/G8f=6/6 PASS",
          "ELF=7523072 B · sha256=5ef0ece32d82236d1dc3697c55500257dfbeb5bd72389d32770bb3a672aad695",
          "image/package/SD/UART/physical BOOT8G=NOT RUN",
        ],
        exitCode: 0,
        outputMode: "complete",
      },
    ],
    limitations: [
      "Bu kayıt yalnız per-CPU timer storage/API source ve önceki-layout regresyon kanıtıdır; G8g runtime, G8g machine-code/layout veya fiziksel BOOT8G PASS değildir.",
      "`kernel/src/rpi5_g8g.rs`, G8f→G8g handoff seam'leri ve exception dispatcher interceptor'ı henüz yoktur; dormant timer API'leri production akışından erişilemez.",
      "Yeni image/package üretilmedi; microSD, UART, Debug Probe ve Pi güç durumuna dokunulmadı.",
      "SMP profilleri compile-only'dir; generic SMP, CPU1 preemption, runqueue, migration, TLBI, CPU2/CPU3, soak ve hotplug kapalıdır.",
      "Source-level kontroller nihai instruction/call/store kanıtı değildir; G8g production layout kapısı Sequence 85'e kadar STOP'tur.",
      "Production deployment dirty/untracked workspace ve stale 47d22c9 source etiketiyle yapılır; canlı artifact doğrulansa da Git-provider provenance kurulmuş sayılmaz.",
    ],
  },
snippet sha256: 6db1217202b0file sha256: 9726dbf00f84
Focused test komutu
cargo test -p aselsan_microkernel_simulation --test rpi5_g8g_source
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 3050638b71a684d8f8f947a8a6faa237a17fa8db5dc0db04fb207b668b462af9