ASELSANMicrokernel
S336 · SOURCE-BOUND GATE EVIDENCE

S336 · Yield-context-save production writer guard integration

production acquire → S247 guard modülü → Operations-bound focused test Bu sayfa yalnız S336 kapısına aittir; komşu kapıların kaynakları bu kabulün içine katılmaz.

S336Production writer guardOperations id exactsource SHA exacttest target exact

operation: g8l-s336-yield-context-save-writer-guard-integration-partial

production · S247 guard · focused test · Operations · 4 exact excerpt

sequence-bound=true · implementation-bound=true
01 · Test edilen uygulama/model kodu

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

tam Rust öğesiL6142–L6172
kernel/src/task/scheduler.rs::save_user_context_for_yield

/// EL0'dan sys_yield geldiğinde çağrılır.
/// Mevcut task'in user context'ini (tüm registerlar + SP_EL0 + ELR/SPSR) kaydeder.
pub unsafe fn save_user_context_for_yield(ctx: &ExceptionContext, user_sp: u64) {
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    let s336_irq_guard = crate::arch::aarch64::IrqGuard::new();
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    let s336_writer_access = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s336_yield_context_save_writer_guard_integration::acquire_s336_production_scheduler_writer_access()
        .unwrap_or_else(|error| {
            panic!(
                "S336 yield-context-save scheduler writer guard failed closed: {:?}",
                error
            )
        });
    let sched = &mut *core::ptr::addr_of_mut!(SCHEDULER);

    if let Some(curr) = &mut sched.current_task {
        curr.is_user = true;
        curr.user_sp = user_sp;
        curr.saved_user_elr = ctx.elr_el1;
        curr.saved_user_spsr = ctx.spsr_el1;

        // gpr[0..29] + lr (x30)
        curr.saved_user_gprs[..30].copy_from_slice(&ctx.gpr[..]);
        curr.saved_user_gprs[30] = ctx.lr;
    }
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    drop(s336_writer_access);
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    drop(s336_irq_guard);
}
snippet sha256: 5411e7f90326file sha256: 838dd474448c
02 · Ortak exclusion üyeliği

S247 production writer guard

tam Rust öğesiL151–L165
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s336_yield_context_save_writer_guard_integration.rs::acquire_s336_production_scheduler_writer_access

/// Acquire from the exact static gate used by routed readers and prior
/// writers. The legacy global scheduler remains a CPU0-only boundary.
#[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
pub fn acquire_s336_production_scheduler_writer_access(
) -> Result<G8lS336ProductionSchedulerWriterAccess, G8lS247WholeSchedulerAccessError> {
    let caller_cpu =
        crate::percpu::try_current_cpu_id().ok_or(G8lS247WholeSchedulerAccessError::InvalidCpu)?;
    if caller_cpu != crate::g8l_runtime_contract::CPU0 {
        return Err(G8lS247WholeSchedulerAccessError::InvalidCpu);
    }
    let access = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s246_whole_scheduler_read_access_guard::S247_PRODUCTION_WHOLE_SCHEDULER_ACCESS_GATE
        .try_acquire_exclusive_for_valid_cpu(caller_cpu)?;
    Ok(G8lS336ProductionSchedulerWriterAccess { _access: access })
}
snippet sha256: 09f908877139file sha256: 466b9e26e42c
03 · Doğrulayan test kodu

Operations komutuna bağlı focused test

tam Rust öğesiL208–L225
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s336_yield_context_save_writer_guard_integration.rs::target_function_contains_one_scheduler_writer_and_one_s336_guard

#[test]
fn target_function_contains_one_scheduler_writer_and_one_s336_guard() {
    let target = yield_context_save_boundary();
    assert_eq!(target.matches("addr_of_mut!(SCHEDULER)").count(), 1);
    assert_eq!(
        target
            .matches("acquire_s336_production_scheduler_writer_access()")
            .count(),
        1
    );
    assert_eq!(
        target
            .matches("if let Some(curr) = &mut sched.current_task")
            .count(),
        1
    );
}
snippet sha256: a98578ac5daffile sha256: 9173fca34698
04 · Kapı kimlik kaydı

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

