Jeff, on IRC, get me a bit closer the other night.

The problem with rtai_malloc is not the kmalloc part, but the mmap part.

The code here: 
https://github.com/NTULINUX/RTAI/blob/master/include/rtai_shm.h#L212

If modified to read:
if ((adr = mmap(start, size, PROT_WRITE | PROT_READ, MAP_SHARED |
MAP_LOCKED, hook, 0)) == MAP_FAILED) {;
        perror("rtai_shm.h - MAP_FAILED");
        printf("adr = %p, start = %p, size = %i \n", adr,start,  size);

Then the output is:
adr = (nil), start = (nil), hook = 4, size = 16384
rtai_shm.h - MAP_FAILED: Bad address
adr = 0xffffffffffffffff, start = (nil), size = 16384

Does anyone know under what circumstances mmap can return "Bad address"?

I thought that it might be a kernel config flag,

Filter access to /dev/mem
 CONFIG_STRICT_DEVMEM:
 If this option is disabled, you allow userspace (root) access to all
of memory, including kernel and userspace memory. Accidental
access to this is obviously disastrous, but specific access can

               be used by people debugging the kernel. Note that with
PAT support
                              enabled, even in this case there are
restrictions on /dev/mem
                                                  use due to the cache
aliasing requirements.
                                                                 If
this option is switched on, and IO_STRICT_DEVMEM=n, the /dev/mem

            file only allows userspace access to PCI space and the
BIOS code and
                               data regions.  This is sufficient for
dosemu and X and all common
                                                users of /dev/mem.

                                                               if in
doubt, say Y.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912adr = (nil), start
= (nil), hool = 4, size = 16384


_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to