I peeked at the memory at TEMP_ADDR, and it never got written to?
I know I needed to have that asm("" ::: "memory") because GCC was reordering the statements below phys_zalloc_end(), but it looks like those statements still have no effect. They should, here's GDB's disassembly.
Code:
0x100640 <mkpdir>: sub $0x1c,%esp
0x100643 <mkpdir+3>: call 0x100220 <phys_zalloc_start>
0x100648 <mkpdir+8>: test %eax,%eax
0x10064a <mkpdir+10>: je 0x100698 <mkpdir+88>
0x10064c <mkpdir+12>: mov 0xfffff000,%edx
0x100652 <mkpdir+18>: and $0xfffff000,%edx
0x100658 <mkpdir+24>: or $0x3,%edx
0x10065b <mkpdir+27>: mov %edx,0xff800000
0x100661 <mkpdir+33>: mov 0xfffffff8,%edx
0x100667 <mkpdir+39>: and $0xfffff000,%edx
0x10066d <mkpdir+45>: or $0x3,%edx
0x100670 <mkpdir+48>: mov %edx,0xff800ff8
0x100676 <mkpdir+54>: mov %eax,%edx
0x100678 <mkpdir+56>: or $0x3,%edx
0x10067b <mkpdir+59>: mov %edx,0xff800ffc
0x100681 <mkpdir+65>: movl $0x0,0xffffe000
0x10068b <mkpdir+75>: movl $0xff800000,0xc(%esp)
0x100693 <mkpdir+83>: invlpg 0xc(%esp)
0x100698 <mkpdir+88>: add $0x1c,%esp
0x10069b <mkpdir+91>: ret