tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Help with a bug in mmap
jmcneill@ wrote:
> On Wed, 31 Oct 2018, Taylor R Campbell wrote:
>
> > For the moment, as a provisional workaround to make progress, you can
> > probably get by with `pa << PGSHIFT', where pa is the physical (byte)
>
> I think this should be `pa >> PGSHIFT`, or even better use `atop(pa)`.
Some MACHINE_ARCHs use paddr_t for an mmap cookie:
https://nxr.netbsd.org/xref/src/sys/dev/usb/udl.c?r=1.22#675
---
675 /* XXX we need MI paddr_t -> mmap cookie API */
676 #if defined(__aarch64__)
677 #define PTOMMAP(paddr) aarch64_btop((char *)paddr)
678 #elif defined(__alpha__)
679 #define PTOMMAP(paddr) alpha_btop((char *)paddr)
680 #elif defined(__arm__)
681 #define PTOMMAP(paddr) arm_btop((u_long)paddr)
682 #elif defined(__hppa__)
683 #define PTOMMAP(paddr) btop((u_long)paddr)
684 #elif defined(__i386__) || defined(__x86_64__)
685 #define PTOMMAP(paddr) x86_btop(paddr)
686 #elif defined(__m68k__)
687 #define PTOMMAP(paddr) m68k_btop((char *)paddr)
688 #elif defined(__mips__)
689 #define PTOMMAP(paddr) mips_btop(paddr)
690 #elif defined(__powerpc__)
691 #define PTOMMAP(paddr) (paddr)
692 #elif defined(__sh__)
693 #define PTOMMAP(paddr) sh3_btop(paddr)
694 #elif defined(__sparc__)
695 #define PTOMMAP(paddr) (paddr)
696 #elif defined(__sparc64__)
697 #define PTOMMAP(paddr) atop(paddr)
698 #elif defined(__vax__)
699 #define PTOMMAP(paddr) btop((u_int)paddr)
700 #endif
701
702 return PTOMMAP(paddr);
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index