Yes.  I copied & modified it from the kernel's thread.asm.