diff --git a/packages/x86/include/cpu/x64.inc b/packages/x86/include/cpu/x64.inc index 5bd07bc..b87c43d 100644 --- a/packages/x86/include/cpu/x64.inc +++ b/packages/x86/include/cpu/x64.inc @@ -1898,11 +1898,17 @@ iterate reg, ax,cx,dx,bx,sp,bp,si,di,r8w,r9w,r10w,r11w,r12w,r13w,r14w,r15w, \ define x86.compact.reg? {reg} end iterate -iterate , push,push_instruction,0, pushw,push_instruction,2, pushd,push_instruction,4, pushq,push_instruction,8, \ - pop,pop_instruction,0, popw,pop_instruction,2, popd,pop_instruction,4, popq,pop_instruction,8 +iterate ,\ + push, 0, push_instruction,\ + pushw, 2, push_instruction,\ + pushd, 4, push_instruction,\ + pushq, 8, push_instruction,\ + pop, 0, pop_instruction,\ + popw, 2, pop_instruction,\ + popd, 4, pop_instruction,\ + popq, 8, pop_instruction calminstruction instr? operand - local head, tail match head tail, operand @@ -1911,27 +1917,21 @@ iterate , push,push_instruction,0, pushw,push_instruction,2, jno plain match {head}, head jno plain - loop: - xcall x86.handler, (size),head - match head tail, tail - jno final + loop: + xcall x86.handler, (size), head + match head tail?, tail + jno done transform head, x86.compact jno error match {head}, head jyes loop - error: + error: err 'only register operands allowed in compact syntax' exit - final: - transform tail, x86.compact - jno error - match {operand}, tail - jno error - plain: - xcall x86.handler, (size),operand - + plain: + xcall x86.handler, (size), operand + done: end calminstruction - end iterate iterate , ret,0C2h, retn,0C2h, retf,0CAh diff --git a/packages/x86/include/format/format.inc b/packages/x86/include/format/format.inc index ca76dbe..940a1c1 100644 --- a/packages/x86/include/format/format.inc +++ b/packages/x86/include/format/format.inc @@ -1,18 +1,18 @@ macro local_include? instr - local pos,chr,path - pos = lengthof __FILE__ - while pos - chr = (__FILE__ shr (8*(pos-1))) and 0FFh - if chr = '/' | chr = '\' - break - end if - pos = pos - 1 - end while - path = string __FILE__ and not ( (-1) shl (8*pos) ) - macro instr file - include string path + file shl (8*lengthof path) - end macro + local pos,chr,path + pos = lengthof __FILE__ + while pos + chr = (__FILE__ shr (8*(pos-1))) and 0FFh + if chr = '/' | chr = '\' + break + end if + pos = pos - 1 + end while + path = string __FILE__ and not ( (-1) shl (8*pos) ) + macro instr file + include string path + file shl (8*lengthof path) + end macro end macro local_include format?.include @@ -44,6 +44,9 @@ macro format?.PE? settings else match =NX? more, seq PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_NX_COMPAT redefine seq more + else match =ASLR? more, seq + PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE + redefine seq more else match =at? base =on? stub :, seq PE.Settings.ImageBase = base PE.Settings.Stub = stub @@ -123,6 +126,9 @@ macro format?.PE64? settings else match =NX? more, seq PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_NX_COMPAT redefine seq more + else match =ASLR? more, seq + PE.Settings.DllCharacteristics = PE.Settings.DllCharacteristics or IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE or IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA + redefine seq more else match =at? base =on? stub :, seq PE.Settings.ImageBase = base PE.Settings.Stub = stub