import assert from'node:assert/strict';import{readFileSync}from'node:fs';const text=p=>readFileSync(p,'utf8'); export const progressLayoutFields=[ 'size_of::()',...['root','sample'].map(n=>`offset_of!(Worker,${n})`), 'size_of::()',...['binding','worker','units','first','last','digest'].map(n=>`offset_of!(Sample,${n})`), 'size_of::()',...['issuer','epoch','generation','cpu'].map(n=>`offset_of!(Binding,${n})`), 'size_of::()',...['issuer','generation','slot','cpu'].map(n=>`offset_of!(Identity,${n})`), 'size_of::()',...['binding','units','workers'].map(n=>`offset_of!(CpuSample,${n})`), 'size_of::()',...['root','bindings','identities','previous','windows'].map(n=>`offset_of!(Monitor,${n})`) ]; export function progressRuntimeSource(){return text('os-smp-progress/src/progress.rs')+`\npub const fn os_k2085_layout()->[u64;${progressLayoutFields.length}]{use core::mem::{size_of,offset_of};[${progressLayoutFields.map(s=>`(${s})as u64`).join(',')}] }\n`;} export function progressPublicationGuestSource(base){const from='if cmd==3{return Ok(())}';assert.equal(base.split(from).length,2);return base.replace(from,'if cmd==89{return Ok(())}');} export function progressProbeSource(base){for(const[a,b]of[ ['#[path="k2080-acquire-release-guest.rs"]mod publication;','#[path="k2085-acquire-release-guest.rs"]mod publication;\n#[path="k2085-smp-progress-guest.rs"]mod progress;'], ['publication::cycle(&q,shared,c)?;','publication::cycle(&q,shared,c)?;progress::cycle(&q,shared,c)?;'], ['publication::drive(&shared)?;','publication::drive(&shared)?;progress::drive(&shared)?;'] ]){assert.equal(base.split(a).length,2,a);base=base.replace(a,b);}return base;} export function progressGuestSource(){return text('scripts/os-acceptance/k2085-smp-progress-guest.rs')+` #[unsafe(no_mangle)]pub static OS_K2085_MODEL_LAYOUT:[u64;${progressLayoutFields.length}]=pr::os_k2085_layout(); #[unsafe(no_mangle)]pub static OS_K2085_SLOT_LAYOUT:[u64;3]=mv::os_k2060_slot_layout::(); `;}