Port-i386 archive

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

Xen #ifdef-age & x86 bus_space(9) implementation



I don't understand some of the code that is conditionally compiled for
XEN/!XEN.

Why don't both bus_space_map() and bus_space_alloc() do this?

#ifndef XEN
        if (bpa >= IOM_BEGIN && (bpa + size) != 0 && (bpa + size) <= IOM_END) {
                *bshp = (bus_space_handle_t)ISA_HOLE_VADDR(bpa);
                return(0);
        }
#endif  /* !XEN */

Only bus_space_map() contains that block.

In x86_mem_add_mapping(), which both _alloc() and _map() call, there is
a similar block:

#ifdef XEN
        if (bpa >= IOM_BEGIN && (bpa + size) != 0 && (bpa + size) <= IOM_END) {
                sva = (vaddr_t)ISA_HOLE_VADDR(pa);
        } else
#endif  /* XEN */

Should that be #ifndef XEN instead of #ifdef?

I would like for us to avoid this:

        for (va = sva; pa != endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
#ifdef XEN
                pmap_kenter_ma(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);
#else
                pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE, pmapflags);
#endif /* XEN */
        }

Is there any reason not to add a weak alias pmap_kenter_ma ->
pmap_kenter_pa, and to extract pmap_kenter_ma() into its own object that
is linked into the Xen kernels, only?

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933


Home | Main Index | Thread Index | Old Index