SPL compiler issue

103 views
Skip to first unread message

jeremy

unread,
Sep 7, 2022, 10:18:06 PM9/7/22
to XOS Users
Hello everyone, 

First, I want to say thank you for having put together such great material to learn how OS are made. I am new to programming and learnt a lot of cool concepts thanks to you.

My problems are the following : 
working on Mac with ARM chip, running eXpOS on a Docker container.
Step 4 of the roadmap, trying to compile the .spl file with the spl compiler.

1: NOT COMPILING
I am compiling the following .spl file (oddnos.spl) with the spl compiler.
Screen Shot 2022-09-07 at 10.15.56 PM.png

It seems that the compiler is entering an infinite loop as the command never resolvesScreen Shot 2022-09-07 at 10.03.14 PM.png

I cancel the command (ctrl-c), check in the spl_progs folder and see that the .xsm file is created.
Screen Shot 2022-09-07 at 10.06.26 PM.png

If I Vim into it, it comes out empty (empty screen)
But if I hit 'ctrl-c' in vim to interrupt then the content (assembly code) appears but without the "HALT" command at the end (I compared to the file given in the final version of eXpOS on git)
Screen Shot 2022-09-07 at 10.08.40 PM.png.

2: NOT EXECUTING
Even if I modify the file to add HALT and try to use it to load to the bootstrap and run the xsm machine, I get the follwing error : 
Screen Shot 2022-09-07 at 10.10.28 PM.png 

Can someone tell me what is happening or what I am doing wrong please?

jeremy

unread,
Sep 7, 2022, 10:37:57 PM9/7/22
to XOS Users
I managed to run load the file in the boot and run it with xsm. 
Problem 2 is not relevant anymore, only problem 1 is.

Thanks for your help (if someone is still in this group since the last message seems to be from 2020 :D)

CLIFORD JOSHY

unread,
Sep 8, 2022, 3:29:38 AM9/8/22
to XOS Users
Hey Jeremy,
People still do remain in this group (Maybe there's no messages since 2020 because they've done the impossible and managed to eliminate every issue😗. Until now of course).

But yeah, coming to your issue. I tried to replicate it with the details you mentioned, but it does compile fine for me. 
2022-09-08_12-41.png

I assume it's something specific to the M1 version of docker. I'll see if I can find any issues.

Do you face the same issue with any spl file you compile or just this particular one?

jeremy

unread,
Sep 8, 2022, 7:49:18 AM9/8/22
to XOS Users
hello Clifford, 

thanks for your answer, glad to see people are still here and to hear most problems have been solved.

I have tried creating a .spl file with a syntax error. I do get an error but the compiler stays stuck after displaying the error message
Screen Shot 2022-09-08 at 7.44.52 AM.png

I tried with a file for which the syntax is correct and the compiler stays stuck as well
Screen Shot 2022-09-08 at 7.47.23 AM.png

If the compiler works fine for everyone, you must be right and the problem comes from either Docker on the M1 chip.
I will try to investigate more.

CLIFORD JOSHY

unread,
Sep 8, 2022, 1:49:26 PM9/8/22
to XOS Users
Hey,
Think I've got a fix for the issue. Do try it and report back.

Edit line 1439 of spl/spl.c as shown in this commit and re-run 'make' in the myexpos folder.

I've pushed these changes to the spl repo so that no one runs into these issues again.

If you're interested in why this happened, keep reading:)

So, the problem was the program running into an infinite loop here. The return value of fgetc was 255 at the end of the file which did not match with the value of EOF (-1). I reckon this happened because we declared ch as a char and in x86 systems, char by default is signed while in ARM systems, char is unsigned, which led to the EOF value of -1 rolling back to 255.

Thanks for reporting.

jeremy

unread,
Sep 8, 2022, 2:09:34 PM9/8/22
to XOS Users
Hello Cliford, 

Woow, so fast!

I have just modified the spl.c file and the compilation has been executed and completed this time.
I have loaded the compiled file to the machine and it executed properly also.
Thanks a lot for looking into that so fast, very much appreciated!

Reply all
Reply to author
Forward
0 new messages