Public bug reported:

The devmem2 utility allows the user to read/write physical memory space
in three widths: byte, halfword, and word.  These casts are used to
handle the different widths:

                switch(access_type) {
                        case 'b':
                                *((unsigned char *) virt_addr) = writeval;
                                read_result = *((unsigned char *) virt_addr);
                                break;
                        case 'h':
                                *((unsigned short *) virt_addr) = writeval;
                                read_result = *((unsigned short *) virt_addr);
                                break;
                        case 'w':
                                *((unsigned long *) virt_addr) = writeval;
                                read_result = *((unsigned long *) virt_addr);
                                break;
                }

On a 64-bit system, unsigned long is 64 bits wide.  In such a
configuration there is no way to read/write 32-bit values with devmem2;
the program jumps from halfword (16 bits) all the way to word (64 bits).
This can produce a surprising result when trying to poke 32-bit
registers on a PCI add-on card.

On embedded systems I normally use "busybox devmem" for this sort of
debugging, but the Ubuntu busybox packages do not have CONFIG_DEVMEM
enabled.  I will file a separate change request on bugs.debian.org for
this.

More semi-related discussion about devmem2 vs. busybox here:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595805
https://bugs.launchpad.net/ubuntu/+bug/607752

The problem was seen on devmem2 0.0-0ubuntu1 on Quantal.

** Affects: devmem2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1093748

Title:
  32-bit accesses are missing on 64-bit systems

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/devmem2/+bug/1093748/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to