MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vrtc_nvram_write

Function vrtc_nvram_write

freebsd/amd64/vmm/io/vrtc.c:788–813  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786}
787
788int
789vrtc_nvram_write(struct vm *vm, int offset, uint8_t value)
790{
791 struct vrtc *vrtc;
792 uint8_t *ptr;
793
794 vrtc = vm_rtc(vm);
795
796 /*
797 * Don't allow writes to RTC control registers or the date/time fields.
798 */
799 if (offset < offsetof(struct rtcdev, nvram[0]) ||
800 offset == RTC_CENTURY || offset >= sizeof(struct rtcdev)) {
801 VM_CTR1(vrtc->vm, "RTC nvram write to invalid offset %d",
802 offset);
803 return (EINVAL);
804 }
805
806 VRTC_LOCK(vrtc);
807 ptr = (uint8_t *)(&vrtc->rtcdev);
808 ptr[offset] = value;
809 VM_CTR2(vrtc->vm, "RTC nvram write %#x to offset %#x", value, offset);
810 VRTC_UNLOCK(vrtc);
811
812 return (0);
813}
814
815int
816vrtc_nvram_read(struct vm *vm, int offset, uint8_t *retval)

Callers 1

vmmdev_ioctlFunction · 0.85

Calls 1

vm_rtcFunction · 0.85

Tested by

no test coverage detected