[PATCH v5 36/46] x86: Refactor table-writing code a little