diff --git a/src/stacks.c b/src/stacks.c
index 7db0e3c..f633169 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -395,3 +395,29 @@ check_preempt(void)
 
     call32(yield_preempt, 0, 0);
 }
+
+static u32 pci_readl_32(u32 addr)
+{
+    dprintf(1, "pci rd32: %x\n", addr);
+    return readl((void*)addr);
+}
+
+u32 pci_readl(u32 addr)
+{
+    dprintf(1, "pci read: %x\n", addr);
+#if MODESEGMENT == 1
+    return call32(pci_readl_32, addr, -1);
+#else
+    return pci_readl_32(addr);
+#endif
+}
+
+void pci_writel(u32 addr, u32 val)
+{
+    dprintf(1, "pci write: %x, %x\n", addr, val);
+#if MODESEGMENT == 1
+    /* TODO */;
+#else
+    writel((void*)addr, val);
+#endif
+}
diff --git a/src/util.h b/src/util.h
index 18ab814..15f1369 100644
--- a/src/util.h
+++ b/src/util.h
@@ -225,6 +225,8 @@ void start_preempt(void);
 void finish_preempt(void);
 int wait_preempt(void);
 void check_preempt(void);
+u32 pci_readl(u32 addr);
+void pci_writel(u32 addr, u32 val);
 
 // output.c
 void debug_serial_setup(void);
