Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a68d293b
Commit
a68d293b
authored
Nov 03, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preloader: Setup a fake thread-local storage block pointed to by %gs.
parent
c9b5569b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
ldt.c
libs/wine/ldt.c
+4
-0
preloader.c
loader/preloader.c
+31
-1
No files found.
libs/wine/ldt.c
View file @
a68d293b
...
...
@@ -405,6 +405,10 @@ unsigned short wine_ldt_alloc_fs(void)
struct
modify_ldt_s
ldt_info
;
int
ret
;
/* the preloader may have allocated it already */
global_fs_sel
=
wine_get_fs
();
if
(
global_fs_sel
&&
is_gdt_sel
(
global_fs_sel
))
return
global_fs_sel
;
ldt_info
.
entry_number
=
-
1
;
fill_modify_ldt_struct
(
&
ldt_info
,
&
null_entry
);
if
((
ret
=
set_thread_area
(
&
ldt_info
)
<
0
))
...
...
loader/preloader.c
View file @
a68d293b
...
...
@@ -163,6 +163,26 @@ void __bb_init_func(void) { return; }
void
*
__stack_chk_guard
=
0
;
void
__stack_chk_fail
(
void
)
{
return
;
}
/* data for setting up the glibc-style thread-local storage in %gs */
static
int
thread_data
[
256
];
struct
{
/* this is the kernel modify_ldt struct */
unsigned
int
entry_number
;
unsigned
long
base_addr
;
unsigned
int
limit
;
unsigned
int
seg_32bit
:
1
;
unsigned
int
contents
:
2
;
unsigned
int
read_exec_only
:
1
;
unsigned
int
limit_in_pages
:
1
;
unsigned
int
seg_not_present
:
1
;
unsigned
int
useable
:
1
;
unsigned
int
garbage
:
25
;
}
thread_ldt
=
{
-
1
,
(
unsigned
long
)
thread_data
,
0xfffff
,
1
,
0
,
0
,
1
,
0
,
1
,
0
};
/*
* The _start function is the entry and exit point of this program
*
...
...
@@ -172,7 +192,17 @@ void __stack_chk_fail(void) { return; }
void
_start
();
extern
char
_end
[];
__ASM_GLOBAL_FUNC
(
_start
,
"
\t
movl %esp,%eax
\n
"
"
\t
movl $243,%eax
\n
"
/* SYS_set_thread_area */
"
\t
movl $thread_ldt,%ebx
\n
"
"
\t
int $0x80
\n
"
/* allocate gs segment */
"
\t
orl %eax,%eax
\n
"
"
\t
jl 1f
\n
"
"
\t
movl thread_ldt,%eax
\n
"
/* thread_ldt.entry_number */
"
\t
shl $3,%eax
\n
"
"
\t
orl $3,%eax
\n
"
"
\t
mov %ax,%gs
\n
"
"
\t
mov %ax,%fs
\n
"
/* set %fs too so libwine can retrieve it later on */
"1:
\t
movl %esp,%eax
\n
"
"
\t
leal -136(%esp),%esp
\n
"
/* allocate some space for extra aux values */
"
\t
pushl %eax
\n
"
/* orig stack pointer */
"
\t
pushl %esp
\n
"
/* ptr to orig stack pointer */
...
...
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