Obtained from NetBSD and then modified to reflect how things work in FreeBSD, along with some minor changes to make a few points clearer.