Giter VIP home page Giter VIP logo

device-memory-readwrite's People

Contributors

kaiwan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

device-memory-readwrite's Issues

Device file not created on a Qemu-emulated ARM-32

Test case:
On a QEMU-emulated (Versatile Express CA-9) platform (in fact, I use my other opensource project - SEALS - to do so):

ARM # insmod ./rwmem.ko
rwmem: registered with major number 252
rwmem: cdev rwmem.0 added
 rwmem: Device node /dev/rwmem.0 created.
rwmem: IO base address NOT specified (or len invalid) as module param; not performing ioremap...
ARM # ls /dev/rwmem*
ls: /dev/rwmem*: No such file or directory
ARM # 

I had to manually create the device node:

ARM # mknod /dev/rwmem.0 c 252 0
ARM # ls -l /dev/rwmem.0 
crw-r--r--    1 0        0         252,   0 Oct  7 04:01 /dev/rwmem.0
ARM # 

Then everything works just fine. For eg.:

ARM # ./rdmem 80000000 32
PID 620. [Enter] to cont...
PRINT_CTX:: in function rwmem_ioctl on cpu # 0
 in process context: rdmem:620
        +0          +4          +8          +c            0   4   8   c   
+0000   00 00 a1 ff 00 00 00 0e 57 f6 34 7b 54 9b ed 86   ........W.4{T...
+0010   54 9b ed 6e 00 00 00 00 00 01 00 00 00 00 00 00   T..n............
+0020   00 00 00 00 00 00 00 01 62 2f 2e 2e 62 2f 6e 69   ........b/..b/ni
+0030   62 79 73 75 00 00 78 6f 00 00 00 00 00 00 00 00   bysu..xo........
ARM # 

But how come the device node is not created (works on x86)?

WRMEM used User mode instead of Kernel mode

First: I use the tool to access the PINMUX control registers on a TI AM335x ARM Cortex-A8. These are protected, so that you need the Kernel Mode for writes.

I define an iobase with
insmod devmem_rw.ko iobase_start=0x44E10000 iobase_len=0x100

./wrmem -o 860 27 (e.g.) didn't work (... user mode)

At line 98 I added the first "if", like it is used in RDMEM:
if (st_wrm.flag != USE_IOBASE) {
if (is_user_address(st_wrm.addr)) {
if (uaddr_valid(st_wrm.addr) == -1) {
fprintf(stderr,
"%s: the (usermode virtual) address passed (%p) seems to be invalid. Aborting...\n",
argv[0], (void *)st_wrm.addr);
close(fd);
exit(1);
}
}
}

I didn't analyse the code in depth, as this worked right away. So I don't know if this is a good solution.

Compile Warning

Applicable to ver 0.1.2 :

What steps will reproduce the problem?
1. 'make' on the device driver

What is the expected output? What do you see instead?
$ make
...
rwmem.c:271: warning: initialization from incompatible pointer type
...
$ 


Original issue reported on code.google.com by [email protected] on 24 Sep 2012 at 6:26

Open on our debugfs file fails (on some systems)

File open on /sys/kernel/debug/devmem_rw/get_page_offset fails, even as root!
Error : "rdmem: open dbgfs_file: Operation not permitted"
errno=EPERM.

Weird:
Fails: on x86_64 native Ubuntu 18.10, fails on Fedora 29 guest.
(I tried disabling any active LSMs - AppArmor, SELinux. No luck).
Works: on x86_64 18.04 LTS guest VM, on ARMv7 Raspberry Pi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.