[comp.os.minix] Calloc, malloc and physical addresses on the PC

PILLAY.KDA@EXETER.AC.UK (02/07/90)

How!
Can anyone tell me how to obtain the physical 20-bit address for data
allocated using "calloc" or "malloc"?
Under TurboC I have the following:
        unsigned char *ptr
        ..
        ptr = (char *) calloc(num, sizeof(ptr))
        off = ((unsigned) (ptr))
        seg = ((unsigned) ((unsigned long) (ptr) >> 16))

gives me a physical address " seg:off ".

Under MINIX, ptr would only be 2 bytes long. I looked at the floppy.c
driver and that uses "umap(...)" from kernel/system.c which in turn
needs to extract info from a user process etc..
I am programming the DMA controller on the PC and all I want to do
is allocated some memory, using calloc, and program the controller
with the Physical 20 bit address of where ptr points.
Thanks.