Index: uspace/app/klog/klog.c
===================================================================
--- uspace/app/klog/klog.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/app/klog/klog.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -206,6 +206,6 @@
 	klog_length = size / sizeof(wchar_t);
 	
-	rc = physmem_map((void *) faddr, pages,
-	    AS_AREA_READ | AS_AREA_CACHEABLE, (void *) &klog);
+	rc = physmem_map(faddr, pages, AS_AREA_READ | AS_AREA_CACHEABLE,
+	    (void *) &klog);
 	if (rc != EOK) {
 		fprintf(stderr, "%s: Unable to map klog\n", NAME);
Index: uspace/drv/audio/sb16/dsp.c
===================================================================
--- uspace/drv/audio/sb16/dsp.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/audio/sb16/dsp.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -173,19 +173,23 @@
 {
 	assert(dsp);
-	if (size > MAX_BUFFER_SIZE || size == 0 || (size % 2) == 1)
+	
+	if ((size > MAX_BUFFER_SIZE) || (size == 0) || ((size % 2) == 1))
 		size = MAX_BUFFER_SIZE;
-	void *buffer = NULL, *pa = NULL;
-	int ret = dmamem_map_anonymous(size, AS_AREA_WRITE | AS_AREA_READ,
-	    0, &pa, &buffer);
+	
+	uintptr_t pa = 0;
+	void *buffer = NULL;
+	
+	int ret = dmamem_map_anonymous(size, DMAMEM_16MiB,
+	    AS_AREA_WRITE | AS_AREA_READ, 0, &pa, &buffer);
 	if (ret != EOK) {
 		ddf_log_error("Failed to allocate DMA buffer.");
 		return ENOMEM;
 	}
-
-	ddf_log_verbose("Setup dma buffer at %p(%p) %zu.", buffer, pa, size);
-	assert((uintptr_t)pa < (1 << 25));
-
+	
+	ddf_log_verbose("Setup DMA buffer at %p (%zu) %zu.", buffer, pa, size);
+	assert(pa < (1 << 24));
+	
 	/* Setup 16 bit channel */
-	ret = setup_dma(dsp, (uintptr_t)pa, size);
+	ret = setup_dma(dsp, pa, size);
 	if (ret == EOK) {
 		dsp->buffer.data = buffer;
@@ -196,4 +200,5 @@
 		dmamem_unmap_anonymous(buffer);
 	}
+	
 	return ret;
 }
Index: uspace/drv/block/ahci/ahci.c
===================================================================
--- uspace/drv/block/ahci/ahci.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/block/ahci/ahci.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -119,6 +119,6 @@
 static int ahci_identify_device(sata_dev_t *);
 static int ahci_set_highest_ultra_dma_mode(sata_dev_t *);
-static int ahci_rb_fpdma(sata_dev_t *, void *, uint64_t);
-static int ahci_wb_fpdma(sata_dev_t *, void *, uint64_t);
+static int ahci_rb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
+static int ahci_wb_fpdma(sata_dev_t *, uintptr_t, uint64_t);
 
 static void ahci_sata_devices_create(ahci_dev_t *, ddf_dev_t *);
@@ -233,8 +233,8 @@
 	sata_dev_t *sata = fun_sata_dev(fun);
 	
-	void *phys;
+	uintptr_t phys;
 	void *ibuf;
-	int rc = dmamem_map_anonymous(sata->block_size, AS_AREA_READ | AS_AREA_WRITE,
-	    0, &phys, (void **) &ibuf);
+	int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
+	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Cannot allocate read buffer.");
@@ -276,8 +276,8 @@
 	sata_dev_t *sata = fun_sata_dev(fun);
 	
-	void *phys;
+	uintptr_t phys;
 	void *ibuf;
-	int rc = dmamem_map_anonymous(sata->block_size, AS_AREA_READ | AS_AREA_WRITE,
-	    0, &phys, (void **) &ibuf);
+	int rc = dmamem_map_anonymous(sata->block_size, DMAMEM_4GiB,
+	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &ibuf);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Cannot allocate write buffer.");
@@ -336,5 +336,5 @@
  *
  */
-static void ahci_identify_device_cmd(sata_dev_t *sata, void *phys)
+static void ahci_identify_device_cmd(sata_dev_t *sata, uintptr_t phys)
 {
 	volatile sata_std_command_frame_t *cmd =
@@ -381,5 +381,5 @@
  *
  */
-static void ahci_identify_packet_device_cmd(sata_dev_t *sata, void *phys)
+static void ahci_identify_packet_device_cmd(sata_dev_t *sata, uintptr_t phys)
 {
 	volatile sata_std_command_frame_t *cmd =
@@ -435,8 +435,9 @@
 	}
 	
-	void *phys;
+	uintptr_t phys;
 	sata_identify_data_t *idata;
 	int rc = dmamem_map_anonymous(SATA_IDENTIFY_DEVICE_BUFFER_LENGTH,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, (void **) &idata);
+	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
+	    (void **) &idata);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Cannot allocate buffer to identify device.");
@@ -561,5 +562,5 @@
  *
  */
-static void ahci_set_mode_cmd(sata_dev_t *sata, void* phys, uint8_t mode)
+static void ahci_set_mode_cmd(sata_dev_t *sata, uintptr_t phys, uint8_t mode)
 {
 	volatile sata_std_command_frame_t *cmd =
@@ -567,5 +568,5 @@
 	
 	cmd->fis_type = SATA_CMD_FIS_TYPE;
-	cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR; 
+	cmd->c = SATA_CMD_FIS_COMMAND_INDICATOR;
 	cmd->command = 0xef;
 	cmd->features = 0x03;
@@ -628,8 +629,9 @@
 	}
 	
-	void *phys;
+	uintptr_t phys;
 	sata_identify_data_t *idata;
 	int rc = dmamem_map_anonymous(SATA_SET_FEATURE_BUFFER_LENGTH,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, (void **) &idata);
+	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
+	    (void **) &idata);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Cannot allocate buffer for device set mode.");
@@ -677,5 +679,6 @@
  *
  */
