ASELSANMicrokernel
S335 · SOURCE-BOUND GATE EVIDENCE

S335 · Start-first-task production writer guard integration

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

S335Production writer guardOperations id exactsource SHA exacttest target exact

operation: g8l-s335-start-first-task-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 öğesiL6070–L6135
kernel/src/task/scheduler.rs::start_first_task

/// Scheduler'ı ilk task ile başlat.
///
/// Bu fonksiyon `context_switch` ile ilk task'in entry point'ine atlar ve
/// **geri dönmez**. Eğer kuyrukta hiç task yoksa (programlama hatası),
/// idle wfi döngüsünde kalırız.
pub unsafe fn start_first_task() -> ! {
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    let s335_irq_guard = crate::arch::aarch64::IrqGuard::new();
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    let s335_writer_access = crate::g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s335_start_first_task_writer_guard_integration::acquire_s335_production_scheduler_writer_access()
        .unwrap_or_else(|error| {
            panic!(
                "S335 start-first-task scheduler writer guard failed closed: {:?}",
                error
            )
        });
    let sched = &mut *core::ptr::addr_of_mut!(SCHEDULER);
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    let old_asid = sched.current_task.as_ref().map_or(0, |task| task.asid);

    if let Some(prio_first) = sched.ready_queue.pop() {
        let mut first = prio_first.task;
        first.state = TaskState::Running;
        let is_user_first = first.is_user;
        let ctx = &mut first.context as *mut TaskContext;

        sched.current_task = Some(first);
        sched.ticks_until_preempt = sched.current_task.as_ref().unwrap().default_time_slice;

        // M8.2 — İlk task için de AddressSpace hazırlığı
        if let Some(curr) = &sched.current_task {
            #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
            let prepare_task_for_context_switch = |next_task: &Task| unsafe {
                prepare_task_for_context_switch_from_s334_snapshot(next_task, old_asid);
            };
            prepare_task_for_context_switch(curr);
        }

        crate::kprintln!(
            "[M4.3-DEBUG] start_first_task: switching to first task '{}' (user={})",
            sched.current_task.as_ref().unwrap().name,
            is_user_first
        );

        let mut dummy = TaskContext::default();
        #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
        drop(s335_writer_access);
        #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
        drop(s335_irq_guard);
        context_switch(&mut dummy, ctx);
        // context_switch sonrası ilk task'e geçildi; bu noktaya **asla**
        // dönmeyiz çünkü `dummy` artık başka task'in eski "current"i.
        unreachable!("ilk context_switch'ten sonra start_first_task'a dönülmemeli");
    }

    // Kuyruk boş — caller spawn'ı unutmuş demektir; idle bekle.
    crate::kprintln!("[Scheduler] UYARI: kuyrukta task yok, idle moda geçiliyor.");
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    drop(s335_writer_access);
    #[cfg(all(target_arch = "aarch64", target_os = "none", feature = "board-rpi5"))]
    drop(s335_irq_guard);
    loop {
        core::arch::asm!("wfi", options(nomem, nostack));
    }
}
snippet sha256: 6ec9c43566f9file sha256: 838dd474448c
02 · Ortak exclusion üyeliği

S247 production writer guard

tam Rust öğesiL152–L166
kernel/src/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s335_start_first_task_writer_guard_integration.rs::acquire_s335_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_s335_production_scheduler_writer_access(
) -> Result<G8lS335ProductionSchedulerWriterAccess, 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(G8lS335ProductionSchedulerWriterAccess { _access: access })
}
snippet sha256: 9c990f74bc25file sha256: 2f9348476533
03 · Doğrulayan test kodu

Operations komutuna bağlı focused test

tam Rust öğesiL207–L219
simulation/tests/g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s335_start_first_task_writer_guard_integration.rs::target_function_contains_one_scheduler_writer_and_one_s335_guard

#[test]
fn target_function_contains_one_scheduler_writer_and_one_s335_guard() {
    let target = start_first_task_boundary();
    assert_eq!(target.matches("addr_of_mut!(SCHEDULER)").count(), 1);
    assert_eq!(
        target
            .matches("acquire_s335_production_scheduler_writer_access()")
            .count(),
        1
    );
    assert_eq!(target.matches("context_switch(&mut dummy, ctx)").count(), 1);
}
snippet sha256: d3d3738c719dfile sha256: 52d84cbf24f0
04 · Kapı kimlik kaydı

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

