write_guest_lc(9)
π write_guest_lc(9)
okay so bestie, buckle up β this is write_guest_lc from the Kernel API Manual, and it's literally the function that copies stuff from kernel space straight into a guest vcpu's lowcore. lowkey iconic behavior ngl π
β¨ NAME β¨
write_guest_lc β copy data from kernel space to guest vcpu's lowcore. that's the whole vibe. copy, data, kernel space, lowcore. slay π
πΈ SYNOPSIS πΈ
int write_guest_lc (struct kvm_vcpu *vcpu , unsigned long gra , void
*data , unsigned long len );
like yes, that's the whole signature, keep it exactly like that, no cap π«Ά
π¦ ARGUMENTS π¦
vcpuβ the virtual cpu. the main character, honestly πgraβ vcpu's source guest real address. it's giving "where in guest-land" energy β¨dataβ source address in kernel space. this is where the data's actually coming from πlenβ number of bytes to copy. how much we're moving. no more, no less π
π DESCRIPTION π
So the whole thing is: copy data from kernel space to guest vcpu's lowcore. that's it. that's the function. π
but okay, important caveat bestie β the entire range must be located within the vcpu's lowcore, otherwise the result is undefined. like literally undefined. we don't make the rules, we just warn you about them π fr fr, don't test it.
Returns zero on success or -EFAULT on error. that's the whole return contract. periodt. π
π₯ NOTE π₯
an error here indicates that either the kernel is out of memory or the guest memory mapping is broken. like, one of those two things. π
In any case the best solution would be to terminate the guest. yep, you read that right. it's rough out here. π
It is wrong to inject a guest exception. don't do that. not the move. π«
π SEE ALSO π
Kernel file ./arch/s390/kvm/s390/gaccess.h β that's where these besties live π§
kvm_s390_real_to_abs(9)_kvm_s390_logical_to_effective(9)kvm_s390_logical_to_effective(9)put_guest_lc(9)read_guest_lc(9)write_guest_with_key(9)write_guest(9)read_guest_with_key(9)read_guest(9)read_guest_instr(9)write_guest_abs(9)read_guest_abs(9)write_guest_real(9)read_guest_real(9)
and that's the page, bestie π
π sign-off time: this little gem comes from ./arch/s390/kvm/s390 and it's dated October 2026 β go off, kernel docs, go off β¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms