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

Kernel doesn't boot on debug mode #12

Open
ffwff opened this issue Dec 25, 2019 · 7 comments
Open

Kernel doesn't boot on debug mode #12

ffwff opened this issue Dec 25, 2019 · 7 comments
Labels
kernel Related to the kernel

Comments

@ffwff
Copy link
Owner

ffwff commented Dec 25, 2019

The kernel currently doesn't boot correctly when compiled in debug mode, might be because stack size is too small and LLVM doesn't inline functions as often as in release mode.

I might wanna add a flag which sets the kernel stack size to 32kb (and maybe the intrq stack size to 16kb), and maybe sprinkle in some @[AlwaysInline] annotations.

@ffwff ffwff added the kernel Related to the kernel label Dec 28, 2019
@ghost
Copy link

ghost commented Jan 6, 2020

I don't know what magic you did behind the scenes, but the kernel does boot okay on my machine now . :)

@ffwff
Copy link
Owner Author

ffwff commented Jan 6, 2020

On debug mode? Did you pass RELEASE=1 to the make command?

@ghost
Copy link

ghost commented Jan 6, 2020

Nope didn't have to, and it just worked! I think you may try it too!

@ghost
Copy link

ghost commented Jan 6, 2020

N.B. make runiso sometimes breaks with the following backtrace, but everything else I tried worked.

no handler for 14
no handler for 15
no handler for 15
no handler for 15
unknown device type!
no handler for 1
no handler for 12
casting nil to not-nil!
Program received signal SIGQUIT, Quit.
0xffff8080001260c7 in abort (__temp_19=<optimized out>)
    at /home/scorbie/Projects/lilith/src/core/panic.cr:5
5	    Pointer(Int32).null.value = 0
(gdb) bt
#0  0xffff8080001260c7 in abort (__temp_19=<optimized out>)
    at /home/scorbie/Projects/lilith/src/core/panic.cr:5
#1  0xffff808000126090 in not_nil! ()
    at /home/scorbie/Projects/lilith/src/core/object.cr:76
#2  0xffff808000136a12 in sched_data (self=0x39)
    at /home/scorbie/Projects/lilith/src/multiprocessing/process.cr:90
#3  0xffff808000136987 in unawait_no_return (self=0x29)
    at /home/scorbie/Projects/lilith/src/fs/async.cr:142
#4  0xffff808000153ac8 in unawait (self=0x29, 
    retval=<error reading variable: Cannot access memory at address 0x8>)
    at /home/scorbie/Projects/lilith/src/fs/async.cr:156
#5  0xffff80800014b545 in process (self=0x2e)
    at /home/scorbie/Projects/lilith/src/fs/impl/fat16.cr:537
#6  0xffff80800014a216 in -> ()
    at /home/scorbie/Projects/lilith/src/fs/impl/fat16.cr:503
Backtrace stopped: Cannot access memory at address 0xffff888000000000
(gdb) 

@ffwff
Copy link
Owner Author

ffwff commented Jan 6, 2020

The ISO filesystem isn't complete! You shouldn't do runiso!

Can you try rebuilding it? Building on debug mode doesn't work for me...

@ghost
Copy link

ghost commented Jan 6, 2020

okay!
Edit: still works, I'll clone your project again and rebuild it to see if there's some magic inside my local directory.
Edit2: Rebuilding everything from scratch should take hours, please wait if you may.

In the meanwhile, some other theories:

@ghost
Copy link

ghost commented Jan 6, 2020

It still works! It's kinda strange that working properly is a bug, but anyways.
Here's the code that (I think) I used to build this from scratch.
(Can't guarantee 100% that this builds correctly, I failed and rolled back and rebuilt several times)

git clone https://github.com/ffwff/lilith && cd lilith  # of course
source env.sh
pushd .
cd userspace/toolchain
make
make ARCH=x86_64-elf-lilith
popd
pkgs/missio install libc
make distro
make run_img

Here's the package versions; ask me for more info.

  • LLVM(host): 9.0.0
  • Crystal (host): Crystal 0.32.1 [41bd18fbe] (2019-12-18)
  • Crystal (lilith): Crystal 0.33.0-dev [ad3fae661] (2020-01-06)

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

No branches or pull requests

1 participant