Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
de20c2ab
Commit
de20c2ab
authored
Jan 30, 2000
by
Patrik Stridvall
Committed by
Alexandre Julliard
Jan 30, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solaris support for {set,get}_thread_context added.
parent
a661187b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
2 deletions
+111
-2
context_i386.c
server/context_i386.c
+111
-2
No files found.
server/context_i386.c
View file @
de20c2ab
...
...
@@ -10,8 +10,10 @@
#include <assert.h>
#include <errno.h>
#include <sys/reg.h>
#include <sys/ptrace.h>
#include <sys/user.h>
#include <unistd.h>
#include "winbase.h"
...
...
@@ -177,9 +179,116 @@ static void set_thread_context( struct thread *thread, unsigned int flags, CONTE
file_set_error
();
}
#else
/* linux */
#elif defined(__sun__)
/* retrieve a thread context */
static
void
get_thread_context
(
struct
thread
*
thread
,
unsigned
int
flags
,
CONTEXT
*
context
)
{
int
pid
=
thread
->
unix_pid
;
if
(
flags
&
CONTEXT_FULL
)
{
struct
regs
regs
;
if
(
ptrace
(
PTRACE_GETREGS
,
pid
,
0
,
(
int
)
&
regs
)
==
-
1
)
goto
error
;
if
(
flags
&
CONTEXT_INTEGER
)
{
context
->
Eax
=
regs
.
r_eax
;
context
->
Ebx
=
regs
.
r_ebx
;
context
->
Ecx
=
regs
.
r_ecx
;
context
->
Edx
=
regs
.
r_edx
;
context
->
Esi
=
regs
.
r_esi
;
context
->
Edi
=
regs
.
r_edi
;
}
if
(
flags
&
CONTEXT_CONTROL
)
{
context
->
Ebp
=
regs
.
r_ebp
;
context
->
Esp
=
regs
.
r_esp
;
context
->
Eip
=
regs
.
r_eip
;
context
->
SegCs
=
regs
.
r_cs
&
0xffff
;
context
->
SegSs
=
regs
.
r_ss
&
0xffff
;
context
->
EFlags
=
regs
.
r_efl
;
}
if
(
flags
&
CONTEXT_SEGMENTS
)
{
context
->
SegDs
=
regs
.
r_ds
&
0xffff
;
context
->
SegEs
=
regs
.
r_es
&
0xffff
;
context
->
SegFs
=
regs
.
r_fs
&
0xffff
;
context
->
SegGs
=
regs
.
r_gs
&
0xffff
;
}
}
if
(
flags
&
CONTEXT_DEBUG_REGISTERS
)
{
/* FIXME: How is this done on Solaris? */
}
if
(
flags
&
CONTEXT_FLOATING_POINT
)
{
/* we can use context->FloatSave directly as it is using the */
/* correct structure (the same as fsave/frstor) */
if
(
ptrace
(
PTRACE_GETFPREGS
,
pid
,
0
,
(
int
)
&
context
->
FloatSave
)
==
-
1
)
goto
error
;
context
->
FloatSave
.
Cr0NpxState
=
0
;
/* FIXME */
}
return
;
error:
file_set_error
();
}
/* set a thread context */
static
void
set_thread_context
(
struct
thread
*
thread
,
unsigned
int
flags
,
CONTEXT
*
context
)
{
int
pid
=
thread
->
unix_pid
;
if
(
flags
&
CONTEXT_FULL
)
{
struct
regs
regs
;
if
((
flags
&
CONTEXT_FULL
)
!=
CONTEXT_FULL
)
/* need to preserve some registers */
{
if
(
ptrace
(
PTRACE_GETREGS
,
pid
,
0
,
(
int
)
&
regs
)
==
-
1
)
goto
error
;
}
if
(
flags
&
CONTEXT_INTEGER
)
{
regs
.
r_eax
=
context
->
Eax
;
regs
.
r_ebx
=
context
->
Ebx
;
regs
.
r_ecx
=
context
->
Ecx
;
regs
.
r_edx
=
context
->
Edx
;
regs
.
r_esi
=
context
->
Esi
;
regs
.
r_edi
=
context
->
Edi
;
}
if
(
flags
&
CONTEXT_CONTROL
)
{
regs
.
r_ebp
=
context
->
Ebp
;
regs
.
r_esp
=
context
->
Esp
;
regs
.
r_eip
=
context
->
Eip
;
regs
.
r_cs
=
context
->
SegCs
;
regs
.
r_ss
=
context
->
SegSs
;
regs
.
r_efl
=
context
->
EFlags
;
}
if
(
flags
&
CONTEXT_SEGMENTS
)
{
regs
.
r_ds
=
context
->
SegDs
;
regs
.
r_es
=
context
->
SegEs
;
regs
.
r_fs
=
context
->
SegFs
;
regs
.
r_gs
=
context
->
SegGs
;
}
if
(
ptrace
(
PTRACE_SETREGS
,
pid
,
0
,
(
int
)
&
regs
)
==
-
1
)
goto
error
;
}
if
(
flags
&
CONTEXT_DEBUG_REGISTERS
)
{
/* FIXME: How is this done on Solaris? */
}
if
(
flags
&
CONTEXT_FLOATING_POINT
)
{
/* we can use context->FloatSave directly as it is using the */
/* correct structure (the same as fsave/frstor) */
if
(
ptrace
(
PTRACE_SETFPREGS
,
pid
,
0
,
(
int
)
&
context
->
FloatSave
)
==
-
1
)
goto
error
;
context
->
FloatSave
.
Cr0NpxState
=
0
;
/* FIXME */
}
return
;
error:
file_set_error
();
}
#else
/* linux || __sun__ */
#error You must implement get/set_thread_context for your platform
#endif
/* linux */
#endif
/* linux
|| __sun__
*/
/* copy a context structure according to the flags */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment