[PATCH v3 34/43] x86: Refactor table-writing code a litlle