SPO600 Lab 4 – Part 2

We ended up getting more time for Lab 4 since some groups (including us) needed more time to finish off whatever we had left. So we pulled up our laptops, connected to the servers, and got to work on the assembler for the aarch64 version. We used Aarchie as our server and concluded that all we had to do is copy our logic over (since logic doesn’t change) and translate it into Aarch64 assembler syntax. This was much easier said than done of course as i’m about to explain why.

The reason why it was easier said than done is because we had tiny little challenges that turned out to be harder than we thought. One of these challenges was that in Aarch64, the remainder isn’t calculated by itself when using the a divide directive. For the x86_64 machines, the remainder gets calculated automatically into register rdx. For the aarch64 machine, we had to use another directive, msub, to calculate the remainder. After getting these tiny little quarks figured out, we started to get Segmentation Fault. We tried to debug it by using the debugger but unfortunately didn’t get anywhere. We tried modifying our code but that resulted in non-desired output and eventually it was the end of the class. We said this is ridiculous and called it a day.

The next time we all met in class, one of the group members actually went ahead and solved the issue. He explained it to us how he solved it and we realized where we were going wrong. Essentially we were trying to access a register’s contents that had nothing, or garbage value, in it. Which is was Seg-Fault really is – trying to access memory that doesn’t exist essentially.

Anyway, we were all glad to have the assembler lab out of the way as, in my opinion, is a horrible way to code. My last post about the assembler, I said that I didn’t like this and, well, my opinion now has worsen. It’s also primarily because I’m not really interested in that low-level programming. Not because I don’t think it’s cool which I actually do. But I prefer high-level programming and leave all the low-level stuff to the compiler. Although despite my opinion, I do think it’s very important to know assembly as at times it can give you quite a bit of a performance boost. Here’s the code for the Aarch64 assembly:

Lab 4 aarch64: https://myasir.ca/uploads/spo600/lab4-aarch64/lab4b.s

Leave a Reply

Your email address will not be published. Required fields are marked *