Re: mmap() with an offset > 32 bits on a 32-bit CPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, please see below :-

Michael Blizek wrote:
> On 00:10 Sat 28 Jun     , Abdul Basit wrote:
>   
>> Hi Folks,
>>
>>     I am trying to bring Xorg 7.x on PowerPC 440EPx Sequoia board, X is
>> configured to use sisfb for video and the sisfb is loaded properly in
>> kernel and registered as fb0, running X causes a machine check exception
>> / BUS error by kernel.
>>
>>      The reason for that is in :-
>>
>> xorg/xorg-server/hw/xfree86/os-support/linux/lnx_video.c:558
>>
>> X is doing the following :-
>>
>> ----
>> ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
>> fd = open("/dev/mem", O_RDWR);
>>           if (ioBase == NULL) {
>>                   ioBase = (volatile unsigned char *)mmap(0, 0x20000,
>>                                   PROT_READ | PROT_WRITE, MAP_SHARED,
>>                                  ioBase_phys);
>> ----
>>     
>
> Where do you pass the file descriptor to mmap?
>
>   
   sorry, cut and paste error, the correct one is :- 

---
ioBase = (volatile unsigned char *)mmap(0, 0x20000,
PROT_READ | PROT_WRITE, MAP_SHARED, fd,
ioBase_phys);
---
>> the pci I/O memory in my case is 36-bits but the CPU is 32-bits so the
>> ioBase_phys is getting truncated as long is 32-bits and when later X try
>> to write to this address causes a BUS error.
>>
>> Since i know the ioBase_phys address which is 0x1E8000000, I could hard
>> code it but the mmap(..) offset size is 32-bits as well, so I could not
>> pass it as an offset.
>>
>> How would i pass a large offset to mmap on PPC32? is there any other way
>> to do it?
>>     
>
> You can call mmap2 if the offset is a multiply of 4096. (see the manpage)
> 	-Michi
>   
The type for offset in both mmap() and mmap2() if off_t which is
sizeof(off_t) = 4, infact i can not find mmap2 for powerpc in uclibc,
there is mmap()
which takes __off_t and mmap64() which takes __off64_t but that is only
enabled
if you use __FILE_OFFSET_SIZE=64 which i do not know if i turn it on
what are the consequences?
also internally mmap64() truncates the off64_t to off_t and a comment in
there
to implement architecture specific code in there.


Thanks,
~basit


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux