do not mix tabs and spaces in a single file
diff --git a/cstart.S b/cstart.S
index 9f2a269..6f5741c 100644
--- a/cstart.S
+++ b/cstart.S
@@ -10,12 +10,12 @@
 	mov %ax, %ss
 	mov $0x7c00, %sp
 
-        mov %cr0, %eax
-        and $~((1 << 30) | (1 << 29)), %eax   # clear CD and NW
-        or $1, %al
-        mov %eax, %cr0
-        lgdtl %cs:0xff80 + gdt32_descr - pm_entry
-        ljmpl $8, $0xffffff80 + 2f - pm_entry
+	mov %cr0, %eax
+	and $~((1 << 30) | (1 << 29)), %eax   # clear CD and NW
+	or $1, %al
+	mov %eax, %cr0
+	lgdtl %cs:0xff80 + gdt32_descr - pm_entry
+	ljmpl $8, $0xffffff80 + 2f - pm_entry
 2:
 	.code32
 	mov $16, %ax
@@ -27,16 +27,16 @@
 	ljmp $8, $0xffff0000
 
 gdt32:
-        .quad 0
-        .quad 0x00cf9b000000ffff // flat 32-bit code segment
-        .quad 0x00cf93000000ffff // flat 32-bit data segment
-        .quad 0x000f9b0f0000ffff // 64K 16-bit code segment at 0xF0000
-        .quad 0x000f93000000ffff // 64K 16-bit data segment at 0x0
+	.quad 0
+	.quad 0x00cf9b000000ffff // flat 32-bit code segment
+	.quad 0x00cf93000000ffff // flat 32-bit data segment
+	.quad 0x000f9b0f0000ffff // 64K 16-bit code segment at 0xF0000
+	.quad 0x000f93000000ffff // 64K 16-bit data segment at 0x0
 gdt32_end:
 
 gdt32_descr:
-        .word gdt32_end - gdt32 - 1
-        .long 0xffffff80 + gdt32 - pm_entry
+	.word gdt32_end - gdt32 - 1
+	.long 0xffffff80 + gdt32 - pm_entry
 ENTRY_END(pm_entry)
 
 	.code16gcc
diff --git a/fw_cfg.c b/fw_cfg.c
index 7368933..8c97681 100644
--- a/fw_cfg.c
+++ b/fw_cfg.c
@@ -46,18 +46,18 @@
 
 int filenamecmp(const char *a, const struct fw_cfg_file *f)
 {
-    int n = sizeof(f->name);
-    const char *b = f->name;
-    while (*a == *b) {
-        if (*a == '\0') {
-            break;
-        }
-        if (--n == 0) {
-            return *a;
-        }
-        ++a, ++b;
-    }
-    return *a - *b;
+	int n = sizeof(f->name);
+	const char *b = f->name;
+	while (*a == *b) {
+		if (*a == '\0') {
+			break;
+		}
+		if (--n == 0) {
+			return *a;
+		}
+		++a, ++b;
+	}
+	return *a - *b;
 }
 
 int fw_cfg_file_id(char *name)
@@ -89,9 +89,9 @@
 }
 
 struct fw_cfg_dma_descriptor {
-    uint32_t control;
-    uint32_t length;
-    uint64_t address;
+	uint32_t control;
+	uint32_t length;
+	uint64_t address;
 } __attribute__((packed));
 
 void fw_cfg_dma(int control, void *buf, int len)
diff --git a/hwsetup.c b/hwsetup.c
index 9d51daa..6eae3fa 100644
--- a/hwsetup.c
+++ b/hwsetup.c
@@ -25,7 +25,7 @@
 {
 	const int bdf = (1 << 3) | 3;
 
-    	pci_config_writel(bdf, PIIX_PMBASE, 0x601);
+	pci_config_writel(bdf, PIIX_PMBASE, 0x601);
 	pci_config_writeb(bdf, PIIX_PMREGMISC, 0x01);
 	pci_config_writel(bdf, PIIX_SMBHSTBASE, 0x701);
 	pci_config_writeb(bdf, PIIX_SMBHSTCFG, 0x09);
@@ -61,25 +61,25 @@
 
 static void setup_pic(void)
 {
-    /* Send ICW1 (select OCW1 + will send ICW4) */
-    outb(0x20, 0x11);
-    outb(0xa0, 0x11);
-    /* Send ICW2 (base irqs: 0x08-0x0f for irq0-7, 0x70-0x77 for irq8-15) */
-    outb(0x21, 8);
-    outb(0xa1, 0x70);
-    /* Send ICW3 (cascaded pic ids) */
-    outb(0x21, 0x04);
-    outb(0xa1, 0x02);
-    /* Send ICW4 (enable 8086 mode) */
-    outb(0x21, 0x01);
-    outb(0xa1, 0x01);
-    /* Mask all irqs (except cascaded PIC2 irq) */
-    outb(0x21, ~(1 << 2));
-    outb(0xa1, ~0);
+	/* Send ICW1 (select OCW1 + will send ICW4) */
+	outb(0x20, 0x11);
+	outb(0xa0, 0x11);
+	/* Send ICW2 (base irqs: 0x08-0x0f for irq0-7, 0x70-0x77 for irq8-15) */
+	outb(0x21, 8);
+	outb(0xa1, 0x70);
+	/* Send ICW3 (cascaded pic ids) */
+	outb(0x21, 0x04);
+	outb(0xa1, 0x02);
+	/* Send ICW4 (enable 8086 mode) */
+	outb(0x21, 0x01);
+	outb(0xa1, 0x01);
+	/* Mask all irqs (except cascaded PIC2 irq) */
+	outb(0x21, ~(1 << 2));
+	outb(0xa1, ~0);
 
-    /* Set ELCR to IRQs 10 and 11 */
-    outb(0x4d0, 0);
-    outb(0x4d1, 0x0c);
+	/* Set ELCR to IRQs 10 and 11 */
+	outb(0x4d0, 0);
+	outb(0x4d1, 0x0c);
 }
 
 void setup_pam(int bdf, int pambase)
@@ -103,8 +103,8 @@
 	int rom_check_value;
 	int pambase;
 
-        uint32_t id = pci_config_readl(bdf, 0);
-        if (id == (PCI_VENDOR_ID_INTEL | (PCI_DEVICE_ID_INTEL_82441 << 16))) {
+	uint32_t id = pci_config_readl(bdf, 0);
+	if (id == (PCI_VENDOR_ID_INTEL | (PCI_DEVICE_ID_INTEL_82441 << 16))) {
 		setup_piix();
 		setup_piix_pm();
 		pambase = I440FX_PAM0;
diff --git a/include/linuxboot.h b/include/linuxboot.h
index 76a3354..6e865f0 100644
--- a/include/linuxboot.h
+++ b/include/linuxboot.h
@@ -9,7 +9,7 @@
 	uint32_t setup_size, kernel_size;
 
 	/* Input */
-        uint32_t cmdline_size, vmlinuz_size, initrd_size;
+	uint32_t cmdline_size, vmlinuz_size, initrd_size;
 	uint8_t header[8192];
 };
 
diff --git a/linuxboot.c b/linuxboot.c
index cfcaf2d..251bcb6 100644
--- a/linuxboot.c
+++ b/linuxboot.c
@@ -104,7 +104,7 @@
 	    : :
 	    "b" (((uintptr_t) args->setup_addr) >> 4),
 	    "d" (args->cmdline_addr - args->setup_addr - 16));
-        panic();
+	panic();
 }
 
 /* BX = address of data block
diff --git a/main.c b/main.c
index 547712c..f66693b 100644
--- a/main.c
+++ b/main.c
@@ -80,7 +80,7 @@
 int __attribute__ ((section (".text.startup"))) main(void)
 {
 #ifdef BENCHMARK_HACK
-       outb(FW_EXIT_PORT, FW_START);
+	outb(FW_EXIT_PORT, FW_START);
 #endif
 	setup_hw();
 
diff --git a/pci.c b/pci.c
index f03ff6d..65c9e81 100644
--- a/pci.c
+++ b/pci.c
@@ -70,7 +70,7 @@
 	uint8_t pin;
 
 	pin = pci_config_readb(bdf, PCI_INTERRUPT_PIN);
-        if (pin != 0)
+	if (pin != 0)
 		do_setup_pci_irq(bdf, pin);
 
 	if (type & PCI_HEADER_TYPE_BRIDGE) {
@@ -164,8 +164,8 @@
 {
 	const int bdf = 0;
 
-        uint32_t id = pci_config_readl(bdf, 0);
-        if (id == (PCI_VENDOR_ID_INTEL | (PCI_DEVICE_ID_INTEL_82441 << 16)))
+	uint32_t id = pci_config_readl(bdf, 0);
+	if (id == (PCI_VENDOR_ID_INTEL | (PCI_DEVICE_ID_INTEL_82441 << 16)))
 		use_i440fx_routing = true;
 	else if (id == (PCI_VENDOR_ID_INTEL | (PCI_DEVICE_ID_INTEL_Q35_MCH << 16)))
 		use_i440fx_routing = false;
diff --git a/printf.c b/printf.c
index a171d24..8d7f56d 100644
--- a/printf.c
+++ b/printf.c
@@ -221,8 +221,8 @@
 	    print_str(&s, va_arg(va, const char *), props);
 	    break;
 	}
-    	addchar(&s, f);
-    	break;
+        addchar(&s, f);
+        break;
 	} while(0);
     }
     *s.buffer = 0;