p7zip-project / p7zip

A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/sevenzip/ AND https://sourceforge.net/projects/p7zip/).
808 stars 111 forks source link

Idea: Convert upstream assembly files to NASM syntax #166

Open ghost opened 2 years ago

pete4abw commented 2 years ago

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.