-static void ahci_rb_fpdma_cmd(sata_dev_t *sata, void *phys, uint64_t blocknum)
+static void ahci_rb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys,
+    uint64_t blocknum)
 {
 	volatile sata_ncq_command_frame_t *cmd =
@@ -734,5 +737,5 @@
  *
  */
-static int ahci_rb_fpdma(sata_dev_t *sata, void *phys, uint64_t blocknum)
+static int ahci_rb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
 {
 	if (sata->is_invalid_device) {
@@ -763,5 +766,6 @@
  *
  */
-static void ahci_wb_fpdma_cmd(sata_dev_t *sata, void *phys, uint64_t blocknum)
+static void ahci_wb_fpdma_cmd(sata_dev_t *sata, uintptr_t phys,
+    uint64_t blocknum)
 {
 	volatile sata_ncq_command_frame_t *cmd =
@@ -821,5 +825,5 @@
  *
  */
-static int ahci_wb_fpdma(sata_dev_t *sata, void *phys, uint64_t blocknum)
+static int ahci_wb_fpdma(sata_dev_t *sata, uintptr_t phys, uint64_t blocknum)
 {
 	if (sata->is_invalid_device) {
@@ -933,5 +937,5 @@
 {
 	size_t size = 4096;
-	void *phys = NULL;
+	uintptr_t phys = 0;
 	void *virt_fb = NULL;
 	void *virt_cmd = NULL;
@@ -949,6 +953,6 @@
 	
 	/* Allocate and init retfis structure. */
-	int rc = dmamem_map_anonymous(size, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &phys, &virt_fb);
+	int rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
+	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_fb);
 	if (rc != EOK)
 		goto error_retfis;
@@ -959,6 +963,6 @@
 	
 	/* Allocate and init command header structure. */
-	rc = dmamem_map_anonymous(size, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &phys, &virt_cmd);
+	rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
+	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_cmd);
 	if (rc != EOK)
 		goto error_cmd;
@@ -970,6 +974,6 @@
 	
 	/* Allocate and init command table structure. */
-	rc = dmamem_map_anonymous(size, AS_AREA_READ | AS_AREA_WRITE, 0,
-	    &phys, &virt_table);
+	rc = dmamem_map_anonymous(size, DMAMEM_4GiB,
+	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &virt_table);
 	if (rc != EOK)
 		goto error_table;
@@ -1153,5 +1157,5 @@
 	ahci->memregs = NULL;
 	
-	physmem_map((void *) (size_t) (hw_res_parsed.mem_ranges.ranges[0].address),
+	physmem_map((uintptr_t) (hw_res_parsed.mem_ranges.ranges[0].address),
 	    AHCI_MEMREGS_PAGES_COUNT, AS_AREA_READ | AS_AREA_WRITE,
 	    (void **) &ahci->memregs);
Index: uspace/drv/bus/usb/uhci/utils/malloc32.h
===================================================================
--- uspace/drv/bus/usb/uhci/utils/malloc32.h	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/bus/usb/uhci/utils/malloc32.h	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -100,7 +100,10 @@
 static inline void * get_page(void)
 {
-	void *address, *phys;
+	uintptr_t phys;
+	void *address;
+	
 	const int ret = dmamem_map_anonymous(UHCI_REQUIRED_PAGE_SIZE,
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &phys, &address);
+	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0, &phys,
+	    &address);
 	return ret == EOK ? address : NULL;
 }
Index: uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c
===================================================================
--- uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -273,7 +273,8 @@
 	ddf_log_note("Setting mode: %ux%ux%u\n", x, y, bpp*8);
 	const size_t size = ALIGN_UP(x * y * bpp, PAGE_SIZE);
-	void *buffer, *pa;
-	int ret = dmamem_map_anonymous(size, AS_AREA_READ | AS_AREA_WRITE,
-	    0, &pa, &buffer);
+	uintptr_t pa;
+	void *buffer;
+	int ret = dmamem_map_anonymous(size, DMAMEM_4GiB,
+	    AS_AREA_READ | AS_AREA_WRITE, 0, &pa, &buffer);
 	if (ret != EOK) {
 		ddf_log_error("Failed to get new FB\n");
Index: uspace/drv/fb/kfb/port.c
===================================================================
--- uspace/drv/fb/kfb/port.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/fb/kfb/port.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -333,5 +333,5 @@
 	
 	kfb.size = scanline * height;
-	rc = physmem_map((void *) paddr + offset,
+	rc = physmem_map(paddr + offset,
 	    ALIGN_UP(kfb.size, PAGE_SIZE) >> PAGE_WIDTH,
 	    AS_AREA_READ | AS_AREA_WRITE, (void *) &kfb.addr);
Index: uspace/drv/nic/e1k/e1k.c
===================================================================
--- uspace/drv/nic/e1k/e1k.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/nic/e1k/e1k.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -129,20 +129,20 @@
 	
 	/** Physical tx ring address */
-	void *tx_ring_phys;
+	uintptr_t tx_ring_phys;
 	/** Virtual tx ring address */
 	void *tx_ring_virt;
 	
 	/** Ring of TX frames, physical address */
-	void **tx_frame_phys;
+	uintptr_t *tx_frame_phys;
 	/** Ring of TX frames, virtual address */
 	void **tx_frame_virt;
 	
 	/** Physical rx ring address */
-	void *rx_ring_phys;
+	uintptr_t rx_ring_phys;
 	/** Virtual rx ring address */
 	void *rx_ring_virt;
 	
 	/** Ring of RX frames, physical address */
-	void **rx_frame_phys;
+	uintptr_t *rx_frame_phys;
 	/** Ring of RX frames, virtual address */
 	void **rx_frame_virt;
@@ -1377,6 +1377,6 @@
 	int rc = dmamem_map_anonymous(
 	    E1000_RX_FRAME_COUNT * sizeof(e1000_rx_descriptor_t),
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &e1000->rx_ring_phys,
-	    &e1000->rx_ring_virt);
+	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
+	    &e1000->rx_ring_phys, &e1000->rx_ring_virt);
 	if (rc != EOK)
 		return rc;
@@ -1387,9 +1387,9 @@
 	    (uint32_t) PTR_TO_U64(e1000->rx_ring_phys));
 	
-	e1000->rx_frame_phys =
-	    calloc(E1000_RX_FRAME_COUNT, sizeof(void *));
+	e1000->rx_frame_phys = (uintptr_t *)
+	    calloc(E1000_RX_FRAME_COUNT, sizeof(uintptr_t));
 	e1000->rx_frame_virt =
 	    calloc(E1000_RX_FRAME_COUNT, sizeof(void *));
-	if (e1000->rx_frame_phys == NULL || e1000->rx_frame_virt == NULL) {
+	if ((e1000->rx_frame_phys == NULL) || (e1000->rx_frame_virt == NULL)) {
 		rc = ENOMEM;
 		goto error;
@@ -1397,16 +1397,16 @@
 	
 	size_t i;
+	uintptr_t frame_phys;
 	void *frame_virt;
-	void *frame_phys;
 	
 	for (i = 0; i < E1000_RX_FRAME_COUNT; i++) {
-		rc = dmamem_map_anonymous(
-		    E1000_MAX_SEND_FRAME_SIZE, AS_AREA_READ | AS_AREA_WRITE,
-		    0, &frame_phys, &frame_virt);
+		rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE,
+		    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
+		    &frame_phys, &frame_virt);
 		if (rc != EOK)
 			goto error;
 		
+		e1000->rx_frame_phys[i] = frame_phys;
 		e1000->rx_frame_virt[i] = frame_virt;
-		e1000->rx_frame_phys[i] = frame_phys;
 	}
 	
@@ -1424,6 +1424,6 @@
 		if (e1000->rx_frame_virt[i] != NULL) {
 			dmamem_unmap_anonymous(e1000->rx_frame_virt[i]);
+			e1000->rx_frame_phys[i] = 0;
 			e1000->rx_frame_virt[i] = NULL;
-			e1000->rx_frame_phys[i] = NULL;
 		}
 	}
@@ -1436,5 +1436,5 @@
 	if (e1000->rx_frame_virt != NULL) {
 		free(e1000->rx_frame_virt);
-		e1000->rx_frame_phys = NULL;
+		e1000->rx_frame_virt = NULL;
 	}
 	
@@ -1454,12 +1454,13 @@
 	for (unsigned int offset = 0; offset < E1000_RX_FRAME_COUNT; offset++) {
 		dmamem_unmap_anonymous(e1000->rx_frame_virt[offset]);
+		e1000->rx_frame_phys[offset] = 0;
 		e1000->rx_frame_virt[offset] = NULL;
-		e1000->rx_frame_phys[offset] = NULL;
 	}
 	
 	free(e1000->rx_frame_virt);
-	free(e1000->rx_frame_phys);
+	
+	e1000->rx_frame_phys = NULL;
 	e1000->rx_frame_virt = NULL;
-	e1000->rx_frame_phys = NULL;
+	
 	dmamem_unmap_anonymous(e1000->rx_ring_virt);
 }
@@ -1569,6 +1570,7 @@
 	fibril_mutex_lock(&e1000->tx_lock);
 	
-	e1000->tx_ring_phys = NULL;
+	e1000->tx_ring_phys = 0;
 	e1000->tx_ring_virt = NULL;
+	
 	e1000->tx_frame_phys = NULL;
 	e1000->tx_frame_virt = NULL;
@@ -1576,6 +1578,6 @@
 	int rc = dmamem_map_anonymous(
 	    E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t),
-	    AS_AREA_READ | AS_AREA_WRITE, 0, &e1000->tx_ring_phys,
-	    &e1000->tx_ring_virt);
+	    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 0,
+	    &e1000->tx_ring_phys, &e1000->tx_ring_virt);
 	if (rc != EOK)
 		goto error;
@@ -1584,8 +1586,10 @@
 	    E1000_TX_FRAME_COUNT * sizeof(e1000_tx_descriptor_t));
 	
-	e1000->tx_frame_phys = calloc(E1000_TX_FRAME_COUNT, sizeof(void *));
-	e1000->tx_frame_virt = calloc(E1000_TX_FRAME_COUNT, sizeof(void *));
-
-	if (e1000->tx_frame_phys == NULL || e1000->tx_frame_virt == NULL) {
+	e1000->tx_frame_phys = (uintptr_t *)
+	    calloc(E1000_TX_FRAME_COUNT, sizeof(uintptr_t));
+	e1000->tx_frame_virt =
+	    calloc(E1000_TX_FRAME_COUNT, sizeof(void *));
+
+	if ((e1000->tx_frame_phys == NULL) || (e1000->tx_frame_virt == NULL)) {
 		rc = ENOMEM;
 		goto error;
@@ -1593,6 +1597,6 @@
 	
 	for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
-		rc = dmamem_map_anonymous(
-		    E1000_MAX_SEND_FRAME_SIZE, AS_AREA_READ | AS_AREA_WRITE,
+		rc = dmamem_map_anonymous(E1000_MAX_SEND_FRAME_SIZE,
+		    DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE,
 		    0, &e1000->tx_frame_phys[i], &e1000->tx_frame_virt[i]);
 		if (rc != EOK)
@@ -1616,10 +1620,10 @@
 	}
 	
-	if (e1000->tx_frame_phys != NULL && e1000->tx_frame_virt != NULL) {
+	if ((e1000->tx_frame_phys != NULL) && (e1000->tx_frame_virt != NULL)) {
 		for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
 			if (e1000->tx_frame_virt[i] != NULL) {
 				dmamem_unmap_anonymous(e1000->tx_frame_virt[i]);
+				e1000->tx_frame_phys[i] = 0;
 				e1000->tx_frame_virt[i] = NULL;
-				e1000->tx_frame_phys[i] = NULL;
 			}
 		}
@@ -1633,5 +1637,5 @@
 	if (e1000->tx_frame_virt != NULL) {
 		free(e1000->tx_frame_virt);
-		e1000->tx_frame_phys = NULL;
+		e1000->tx_frame_virt = NULL;
 	}
 	
@@ -1650,6 +1654,6 @@
 	for (i = 0; i < E1000_TX_FRAME_COUNT; i++) {
 		dmamem_unmap_anonymous(e1000->tx_frame_virt[i]);
+		e1000->tx_frame_phys[i] = 0;
 		e1000->tx_frame_virt[i] = NULL;
-		e1000->tx_frame_phys[i] = NULL;
 	}
 	
@@ -1661,5 +1665,5 @@
 	if (e1000->tx_frame_virt != NULL) {
 		free(e1000->tx_frame_virt);
-		e1000->tx_frame_phys = NULL;
+		e1000->tx_frame_virt = NULL;
 	}
 	
Index: uspace/drv/nic/rtl8139/driver.c
===================================================================
--- uspace/drv/nic/rtl8139/driver.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/nic/rtl8139/driver.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -1144,6 +1144,6 @@
 	ddf_msg(LVL_DEBUG, "Creating buffers");
 
-	rc = dmamem_map_anonymous(TX_PAGES * PAGE_SIZE, AS_AREA_WRITE, 0,
-	    &rtl8139->tx_buff_phys, &rtl8139->tx_buff_virt);
+	rc = dmamem_map_anonymous(TX_PAGES * PAGE_SIZE, DMAMEM_4GiB,
+	    AS_AREA_WRITE, 0, &rtl8139->tx_buff_phys, &rtl8139->tx_buff_virt);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Can not allocate transmitter buffers.");
@@ -1164,6 +1164,6 @@
 	    RxBUF_TOT_LENGTH);
 
-	rc = dmamem_map_anonymous(RxBUF_TOT_LENGTH, AS_AREA_READ, 0,
-	    &rtl8139->rx_buff_phys, &rtl8139->rx_buff_virt);
+	rc = dmamem_map_anonymous(RxBUF_TOT_LENGTH, DMAMEM_4GiB,
+	    AS_AREA_READ, 0, &rtl8139->rx_buff_phys, &rtl8139->rx_buff_virt);
 	if (rc != EOK) {
 		ddf_msg(LVL_ERROR, "Can not allocate receive buffer.");
Index: uspace/drv/nic/rtl8139/driver.h
===================================================================
--- uspace/drv/nic/rtl8139/driver.h	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/drv/nic/rtl8139/driver.h	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -100,5 +100,5 @@
 	 *  Each buffer takes 2kB
 	 */
-	void *tx_buff_phys;
+	uintptr_t tx_buff_phys;
 	void *tx_buff_virt;
 
@@ -117,5 +117,5 @@
 
 	/** Buffer for receiving frames */
-	void *rx_buff_phys;
+	uintptr_t rx_buff_phys;
 	void *rx_buff_virt;
 
Index: uspace/lib/c/generic/ddi.c
===================================================================
--- uspace/lib/c/generic/ddi.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/lib/c/generic/ddi.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -76,5 +76,5 @@
  *
  */
-int physmem_map(void *phys, size_t pages, unsigned int flags, void **virt)
+int physmem_map(uintptr_t phys, size_t pages, unsigned int flags, void **virt)
 {
 	return __SYSCALL5(SYS_PHYSMEM_MAP, (sysarg_t) phys,
@@ -83,5 +83,5 @@
 
 int dmamem_map(void *virt, size_t size, unsigned int map_flags,
-    unsigned int flags, void **phys)
+    unsigned int flags, uintptr_t *phys)
 {
 	return (int) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
@@ -90,7 +90,9 @@
 }
 
-int dmamem_map_anonymous(size_t size, unsigned int map_flags,
-    unsigned int flags, void **phys, void **virt)
-{
+int dmamem_map_anonymous(size_t size, uintptr_t constraint,
+    unsigned int map_flags, unsigned int flags, uintptr_t *phys, void **virt)
+{
+	*phys = constraint;
+	
 	return (int) __SYSCALL6(SYS_DMAMEM_MAP, (sysarg_t) size,
 	    (sysarg_t) map_flags, (sysarg_t) flags | DMAMEM_FLAGS_ANONYMOUS,
@@ -158,8 +160,8 @@
 	if (!virt)
 		return EINVAL;
-
-	void *phys_frame =
-	    (void *) ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE);
-	size_t offset = pio_addr - phys_frame;
+	
+	uintptr_t phys_frame =
+	    ALIGN_DOWN((uintptr_t) pio_addr, PAGE_SIZE);
+	size_t offset = (uintptr_t) pio_addr - phys_frame;
 	size_t pages = SIZE2PAGES(offset + size);
 	
Index: uspace/lib/c/generic/time.c
===================================================================
--- uspace/lib/c/generic/time.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/lib/c/generic/time.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -556,6 +556,6 @@
 		
 		void *addr;
-		rc = physmem_map((void *) faddr, 1,
-		    AS_AREA_READ | AS_AREA_CACHEABLE, &addr);
+		rc = physmem_map(faddr, 1, AS_AREA_READ | AS_AREA_CACHEABLE,
+		    &addr);
 		if (rc != EOK) {
 			as_area_destroy(addr);
Index: uspace/lib/c/include/ddi.h
===================================================================
--- uspace/lib/c/include/ddi.h	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/lib/c/include/ddi.h	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -42,11 +42,14 @@
 #include <task.h>
 
+#define DMAMEM_16MiB  ((uintptr_t) UINT64_C(0xffffffffff000000))
+#define DMAMEM_4GiB   ((uintptr_t) UINT64_C(0xffffffff00000000))
+
 extern int device_assign_devno(void);
 
-extern int physmem_map(void *, size_t, unsigned int, void **);
+extern int physmem_map(uintptr_t, size_t, unsigned int, void **);
 
-extern int dmamem_map(void *, size_t, unsigned int, unsigned int, void **);
-extern int dmamem_map_anonymous(size_t, unsigned int, unsigned int, void **,
-    void **);
+extern int dmamem_map(void *, size_t, unsigned int, unsigned int, uintptr_t *);
+extern int dmamem_map_anonymous(size_t, uintptr_t, unsigned int, unsigned int,
+    uintptr_t *, void **);
 extern int dmamem_unmap(void *, size_t);
 extern int dmamem_unmap_anonymous(void *);
Index: uspace/srv/bd/rd/rd.c
===================================================================
--- uspace/srv/bd/rd/rd.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/srv/bd/rd/rd.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -165,5 +165,5 @@
 	    AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;
 	
-	ret = physmem_map((void *) addr_phys,
+	ret = physmem_map(addr_phys,
 	    ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags, &rd_addr);
 	if (ret != EOK) {
Index: uspace/srv/hid/input/port/niagara.c
===================================================================
--- uspace/srv/hid/input/port/niagara.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/srv/hid/input/port/niagara.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -97,6 +97,6 @@
 		return -1;
 	
-	int rc = physmem_map((void *) paddr, 1,
-	    AS_AREA_READ | AS_AREA_WRITE, (void *) &input_buffer);
+	int rc = physmem_map(paddr, 1, AS_AREA_READ | AS_AREA_WRITE,
+	    (void *) &input_buffer);
 	if (rc != 0) {
 		printf("Niagara: uspace driver couldn't map physical memory: %d\n",
Index: uspace/srv/hid/output/port/ega.c
===================================================================
--- uspace/srv/hid/output/port/ega.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/srv/hid/output/port/ega.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -216,5 +216,5 @@
 	ega.size = (ega.cols * ega.rows) << 1;
 	
-	rc = physmem_map((void *) paddr,
+	rc = physmem_map(paddr,
 	    ALIGN_UP(ega.size, PAGE_SIZE) >> PAGE_WIDTH,
 	    AS_AREA_READ | AS_AREA_WRITE, (void *) &ega.addr);
Index: uspace/srv/hid/output/port/kchar.c
===================================================================
--- uspace/srv/hid/output/port/kchar.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/srv/hid/output/port/kchar.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -84,5 +84,5 @@
 		return rc;
 	
-	rc = physmem_map((void *) paddr,
+	rc = physmem_map(paddr,
 	    ALIGN_UP(1, PAGE_SIZE) >> PAGE_WIDTH,
 	    AS_AREA_READ | AS_AREA_WRITE, (void *) &kchar.addr);
Index: uspace/srv/hid/output/port/niagara.c
===================================================================
--- uspace/srv/hid/output/port/niagara.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/srv/hid/output/port/niagara.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -104,6 +104,6 @@
 		return rc;
 	
-	rc = physmem_map((void *) paddr, 1,
-	    AS_AREA_READ | AS_AREA_WRITE, (void *) &niagara.fifo);
+	rc = physmem_map(paddr, 1, AS_AREA_READ | AS_AREA_WRITE,
+	    (void *) &niagara.fifo);
 	if (rc != EOK)
 		return rc;
Index: uspace/srv/hw/irc/obio/obio.c
===================================================================
--- uspace/srv/hw/irc/obio/obio.c	(revision 2e2c18a16687d7f890413cd60036177bb6ed6140)
+++ uspace/srv/hw/irc/obio/obio.c	(revision 8442d1010feb8698f9e91ca9405377165dcfd6eb)
@@ -69,5 +69,5 @@
 #define INO_MASK	0x1f
 
-static void *base_phys;
+static uintptr_t base_phys;
 static volatile uint64_t *base_virt;
 
@@ -123,5 +123,5 @@
 	}
 	
-	base_phys = (void *) paddr;
+	base_phys = (uintptr_t) paddr;
 	
 	int flags = AS_AREA_READ | AS_AREA_WRITE;
@@ -135,5 +135,5 @@
 	}
 	
-	printf("%s: OBIO registers with base at %p\n", NAME, base_phys);
+	printf("%s: OBIO registers with base at %zu\n", NAME, base_phys);
 	
 	async_set_client_connection(obio_connection);
