p7zip icon indicating copy to clipboard operation
p7zip copied to clipboard

Idea: Convert upstream assembly files to NASM syntax

Open ghost opened this issue 2 years ago • 1 comments

ghost avatar Dec 26 '21 08:12 ghost

It took a lot of work to convert the code. The @catstr macro is merely a string concatenation. But the references had no meaning for me in Linux. See

MY_PROC macro name:req, numParams:req
  align 16
  proc_numParams = numParams
  if (IS_X64 gt 0)
    proc_name equ name
  elseif (IS_LINUX gt 0)
    proc_name equ name
  elseif (IS_CDECL gt 0)
    proc_name equ @CatStr(_,name)
  else
    proc_name equ @CatStr(@,name,@, %numParams * 4)
  endif
  proc_name PROC
endm

which merely became

%macro MY_PROC 2 ; macro name:req, numParams:req
  align 16
  %define proc_numParams %2 ; numParams
    global %1
    global _%1
    %1:
    _%1:
%endmacro

because I only cared about x64 and Linux. Some of the definitions could be changed en masse. Others, like pointers had to be individually reviewed.

Lastly, I did not care about most of the modules since lrzip-next uses libgcrypt for hashing and encryption. The latest 21.06 version of lzma adds code for LzFind in asm which I added. So other than the decompress functions and the match finder, I ignored the rest.

Good luck with the project. Glad p7zip is back.

pete4abw avatar Dec 27 '21 11:12 pete4abw