aboutsummaryrefslogtreecommitdiff
path: root/subhook_x86.c
diff options
context:
space:
mode:
authorZeex <zeex@rocketmail.com>2020-11-01 12:57:49 +0600
committerZeex <zeex@rocketmail.com>2020-11-01 12:57:49 +0600
commit9cc118d25ea4775c03a62860aaa604fea56de0c6 (patch)
tree8d113eacb0ef59b19810901ac206814ee55a2a6c /subhook_x86.c
parent8d0b8a8d57804426dedf605d9e4a0848b1cd862f (diff)
downloadsubhook-9cc118d25ea4775c03a62860aaa604fea56de0c6.zip
subhook-9cc118d25ea4775c03a62860aaa604fea56de0c6.tar.gz
subhook-9cc118d25ea4775c03a62860aaa604fea56de0c6.tar.bz2
Improve documentation comments
Diffstat (limited to 'subhook_x86.c')
-rw-r--r--subhook_x86.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/subhook_x86.c b/subhook_x86.c
index 6256ebb..3a6a8c4 100644
--- a/subhook_x86.c
+++ b/subhook_x86.c
@@ -268,13 +268,19 @@ SUBHOOK_EXPORT int SUBHOOK_API subhook_disasm(void *src, int *reloc_op_offset) {
}
if (reloc_op_offset != NULL && opcodes[i].flags & RELOC) {
- *reloc_op_offset = len; /* relative call or jump */
+ /* Either a call or a jump instruction that uses an absolute or relative
+ * 32-bit address.
+ *
+ * Note: We don't support short (8-bit) offsets at the moment, so the
+ * caller can assume the operand will be always 4 bytes.
+ */
+ *reloc_op_offset = len;
}
if (opcodes[i].flags & MODRM) {
uint8_t modrm = code[len++]; /* +1 for Mod/RM byte */
uint8_t mod = modrm >> 6;
- uint8_t rm = modrm & 0x07;
+ uint8_t rm = modrm & 0x07;
if (mod != 3 && rm == 4) {
uint8_t sib = code[len++]; /* +1 for SIB byte */