tam Operations kaydıL14206–L14261
website/src/lib/operations.ts::g8l-s336-yield-context-save-writer-guard-integration-partial
  {
    id: "g8l-s336-yield-context-save-writer-guard-integration-partial",
    date: "2026-08-27",
    sequence: 336,
    status: "passed",
    umbrella_status: "partial",
    title: "S336 · Yield-context-save production writer guard integration",
    summary:
      "S336, save_user_context_for_yield içindeki tek mutable SCHEDULER yolunu IRQ-masked CPU0 sınırında S335 ve 44 production reader'ın kullandığı aynı S247 state word'e bağlar. Writer üyeliği koşullu current-task kontrolü ile user/SP/ELR/SPSR/x0–x29/LR snapshot'ını kapsar; writer IRQ restore'dan önce düşer ve current task yoksa tarihsel no-op korunur. Guarded writer 9/69, açık writer 60 ve provider authority 0'dır; S337 ayrı ve açıktır.",
    evidence: [
      "Focused yield-context-save writer-integration kapısı iki bağımsız seri koşuda 24/24 PASS verdi.",
      "Aynı S247 state word üzerinde CPU0-only writer membership, non-CPU0 pre-commit rejection, reader→writer ve writer→reader exclusion, exact-once commit/error release ve S335→S336 token monotonluğu doğrulandı.",
      "Production kaynak sırası IRQ guard → acquire_s336 writer → tek mutable alias → koşullu current-task user/SP/ELR/SPSR/x0–x29/LR snapshot → writer drop → IRQ restore olarak kilitlendi. Missing-current-task yolu tarihsel no-op kalır.",
      "EL0 syscall caller IRQ-masked bağlamı korur; S336 writer snapshot sonunda bırakılır ve ayrı S334 yield_now writer'ına taşınmaz. Exact tarihsel S298 yield-context-save semantiği korunur; S337 save_user_context_for_ipc_block sibling yolu değiştirilmedi.",
      "QEMU, RPi4, RPi5 ve RPi5+SMP AArch64 compile profilleri fresh ve izole target dizinlerinde 4/4 exit 0 verdi; zero-warning iddiası yoktur.",
      "S238–S336 dependency matrisi iki bağımsız koşuda 100 grup / 1494/1494 PASS verdi.",
      "Exact yedi tarihsel G8h assertion adı dışlanıp kayıtlı --test-threads=1 kabulü kullanıldığında tam workspace 298 sonuç grubu / 3319 PASS / 0 fail / 7 filtered verdi. Filtresiz frozen S96 identity reddi nedeniyle global workspace GREEN iddia edilmez.",
      "make verify-qemu ortak regresyonu strict ELF W^X 31/31 ve S130–S154 kabul zinciriyle bir kez PASS verdi. Bu, board-rpi5-only S336 writer invocation veya fiziksel cihaz gözlemi değildir.",
      "Yerel website 518/518 test ile PASS; lint, boş çıktılı TypeScript kontrolü ve 23/23 static route ayrıca geçti. S336 kaydı yereldir ve deployment yapılmadı.",
      "S245 request ve S244 admission dokunulmadan kalır; production provider authority=0, whole-scheduler exclusion=false ve toplam 60 production writer açık kalır.",
      "Fiziksel/device işlem yapılmadı: physical/device operations=0 ve RUNBOOK_EXECUTED_IN_S336=NO.",
    ],
    commands: [
      "cargo test --quiet -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s336_yield_context_save_writer_guard_integration -- --test-threads=1",
      "cargo build --manifest-path kernel/Cargo.toml --target aarch64-unknown-none --no-default-features --features board-rpi5",
      "cargo build --manifest-path kernel/Cargo.toml --target aarch64-unknown-none --no-default-features --features board-rpi5,smp",
      "cargo test --workspace --quiet -- --test-threads=1 [seven exact historical --skip filters]",
      "make verify-qemu",
    ],
    terminalSessions: [
      {
        id: "g8l-s336-yield-context-save-writer-guard-integration",
        title: "G8l S336 yield-context-save writer guard integration",
        commandLines: [
          "cargo test --quiet -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s336_yield_context_save_writer_guard_integration -- --test-threads=1",
        ],
        outputLines: [
          "test result: ok; S336 focused 1 group / 24 passed; 0 failed",
          "shared S247 gate: 44 guarded readers + 9/69 guarded writers; 60 writers open",
          "conditional current-task context snapshot completes before writer drop and IRQ restore",
        ],
        exitCode: 0,
        outputMode: "complete",
      },
    ],
    terminalSessionsNote:
      "S336 dokuzuncu production writer'ın kaynak entegrasyonudur. RPi5 callsite derlenmiştir fakat cihazda gözlenmemiştir; global exclusion veya provider authority oluşmamıştır.",
    limitations: [
      "60 production writer aynı shared gate dışında kaldığı için whole-scheduler exclusion ve provider authority açık kalır.",
      "Production callsite kaynakta bağlı ve dört profilde derlenmiştir; supported RPi5 runtime/cihaz gözlemi yapılmamıştır.",
      "S337 save_user_context_for_ipc_block sibling writer entegrasyonu özellikle açık bırakılmıştır.",
      "Default-parallel PTY determinism S331'den açık taşınır; kayıtlı seri kabul matrisi kullanılır.",
      "Transient-contention liveness/soak, Generic SMP ve fiziksel RPi kabulü açık kalır.",
      "Yerel web doğrulaması deployment değildir; canlı site bu değişiklikle güncellenmemiştir.",
    ],
  },
snippet sha256: 7b5918c5e653file sha256: 9726dbf00f84
Focused test komutu
cargo test -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s336_yield_context_save_writer_guard_integration -- --test-threads=1
proof: docs/M8.1-RPi5-G8l-S336-Yield-Context-Save-Writer-Guard-Integration-Proof.md
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 91d38c7b6222f0b4c117be786454853543da55a160e543d9b951057cc20dcc06