tam Operations kaydıL14262–L14316
website/src/lib/operations.ts::g8l-s335-start-first-task-writer-guard-integration-partial
  {
    id: "g8l-s335-start-first-task-writer-guard-integration-partial",
    date: "2026-08-27",
    sequence: 335,
    status: "passed",
    umbrella_status: "partial",
    title: "S335 · Start-first-task production writer guard integration",
    summary:
      "S335, start_first_task içindeki tek mutable SCHEDULER yolunu IRQ-masked CPU0 sınırında S334 ve 44 production reader'ın kullandığı aynı S247 state word'e bağlar. Writer üyeliği ilk ready-task seçimi, Running state, current-task/time-slice yayımı ve owned old-ASID snapshot ile nested-reader içermeyen adres-uzayı hazırlığını kapsar; terminal context_switch ve boş-queue WFI yolundan önce writer ile IRQ guard düşer. Guarded writer 8/69, açık writer 61 ve provider authority 0'dır.",
    evidence: [
      "Focused start-first-task writer-integration kapısı iki bağımsız koşuda 27/27 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 S334→S335 token monotonluğu doğrulandı.",
      "Production kaynak sırası IRQ guard → acquire_s335 writer → tek mutable alias/owned old-ASID snapshot → ready_queue.pop → Running/current/tick publication → snapshot-only TTBR0/TLBI hazırlığı → writer drop → IRQ restore → context_switch olarak kilitlendi. Boş-queue yolu da her iki üyeliği WFI öncesinde bırakır.",
      "Snapshot-only hazırlık helper'ı SCHEDULER pointer'ı veya S257/S265 reader acquire içermez. Exact tarihsel prepare_task_for_context_switch(curr) kaynak token'ı ve S297 start_first_task semantiği korunur.",
      "QEMU, RPi4, RPi5 ve RPi5+SMP AArch64 compile profilleri fresh ve izole target dizinlerinde 4/4 exit 0 verdi; zero-warning iddiası yoktur.",
      "S238–S335 dependency matrisi iki bağımsız koşuda 99 grup / 1470/1470 PASS verdi.",
      "Exact yedi tarihsel G8h assertion adı dışlanıp kayıtlı --test-threads=1 kabulü kullanıldığında tam workspace 297 sonuç grubu / 3294 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 PASS verdi. Bu, board-rpi5-only S335 writer invocation veya fiziksel cihaz gözlemi değildir.",
      "Yerel website 516/516 test ile PASS; lint, boş çıktılı TypeScript kontrolü ve 23/23 static route ayrıca geçti. S335 kaydı yereldir ve deployment yapılmadı.",
      "S245 request ve S244 admission dokunulmadan kalır; production provider authority=0, whole-scheduler exclusion=false ve toplam 61 production writer açık kalır.",
      "Fiziksel/device işlem yapılmadı: physical/device operations=0 ve RUNBOOK_EXECUTED_IN_S335=NO.",
    ],
    commands: [
      "cargo test --quiet -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s335_start_first_task_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-s335-start-first-task-writer-guard-integration",
        title: "G8l S335 start-first-task writer guard integration",
        commandLines: [
          "cargo test --quiet -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s335_start_first_task_writer_guard_integration -- --test-threads=1",
        ],
        outputLines: [
          "test result: ok; S335 focused 1 group / 27 passed; 0 failed",
          "shared S247 gate: 44 guarded readers + 8/69 guarded writers; 61 writers open",
          "writer and IRQ membership drop before context_switch and empty-queue WFI",
        ],
        exitCode: 0,
        outputMode: "complete",
      },
    ],
    terminalSessionsNote:
      "S335 sekizinci production writer'ın kaynak entegrasyonudur. RPi5 callsite derlenmiştir fakat cihazda gözlenmemiştir; global exclusion veya provider authority oluşmamıştır.",
    limitations: [
      "61 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.",
      "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: cb47e91cbb02file sha256: 9726dbf00f84
Focused test komutu
cargo test -p aselsan_microkernel_simulation --test g8l_target_dispatch_scheduler_owner_scheduler_mutation_production_migration_lifecycle_s335_start_first_task_writer_guard_integration -- --test-threads=1
proof: docs/M8.1-RPi5-G8l-S335-Start-First-Task-Writer-Guard-Integration-Proof.md
Registry schema v5 · generator website/scripts/generate-code-gates.mjs · Tam SHA-256: 91d38c7b6222f0b4c117be786454853543da55a160e543d9b951057cc20dcc06