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

Function vrtc_nvram_read

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

Source from the content-addressed store, hash-verified

813}
814
815int
816vrtc_nvram_read(struct vm *vm, int offset, uint8_t *retval)
817{
818 struct vrtc *vrtc;
819 sbintime_t basetime;
820 time_t curtime;
821 uint8_t *ptr;
822
823 /*
824 * Allow all offsets in the RTC to be read.
825 */
826 if (offset < 0 || offset >= sizeof(struct rtcdev))
827 return (EINVAL);
828
829 vrtc = vm_rtc(vm);
830 VRTC_LOCK(vrtc);
831
832 /*
833 * Update RTC date/time fields if necessary.
834 */
835 if (offset < 10 || offset == RTC_CENTURY) {
836 curtime = vrtc_curtime(vrtc, &basetime);
837 secs_to_rtc(curtime, vrtc, 0);
838 }
839
840 ptr = (uint8_t *)(&vrtc->rtcdev);
841 *retval = ptr[offset];
842
843 VRTC_UNLOCK(vrtc);
844 return (0);
845}
846
847int
848vrtc_addr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes,

Callers 1

vmmdev_ioctlFunction · 0.85

Calls 3

vm_rtcFunction · 0.85
vrtc_curtimeFunction · 0.85
secs_to_rtcFunction · 0.85

Tested by

no test coverage detected