Opened 13 years ago
Last modified 3 years ago
#7867 new enhancement
Need to provide all CPU registers to signal handler
Reported by: | dacha | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1 |
Component: | System | Version: | R1/Development |
Keywords: | Cc: | grzegorz.dabrowski@… | |
Blocked By: | Blocking: | ||
Platform: | x86 |
Description
Wine needs to read and write all the (user-space modifiable?) CPU registers from ucontext_t. Haiku lacks the following:
- All the segment registers (CS, DS, ES, FS, GS, SS)
- Trap (sc_trapno on FreeBSD)
- Error (sc_err on FreeBSD)
Apart from adding these to /boot/develop/headers/posix/arch/x86/signal.h, the kernel needs to read and write the registers to and from ucontext_t as necessary.
Attachments (1)
Change History (11)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Yes, Windows makes heavy use of the FS register to store the TEB: http://en.wikipedia.org/wiki/Win32_Thread_Information_Block
Linux gets lucky by using GS for TLS instead. Where is TLS used by BeOS? Kernel? libroot? All GCC generated code? Everywhere?
comment:3 by , 13 years ago
Looks like:
- libroot uses %fs a lot, especially for pthreads functions, but also for errno
- libnetwork only references %fs in an errno related function
- wine .o files only use %fs for the Win32 TEB
- wine DLLs also use %fs for things like errno
- haven't had a chance to examine the kernel yet
If the kernel ignores %fs, it looks like a matter of saving and restoring %fs across each function call out of Wine (and signal into Wine?). But if the kernel also uses %fs for something, then it's game over.
comment:4 by , 13 years ago
%fs is set in the kernel upon every thread context switch per CPU. Therefore, you cannot just reset it in Wine, as that won't get you very far.
For this particular problem, I guess there are two choices: 1) Try to make the use of %fs compatible, if possible in any way. 2) Provide a kernel level solution that allows Wine to work (by setting some thread flag, or whatever).
comment:5 by , 13 years ago
patch: | 0 → 1 |
---|
follow-up: 8 comment:6 by , 13 years ago
Just extending the vregs
structure will break binary compatibility (there's the _reserved_1
which can and should be used, but obviously that isn't enough). You'll also have to introduce a binary compatible version of the structure (vregs_beos
) and adjust the x86_signal_frame_function_beos() function (cf. src/system/kernel/arch/x86/x86_signals_asm.S, and src/system/kernel/arch/x86/asm_offsets.cpp for the assembly offset/size macros).
comment:7 by , 13 years ago
Cc: | added |
---|
comment:9 by , 12 years ago
patch: | 1 → 0 |
---|
comment:10 by , 3 years ago
Component: | - General → System |
---|
Most of these never change, but IIRC FS is a per thread register on Haiku and is used to provide TLS (that's a BeOS legacy). Wine might want to use it by other means which could give you some headaches.