Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiprocessing #86

Open
wants to merge 223 commits into
base: master
Choose a base branch
from
Open

Multiprocessing #86

wants to merge 223 commits into from

Conversation

nasko25
Copy link
Collaborator

@nasko25 nasko25 commented Apr 26, 2021

  • Implemented a context switcher and a dispatcher.
  • Rewrote the software and irq handlers (they seems to work, but further testing would be beneficial)

Zohar Cochavi and others added 30 commits February 17, 2021 21:56
…used by the processes (when we implement them).

For now it does not do anything (I am trying to make it work with the already implemented software interrupt handlers by calling SWI from assembly, because it looks like this was intended by the other developers).
Also for some reason calling code from syscall.c causes kernel panic, but running the same code directly does not (not entering the switch statement in syscall() does not cause the kernel panic, so it should be a problem with the inline assembly).
There was a problem in the way inline assembly was executed, so I changed how the variables are taken from the registers.

I am not really sure if it is a great way, because I read the syntax might be compiler-dependent, but using registers is already pretty system-dependent, so it shouldn't matter.

Also tested more the syscalls code, and it still behaves weirdly, so I made the comment regarding the issue more descriptive.
… in the switch statement fixes the kernel panic.

This needs to be investigated further. Probably some registers are incorrectly set before the software interrupt because of the inline assembly?
For some reason the software interrupt handler changed lr, so after returnting from the SWI call, the syscall() function returned to where lr was pointing to (somewhere in software_interrupt_handler()), which caused a kernel panic at some point, probably because of dereferencing an invalid pointer.
Now the software interrupt handler can return the pid of the newly created process.
(I think they were generated by vscode)
@ValentijnvdBeek
Copy link
Collaborator

The day has finally come for the merging storm! I will take a look it at a bit later today after my meetings

@ValentijnvdBeek
Copy link
Collaborator

ValentijnvdBeek commented Apr 26, 2021

@fayalalebrun Changed something with the early startup and the linker file which broke the build system. I haven't been able to figure it up until now, it should generate the DTB file correctly now but it just doesn't boot anymore. Typically this happens whenever the linker can't find the file.

To fix the build just generate the DTB file or add it as a dependency for the two elf files.

@fayalalebrun
Copy link
Collaborator

@ValentijnvdBeek Indeed, I believe the error must be in the linking. Something must be happening differently in the new Meson build file.

However, I'm not able to run the kernel with the Meson build system, not even get qemu to start. Could you update the README? It still refers to Make as the build system.

@ValentijnvdBeek
Copy link
Collaborator

@ValentijnvdBeek Indeed, I believe the error must be in the linking. Something must be happening differently in the new Meson build file.

Yeah, I suppose it is with the DTB file. Which one needs to be linked in? The one generated by the build file or in src/common?

However, I'm not able to run the kernel with the Meson build system, not even get qemu to start. Could you update the README? It still refers to Make as the build system.

Qemu not starting is typical for a bad linker script, but I cannot tell what is wrong what is wrong with it now.

@fayalalebrun
Copy link
Collaborator

fayalalebrun commented Apr 27, 2021

Yeah, I suppose it is with the DTB file. Which one needs to be linked in? The one generated by the build file or in src/common?

The file in src/common is a binary file, so you can't link it directly. Hence an object file is generated from it by the build script, which is the one you have to link.

@fayalalebrun
Copy link
Collaborator

When I run it, I get arm-none-eabi-gcc: error: dtb.o: No such file or directory

Perhaps kernel_elf is not set to depend on the dtb generation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants