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

The over-engineered Golang runtime #48

Closed
fwsGonzo opened this issue Mar 26, 2022 · 1 comment
Closed

The over-engineered Golang runtime #48

fwsGonzo opened this issue Mar 26, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@fwsGonzo
Copy link
Owner

Golang seems to have something that resembles a thread (sysmon) that is activated with signals, or something like that. Either way, there is no way around implemented signals, and there is a basic implementation in the emulator now with altstacks.

#0  runtime.rt_sigaction () at /go/src/runtime/sys_linux_riscv64.s:415
#1  0x00000000000428b8 in runtime.sysSigaction (sig=0, new=0xc000033ed8, old=0x0)
#2  0x0000000000058acc in runtime.sigaction (sig=0, new=0xc000033ed8, old=0x0)
    at /go/src/runtime/sigaction.go:15
#3  0x0000000000042738 in runtime.setsig (i=0, fn=0)
#4  0x000000000005bb30 in runtime.sigfwdgo (sig=0, info=0x0, ctx=0x17, ~r0=<optimized out>)
#5  0x000000000005a644 in runtime.sigtrampgo (sig=0, info=0x0, ctx=0x17)
#6  0x00000000000732e8 in runtime.sigtramp ()
#7  0x000000000004293c in runtime.signalM (mp=0x0, sig=0)

Unfortunately it seems to invoke signal 0, which doesn't have a handler (I assume). So, there is something wrong before hitting that call chain.

@fwsGonzo fwsGonzo added the bug Something isn't working label Mar 26, 2022
@fwsGonzo
Copy link
Owner Author

libriscv/emulator$ ./rvlinux ../binaries/go/program
Unhandled system call: 123
hello world
>>> Program exited, exit code = 0 (0x0)
Instructions executed: 792674
Pages in use: 252 (1008 kB memory)

By ignoring signal=0 it seems to run through main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant