forked from rcore-os/rCore
-
Notifications
You must be signed in to change notification settings - Fork 26
log on adding C apps on rcore
Yuekai Jia edited this page Mar 18, 2019
·
26 revisions
- long term: porting glibc, rustc, add all kinds of apps(GUI, net, games,...) in rcore.
- middle term: porting musl, rust std on x86-64/aarch64/rv32/64
- short term: porting litc and some C apps on x86-64
- jyk:
busybox ls
passed on aarch64.
- wrj: Implement multithread:
sys_clone
,sys_futex
.
- cjj: nginx is working.
- wrj: fix fs.
- cjj: Use musl to build biscuit programs(except a few using biscuit-only syscalls). Add many missing things, and a large number of biscuit programs can run now, the rest usually mostly having problems in fs and memory.
- Try to run rust std with musl on aarch64, panic at
sys_mmap
. Because the high 16 bits of user virtual address need to be1
, butsys_mmap
doesn't consider. - I think it's better to put kernel in the top VA range and put user programs in the bottom VA range. Need to rewrite bootloader.
- cjj: Implement
sys_getcwd
,sys_munmap
andsys_time
. - wrj: Implement a lot file system syscalls
- All TLS data is declared with
__thread
and put intotdata
ortbss
section in ELF. - User accesses TLS data through 'thread pointer' (x86_64:
fs
, aarch64:TPIDR_EL0
, riscv:tp
) - When a process starts, kernel put 2 copies of TLS section into its stack.
- One for the first thread. Thread pointer (
fsbase
) is set to there. - One for the fresh copy for other threads. Kernel tells user its position by passing
kinfo_t
to entry.
- One for the first thread. Thread pointer (
- When creating a new thread, user first copies the fresh TLS, then pass the new address in
tfork_t
to kernel insys_fork
. Kernel will set thread pointer (fsbase
) to it for the new thread.
- ELF header is contained in the first page of rodata section. It will be loaded into process memory.
- Musl looks up the auxiliary vectors in the initial stack, to find the location of ELF header. The aux vectors should contain these entries:
AT_PHDR
,AT_PHNUM
,AT_PHENT
. - Then it parses the header to find TLS section.
- For each thread, it allocates space and copies the fresh TLS data, then set
fsbase
throughsys_arch_prctl
.
See static_init_tls()
in __init_tls.c
for details.
- support TLS for musl. test coreutils: true, echo
- fixed a bug: when the context switch occurs in
InactivePageTable::edit()
orInactivePageTable::with()
which modifyTTBR1_EL1
temporarily,TTBR1_EL1
can be restored to the unmodified value after context switch.
- jyk: support simple Biscuit programs on AArch64: echo, hello, cat
- wrj:
- support set fs base (for TLS)
- then met unknown bug on musl (access address 0). it's hard to debug without backtrace...
- Biscuit litc has only one TLS variable:
errno
. Just remove__thread
fromlitc.[c|h]
, then a lot of programs are runnable.
- wrj: update fs. refactor. implementing mmap.
- jyk: read/repeat wrj's work
- wrj:
- support simple Biscuit programs: echo, hello, cat
- success to build std with customized musl using xargo
- wrj: modify rcore syscall id to Linux64. prepare rcore-user repo.
- cy: analyze litc in biscuit. found litc is a customized libc for C/C++ apps(such as redis, nginx) on biscuit x86-64
- wrj: found musl is statically linked to Rust std, hard to customize. begin port litc on rcore x86-64
- cy: try to run&analyze biscuit. install goland IDE, clion IDE
- wrj: try to analyze musl libc
- cy: read biscuit osdi'18 paper
- wrj: write a analysis doc for syscalls in biscuit