Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoann Laissus
wine
Commits
214399f2
Commit
214399f2
authored
26 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Changed initial process creation to avoid memory allocations.
Removed a few unused fields in PDB and THDB.
parent
13e55192
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/process.h
+1
-4
1 addition, 4 deletions
include/process.h
include/thread.h
+5
-28
5 additions, 28 deletions
include/thread.h
scheduler/process.c
+25
-20
25 additions, 20 deletions
scheduler/process.c
scheduler/sysdeps.c
+0
-1
0 additions, 1 deletion
scheduler/sysdeps.c
with
31 additions
and
53 deletions
include/process.h
+
1
−
4
View file @
214399f2
...
...
@@ -81,7 +81,7 @@ typedef struct _PDB32
HANDLE_TABLE
*
handle_table
;
/* 44 Handle table */
struct
_PDB32
*
parent
;
/* 48 Parent process */
WINE_MODREF
*
modref_list
;
/* 4c MODREF list */
struct
_THREAD_ENTRY
*
thread_list
;
/* 50 List of threads */
void
*
thread_list
;
/* 50 List of threads */
void
*
debuggee_CB
;
/* 54 Debuggee context block */
void
*
local_heap_free
;
/* 58 Head of local heap free list */
DWORD
unknown4
;
/* 5c Unknown */
...
...
@@ -132,9 +132,6 @@ extern void ENV_FreeEnvironment( PDB32 *pdb );
extern
BOOL32
HANDLE_CreateTable
(
PDB32
*
pdb
,
BOOL32
inherit
);
extern
HANDLE32
HANDLE_Alloc
(
PDB32
*
pdb
,
K32OBJ
*
ptr
,
DWORD
access
,
BOOL32
inherit
,
int
server_handle
);
extern
K32OBJ
*
HANDLE_GetObjPtr
(
PDB32
*
pdb
,
HANDLE32
handle
,
K32OBJ_TYPE
type
,
DWORD
access
,
int
*
server_handle
);
extern
int
HANDLE_GetServerHandle
(
PDB32
*
pdb
,
HANDLE32
handle
,
K32OBJ_TYPE
type
,
DWORD
access
);
extern
void
HANDLE_CloseAll
(
PDB32
*
pdb
,
K32OBJ
*
ptr
);
...
...
This diff is collapsed.
Click to expand it.
include/thread.h
+
5
−
28
View file @
214399f2
...
...
@@ -8,9 +8,8 @@
#define __WINE_THREAD_H
#include
"config.h"
#include
"k32obj.h"
#include
"winbase.h"
#include
"
winnt
.h"
#include
"
k32obj
.h"
#include
"selectors.h"
/* for SET_FS */
#ifdef linux
...
...
@@ -56,15 +55,6 @@ typedef struct _TEB
#define TEBF_WIN32 0x0001
#define TEBF_TRAP 0x0002
/* Event waiting structure */
typedef
struct
{
DWORD
count
;
/* Count of valid objects */
BOOL32
wait_all
;
/* Wait for all objects flag */
K32OBJ
*
objs
[
MAXIMUM_WAIT_OBJECTS
];
/* Object pointers */
int
server
[
MAXIMUM_WAIT_OBJECTS
];
/* Server handles */
}
WAIT_STRUCT
;
/* Thread database */
typedef
struct
_THDB
{
...
...
@@ -77,7 +67,7 @@ typedef struct _THDB
WORD
teb_sel
;
/* 4c Selector to TEB */
WORD
emu_sel
;
/* 4e 80387 emulator selector */
int
thread_errno
;
/* 50 Per-thread errno (was: unknown) */
WAIT_STRUCT
*
wait_list
;
/* 54 Event waiting list */
void
*
wait_list
;
/* 54 Event waiting list */
int
thread_h_errno
;
/* 50 Per-thread h_errno (was: unknown) */
void
*
ring0_thread
;
/* 5c Pointer to ring 0 thread */
void
*
ptdbx
;
/* 60 Pointer to TDBX structure */
...
...
@@ -102,29 +92,17 @@ typedef struct _THDB
DWORD
suspend_count
;
/* 1bc SuspendThread() counter */
void
*
entry_point
;
/* 1c0 Thread entry point (was: unknown) */
void
*
entry_arg
;
/* 1c4 Entry point arg (was: unknown) */
int
unix_pid
;
/* 1c8 Unix thread pid (was: unknown) */
DWORD
unknown5
[
3
];
/* 1cc Unknown */
DWORD
unknown5
[
4
];
/* 1c8 Unknown */
DWORD
sys_count
[
4
];
/* 1d8 Syslevel mutex entry counters */
CRITICAL_SECTION
*
sys_mutex
[
4
];
/* 1e8 Syslevel mutex pointers */
DWORD
unknown6
[
2
];
/* 1f8 Unknown */
/* The following are Wine-specific fields */
WAIT_STRUCT
wait_struct
;
/* 200 Event wait structure */
int
socket
;
/* Socket for server communication */
int
socket
;
/* 200 Socket for server communication */
unsigned
int
seq
;
/* Server sequence number */
void
*
server_tid
;
/* Server id for this thread */
}
THDB
;
/* Thread queue entry */
typedef
struct
_THREAD_ENTRY
{
THDB
*
thread
;
struct
_THREAD_ENTRY
*
next
;
}
THREAD_ENTRY
;
/* A thread queue is a circular list; a THREAD_QUEUE is a pointer */
/* to the end of the queue (i.e. where we add elements) */
typedef
THREAD_ENTRY
*
THREAD_QUEUE
;
/* THDB <-> Thread id conversion macros */
#define THREAD_OBFUSCATOR ((DWORD)0xdeadbeef)
...
...
@@ -144,6 +122,7 @@ extern THDB *pCurrentThread;
/* scheduler/thread.c */
extern
THDB
*
THREAD_CreateInitialThread
(
struct
_PDB32
*
pdb
);
extern
THDB
*
THREAD_Create
(
struct
_PDB32
*
pdb
,
DWORD
stack_size
,
BOOL32
alloc_stack16
,
int
*
server_thandle
,
int
*
server_phandle
,
...
...
@@ -152,8 +131,6 @@ extern THDB *THREAD_Current(void);
extern
BOOL32
THREAD_IsWin16
(
THDB
*
thdb
);
extern
THDB
*
THREAD_IdToTHDB
(
DWORD
id
);
extern
void
THREAD_Start
(
THDB
*
thdb
);
extern
void
THREAD_AddQueue
(
THREAD_QUEUE
*
queue
,
THDB
*
thread
);
extern
void
THREAD_RemoveQueue
(
THREAD_QUEUE
*
queue
,
THDB
*
thread
);
extern
DWORD
THREAD_TlsAlloc
(
THDB
*
thread
);
/* scheduler/sysdeps.c */
...
...
This diff is collapsed.
Click to expand it.
scheduler/process.c
+
25
−
20
View file @
214399f2
...
...
@@ -31,7 +31,9 @@ const K32OBJ_OPS PROCESS_Ops =
PROCESS_Destroy
/* destroy */
};
static
DWORD
PROCESS_InitialProcessID
=
0
;
/* The initial process PDB */
static
PDB32
initial_pdb
;
static
PDB32
*
PROCESS_PDBList
=
NULL
;
static
DWORD
PROCESS_PDBList_Size
=
0
;
...
...
@@ -53,7 +55,7 @@ PDB32 *PROCESS_Current(void)
*/
PDB32
*
PROCESS_Initial
(
void
)
{
return
PROCESS_IdToPDB
(
PROCESS_InitialProcessID
)
;
return
&
initial_pdb
;
}
/***********************************************************************
...
...
@@ -361,31 +363,39 @@ static BOOL32 PROCESS_FinishCreatePDB( PDB32 *pdb )
*/
BOOL32
PROCESS_Init
(
void
)
{
PDB32
*
pdb
;
THDB
*
thdb
;
/* Fill the initial process structure */
initial_pdb
.
header
.
type
=
K32OBJ_PROCESS
;
initial_pdb
.
header
.
refcount
=
1
;
initial_pdb
.
exit_code
=
0x103
;
/* STILL_ACTIVE */
initial_pdb
.
threads
=
1
;
initial_pdb
.
running_threads
=
1
;
initial_pdb
.
ring0_threads
=
1
;
initial_pdb
.
group
=
&
initial_pdb
;
initial_pdb
.
priority
=
8
;
/* Normal */
/* Initialize virtual memory management */
if
(
!
VIRTUAL_Init
())
return
FALSE
;
/* Create the system heap
s
*/
/* Create the system heap */
if
(
!
(
SystemHeap
=
HeapCreate
(
HEAP_GROWABLE
,
0x10000
,
0
)))
return
FALSE
;
initial_pdb
.
system_heap
=
initial_pdb
.
heap
=
SystemHeap
;
/* Create the initial process and thread structures */
if
(
!
(
pdb
=
PROCESS_CreatePDB
(
NULL
,
FALSE
)))
return
FALSE
;
if
(
!
(
thdb
=
THREAD_Create
(
pdb
,
0
,
FALSE
,
NULL
,
NULL
,
NULL
,
NULL
)))
return
FALSE
;
thdb
->
unix_pid
=
getpid
();
PROCESS_InitialProcessID
=
PDB_TO_PROCESS_ID
(
pdb
);
if
(
!
HANDLE_CreateTable
(
&
initial_pdb
,
FALSE
))
return
FALSE
;
if
(
!
(
thdb
=
THREAD_CreateInitialThread
(
&
initial_pdb
)))
return
FALSE
;
/* Remember TEB selector of initial process for emergency use */
SYSLEVEL_EmergencyTeb
=
thdb
->
teb_sel
;
/* Create the environment DB of the first process */
if
(
!
PROCESS_BuildEnvDB
(
pdb
))
return
FALSE
;
PROCESS_PDBList_Insert
(
&
initial_pdb
);
if
(
!
PROCESS_BuildEnvDB
(
&
initial_pdb
))
return
FALSE
;
/* Initialize the first thread */
if
(
CLIENT_InitThread
())
return
FALSE
;
if
(
!
PROCESS_FinishCreatePDB
(
pdb
))
return
FALSE
;
if
(
!
PROCESS_FinishCreatePDB
(
&
initial_
pdb
))
return
FALSE
;
/* Create the SEGPTR heap */
if
(
!
(
SegptrHeap
=
HeapCreate
(
HEAP_WINE_SEGPTR
,
0
,
0
)))
return
FALSE
;
...
...
@@ -453,15 +463,6 @@ PDB32 *PROCESS_Create( NE_MODULE *pModule, LPCSTR cmd_line, LPCSTR env,
info
->
dwProcessId
=
PDB_TO_PROCESS_ID
(
pdb
);
info
->
dwThreadId
=
THDB_TO_THREAD_ID
(
thdb
);
#if 0
thdb->unix_pid = getpid(); /* FIXME: wrong here ... */
#else
/* All Win16 'threads' have the same unix_pid, no matter by which thread
they were created ! */
pTask
=
(
TDB
*
)
GlobalLock16
(
parent
->
task
);
thdb
->
unix_pid
=
pTask
?
pTask
->
thdb
->
unix_pid
:
THREAD_Current
()
->
unix_pid
;
#endif
/* Duplicate the standard handles */
if
((
!
(
pdb
->
env_db
->
startup_info
->
dwFlags
&
STARTF_USESTDHANDLES
))
&&
!
inherit
)
...
...
@@ -897,6 +898,7 @@ DWORD WINAPI GetProcessHeaps(DWORD nrofheaps,HANDLE32 *heaps) {
void
PROCESS_SuspendOtherThreads
(
void
)
{
#if 0
PDB32 *pdb;
THREAD_ENTRY *entry;
...
...
@@ -919,6 +921,7 @@ void PROCESS_SuspendOtherThreads(void)
}
SYSTEM_UNLOCK();
#endif
}
/***********************************************************************
...
...
@@ -927,6 +930,7 @@ void PROCESS_SuspendOtherThreads(void)
void
PROCESS_ResumeOtherThreads
(
void
)
{
#if 0
PDB32 *pdb;
THREAD_ENTRY *entry;
...
...
@@ -949,5 +953,6 @@ void PROCESS_ResumeOtherThreads(void)
}
SYSTEM_UNLOCK();
#endif
}
This diff is collapsed.
Click to expand it.
scheduler/sysdeps.c
+
0
−
1
View file @
214399f2
...
...
@@ -80,7 +80,6 @@ int *__h_errno_location()
*/
static
void
SYSDEPS_StartThread
(
THDB
*
thdb
)
{
thdb
->
unix_pid
=
getpid
();
SET_FS
(
thdb
->
teb_sel
);
THREAD_Start
(
thdb
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment