Skip to contentSkip to conversation

Accessing Century byte via RTC

Qemu-devel Ian Seyler 2 participants 2 messages Oct 12, 2010 – Jan 16, 2011

lore
Share & tools
lore

Ian Seyler

author
#0 lore raw

Public bug reported:

With the RTC configure for Binary instead of BCD I am getting the incorrect result for Century.

	mov al, 0x0B			; Set RTC to binary mode
	out 0x70, al
	in al, 0x71
	bts ax, 2
	mov bl, al
	mov al, 0x0B
	out 0x70, al
	mov al, bl
	out 0x71, al

	mov al, 0x32			; Century
	out 0x70, al
	in al, 0x71

In QEMU 0.12.5 it returns 0x20 but should return 0x14. The following work correctly:

	mov al, 0x09			; Year
	out 0x70, al
	in al, 0x71

	mov al, 0x08			; Month
	out 0x70, al
	in al, 0x71

	mov al, 0x07			; Day
	out 0x70, al
	in al, 0x71

** Affects: qemu
Importance: Undecided
Status: New

Signature · 37 lines
Accessing Century byte via RTC
https://bugs.launchpad.net/bugs/659276
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.

Status in QEMU: New

Bug description:
With the RTC configure for Binary instead of BCD I am getting the incorrect result for Century.

	mov al, 0x0B			; Set RTC to binary mode
	out 0x70, al
	in al, 0x71
	bts ax, 2
	mov bl, al
	mov al, 0x0B
	out 0x70, al
	mov al, bl
	out 0x71, al

	mov al, 0x32			; Century
	out 0x70, al
	in al, 0x71

In QEMU 0.12.5 it returns 0x20 but should return 0x14. The following work correctly:

	mov al, 0x09			; Year
	out 0x70, al
	in al, 0x71

	mov al, 0x08			; Month
	out 0x70, al
	in al, 0x71

	mov al, 0x07			; Day
	out 0x70, al
	in al, 0x71
#1 lore raw

The century register is only present in "recent" version of the chip, and is at an address corresponding to the NVRAM memory. It is not manipulated directly by the RTC and therefore is always in BCD format. The current QEMU implementation is correct.

** Changed in: qemu
Status: New => Invalid

Signature · 42 lines
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/659276

Title:
  Accessing Century byte via RTC

Status in QEMU:
  Invalid

Bug description:
  With the RTC configure for Binary instead of BCD I am getting the
  incorrect result for Century.

  	mov al, 0x0B			; Set RTC to binary mode
  	out 0x70, al
  	in al, 0x71
  	bts ax, 2
  	mov bl, al
  	mov al, 0x0B
  	out 0x70, al
  	mov al, bl
  	out 0x71, al

  	mov al, 0x32			; Century
  	out 0x70, al
  	in al, 0x71

  In QEMU 0.12.5 it returns 0x20 but should return 0x14. The following
  work correctly:

  	mov al, 0x09			; Year
  	out 0x70, al
  	in al, 0x71

  	mov al, 0x08			; Month
  	out 0x70, al
  	in al, 0x71

  	mov al, 0x07			; Day
  	out 0x70, al
  	in al, 0x71