sharplispers / ironclad

A cryptographic toolkit written in Common Lisp
BSD 3-Clause "New" or "Revised" License
166 stars 28 forks source link

add ironclad-sb-vm-ea feature #37

Closed slyrus closed 3 years ago

slyrus commented 3 years ago
slyrus commented 3 years ago

Thanks @jonatack but I haven't tested on x86. Do you have an x86 build handy you can test on? Also, I'm not sure what the right thing to do on x86 even is. Should we be using ea or make-ea on x86? thanks!

jonatack commented 3 years ago

I tested building on Debian 5.9.11-1 (2020-11-27) x86_64 GNU/Linux and this patch works well. As for your question, apologies, I don't know.

glv2 commented 3 years ago

As far as I know, the x86 backend of SBCL doesn't have an ea function and always uses make-ea.

The following part of your patch will not work on x86 because the adc instruction will disappear:

(if (and (member :x86-64 *features*) (fboundp 'sb-vm::ea))
   #+ironclad-sb-vm-ea
   `(inst adc :byte (ea ,disp counter idx) 0)
   #-ironclad-sb-vm-ea
   `(inst adc (sb-vm::make-ea :byte :base counter :index idx :disp ,disp) 0))

It should work if we remove the if, given that ironclad-sb-vm-ea will only be in *features* on x86-64 (with newer versions of SBCL):

#+ironclad-sb-vm-ea
`(inst adc :byte (ea ,disp counter idx) 0)
#-ironclad-sb-vm-ea
`(inst adc (sb-vm::make-ea :byte :base counter :index idx :disp ,disp) 0)
slyrus commented 3 years ago

glv2 that's super helpful and confirms what I was thinking. I've pushed the fix.

slyrus commented 3 years ago

Pushed to this branch that is... If no objections, I'll push this to the master branch.

glv2 commented 3 years ago

I tested on x86 and all the tests pass, so you can go ahead and push to the master branch.

jonatack commented 3 years ago

Retested building the latest push at 64c244ce8776949a8465d200f204818115c02e94 on my Debian machine with SBCL 2.0.11, used it with https://github.com/jonatack/cl-kraken and ran the test suite of that lib, all green.

slyrus commented 3 years ago

Thanks glv2 and jonatack !

chenrui333 commented 3 years ago

Can anyone on this thread help with the pgloader build failure?

;; loading system "pgloader"
Fatal COMPILE-FILE-ERROR:
  COMPILE-FILE-ERROR while
  compiling #<IRONCLAD-SOURCE-FILE "ironclad" "src" "opt" "sbcl" "x86oid-vm">
make: *** [bin/pgloader] Error 1

Thanks!

glv2 commented 3 years ago

@chenrui333 Which version of Ironclad are you using, and on which OS/architecture? Also, do you have a way to get the complete compilation log of Ironclad instead of only the name of the file failing to compile?