Commit Graph

3067 Commits

Author SHA1 Message Date
Denis Drakhnia f43cc408fb e2k: move e2k_psp_new to cpu.c
Signed-off-by: Denis Drakhnia <numas13@gmail.com>
2022-06-18 15:03:07 +03:00
Denis Drakhnia 8b2746e8ca linux-user/e2k: save initial frame for gdb. 2022-06-10 11:48:20 +03:00
Alibek Omarov 08855e4bd3 linux-user/e2k: place generic errno definitions, arch doesn't override them 2022-06-10 11:48:20 +03:00
Alibek Omarov 657cab1e19 e2k: pass env to do_sigaltstack
Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
2022-06-10 11:48:20 +03:00
Denis Drakhnia 48290cb80c e2k: Update get/set state regs.
Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:20 +03:00
Denis Drakhnia ba89b350dc e2k: signals: Save and restore more state.
Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:20 +03:00
Denis Drakhnia 1d0e52b6a0 e2k: Bug fixes.
Fix time fields in stat64.

Restore and save a breakpoint frame in a signal
handler. This will fix a segfault if a signal will
be raised while a cpu is in a breakpoint.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:20 +03:00
Denis Drakhnia 401ccafc8c e2k: Fix C++ exceptions for v5+.
v5+ has different procedure stack layout. Reading
the stack through the acees_hw_stacks syscall
requires to shuffle registers for a backward
compatibility with previous versions.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 8f4de9d485 e2k: Implement basic v5 support.
Add gdb xml files for e2k.
Tags are partially disabled for better performance.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 17be44b21b e2k: Use one large array for registers.
Previously was used two separate arrays for low and
high halves of a register. Now we can pass direct
pointer to a register into helpers instead of copying
the halves into a temporary buffer and pass pointer to
that buffer.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia bed634d944 e2k: Use %pfpfr for f32 and f64 operations.
%fpcr and %fpsr have been used for the operations but
%pfpfr must be used instead.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 374e658eb1 e2k: Add access_hw_stacks and backtrace syscalls.
Special system calls for managing hardware stacks.
Required for C++ exceptions.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia f49a9d8df0 e2k: Fix incorrect initialization of mlock.
Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Alibek Omarov 5220638091 e2k: remove unnecessary e2k32 directory
It can be avoided with TARGET_ABI_DIR=e2k in e2k32-linux-user.mak

Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia d3e84e57e5 e2k: Add e2k32 linux user files.
Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia e440ebc3db e2k: Basic impl of e2k32-linux-user.
Fix target_stat64 field types in 32-bit mode.
Basic impl of getpl.
Basic impl of ldgd{b,h,w,d}.
Basic impl of stgd{b,h,w,d}.
Add e2k exceptions.
Add Dynamic hw stacks expansion.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 7198f44549 e2k: Always SPILL/FILL in FX window mode.
It will fix 'finish' command in gdb.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 9e87995802 e2k: Panic if it was not possible to copy CR to a new thread.
Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 3cf004027d e2k: Increase PCS and PS sizes.
Dynamically expanding the stack has not yet been
implemented, but sometimes applications require
larger stacks.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 9146c4c67f e2k: Fix build of other linux-user-targets.
Forgot to wrap constants in if block.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 62637ca653 e2k: Add systrace print for access_hw_stacks.
Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia e404c06a2d e2k: Fix syscall restart.
We cannot just change the IP address in E2K to restart
the instruction because the same register can be read
and written in the same instruction (and many more
situations), but we can create a fake syscall instruction
and restart it.

Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 5e66da5f7d e2k: Delete top CRs from cpu state.
Signed-off-by: Denis Drakhnya <numas13@gmail.com>
2022-06-10 11:48:19 +03:00
Denis Drakhnia 5cb3b40f2d e2k: Set correct NR macro for pread/pwrite. 2022-06-10 11:48:19 +03:00
Denis Drakhnia 26b9e9a1e4 e2k: Impl basic unix signals support. 2022-06-10 11:48:19 +03:00
Denis Drakhnia 861a2b6fb6 e2k: Init CRs, make gcc happy. 2022-06-10 11:48:18 +03:00
Denis Drakhnia 7c4ff94e5f e2k: Impl basic init thread support. 2022-06-10 11:48:18 +03:00
Alibek Omarov f56cad7923 e2k: implement detecting ISA version by ELF flags, throw an error for protected mode and x86 recompiled binaries for now 2022-06-10 11:48:18 +03:00
Denis Drakhnia 0b7f461be7 e2k: Remove pshtp and window base. 2022-06-10 11:48:17 +03:00
Denis Drakhnia d37ee639b1 e2k: Add {u,s}{div,mod}x instrs. 2022-06-10 11:48:17 +03:00
Denis Drakhnia 06df1e9168 e2k: Impl e2k_longjmp2 syscall. 2022-06-10 11:48:16 +03:00
Alibek Omarov 999c27999d linux-user: e2k: add forgotten e2k-specific mmap flags, fix some definitions 2022-06-10 11:48:16 +03:00
Denis Drakhnia 10f960328a e2k: Update target_stat and target_statfs structs. 2022-06-10 11:48:16 +03:00
Denis Drakhnia 21b39b8206 target: e2k: Delete hack for saving USD registers on proc call/ret. 2022-06-10 11:48:15 +03:00
Denis Drakhnia ad6bc687e4 target: e2k: HACK: Tag storage for procedure stack. 2022-06-10 11:48:15 +03:00
Denis Drakhnia 381868f71a target: e2k: Return aligned pointer from getsp. 2022-06-10 11:48:15 +03:00
Denis Drakhnia 83e2503867 target: e2k: HACK: Add stack for USD registers.
CPU must restore `USD` after calls but I don't know how it should be implemented.
2022-06-10 11:48:15 +03:00
Denis Drakhnia 4a572f8263 target: e2k: Add xregs. 2022-06-10 11:48:14 +03:00
Denis Drakhnia 57b3469cda target: e2k: Impl speculative execution. 2022-06-10 11:48:13 +03:00
Denis Drakhnia 281f6af159 target: e2k: Remove unneeded ip change in syscall. 2022-06-10 11:48:13 +03:00
Denis Drakhnia db10b6d8a4 target: e2k: Reorg reg file. 2022-06-10 11:48:13 +03:00
Denis Drakhnia d2646eb82b target: e2k: Update TODO messages. 2022-06-10 11:48:13 +03:00
Denis Drakhnia f37d246c90 target: e2k: Make gdb happier. 2022-06-10 11:48:13 +03:00
Denis Drakhnia 5601f6e45a target: e2k: Reorg wd. 2022-06-10 11:48:13 +03:00
Denis Drakhnia 9105937fd9 target: e2k: Reord pcsp. 2022-06-10 11:48:13 +03:00
Denis Drakhnia ab13f761a2 target: e2k: Reorg psp. 2022-06-10 11:48:13 +03:00
Denis Drakhnia 468277c315 target: e2k: Remove helper unimpl. 2022-06-10 11:48:12 +03:00
Denis Drakhnia 938d78d836 target: e2k: Fix load instrs. 2022-06-10 11:48:12 +03:00
Denis Drakhnia d05841bd16 target: e2k: Fix ct in gdb. 2022-06-10 11:48:12 +03:00
Denis Drakhnia c3e5a53689 target: e2k: Read NR in gdb. 2022-06-10 11:48:12 +03:00