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
51f6aeb4
Commit
51f6aeb4
authored
Apr 13, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented guard pages and stack overflow exceptions.
parent
3ef93229
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
signal_i386.c
dlls/ntdll/signal_i386.c
+3
-2
global.h
include/global.h
+1
-1
virtual.c
memory/virtual.c
+24
-4
No files found.
dlls/ntdll/signal_i386.c
View file @
51f6aeb4
...
...
@@ -475,13 +475,14 @@ static HANDLER_DEF(segv_handler)
{
EXCEPTION_RECORD
rec
;
CONTEXT
context
;
DWORD
page_fault_code
=
EXCEPTION_ACCESS_VIOLATION
;
handler_init
(
&
context
,
HANDLER_CONTEXT
);
#ifdef CR2_sig
/* we want the page-fault case to be fast */
if
(
get_trap_code
(
HANDLER_CONTEXT
)
==
T_PAGEFLT
)
if
(
VIRTUAL_HandleFault
(
(
LPVOID
)
CR2_sig
(
HANDLER_CONTEXT
)
))
return
;
if
(
!
(
page_fault_code
=
VIRTUAL_HandleFault
(
(
LPVOID
)
CR2_sig
(
HANDLER_CONTEXT
)
)
))
return
;
#endif
save_context
(
&
context
,
HANDLER_CONTEXT
);
...
...
@@ -520,7 +521,7 @@ static HANDLER_DEF(segv_handler)
#endif
/* ERROR_sig */
rec
.
ExceptionInformation
[
1
]
=
CR2_sig
(
HANDLER_CONTEXT
);
#endif
/* CR2_sig */
rec
.
ExceptionCode
=
EXCEPTION_ACCESS_VIOLATION
;
rec
.
ExceptionCode
=
page_fault_code
;
break
;
case
T_ALIGNFLT
:
/* Alignment check exception */
/* FIXME: pass through exception handler first? */
...
...
include/global.h
View file @
51f6aeb4
...
...
@@ -37,7 +37,7 @@ extern LPVOID VIRTUAL_MapFileW( LPCWSTR name );
typedef
BOOL
(
*
HANDLERPROC
)(
LPVOID
,
LPCVOID
);
extern
BOOL
VIRTUAL_SetFaultHandler
(
LPCVOID
addr
,
HANDLERPROC
proc
,
LPVOID
arg
);
extern
BOOL
VIRTUAL_HandleFault
(
LPCVOID
addr
);
extern
DWORD
VIRTUAL_HandleFault
(
LPCVOID
addr
);
/* memory/atom.c */
extern
BOOL
ATOM_Init
(
WORD
globalTableSel
);
...
...
memory/virtual.c
View file @
51f6aeb4
...
...
@@ -510,13 +510,33 @@ BOOL VIRTUAL_SetFaultHandler( LPCVOID addr, HANDLERPROC proc, LPVOID arg )
/***********************************************************************
* VIRTUAL_HandleFault
*/
BOOL
VIRTUAL_HandleFault
(
LPCVOID
addr
)
DWORD
VIRTUAL_HandleFault
(
LPCVOID
addr
)
{
FILE_VIEW
*
view
=
VIRTUAL_FindView
((
UINT
)
addr
);
DWORD
ret
=
EXCEPTION_ACCESS_VIOLATION
;
if
(
view
&&
view
->
handlerProc
)
return
view
->
handlerProc
(
view
->
handlerArg
,
addr
);
return
FALSE
;
if
(
view
)
{
if
(
view
->
handlerProc
)
{
if
(
view
->
handlerProc
(
view
->
handlerArg
,
addr
))
ret
=
0
;
/* handled */
}
else
{
BYTE
vprot
=
view
->
prot
[((
UINT
)
addr
-
view
->
base
)
>>
page_shift
];
UINT
page
=
(
UINT
)
addr
&
~
page_mask
;
char
*
stack
=
(
char
*
)
NtCurrentTeb
()
->
stack_base
+
SIGNAL_STACK_SIZE
+
page_mask
+
1
;
if
(
vprot
&
VPROT_GUARD
)
{
VIRTUAL_SetProt
(
view
,
page
,
page_mask
+
1
,
vprot
&
~
VPROT_GUARD
);
ret
=
STATUS_GUARD_PAGE_VIOLATION
;
}
/* is it inside the stack guard pages? */
if
(((
char
*
)
addr
>=
stack
)
&&
((
char
*
)
addr
<
stack
+
2
*
(
page_mask
+
1
)))
ret
=
STATUS_STACK_OVERFLOW
;
}
}
return
ret
;
}
...
...
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