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
0b511b9a
Commit
0b511b9a
authored
Jan 04, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 05, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a small test for FPU exceptions.
parent
03468a4f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
exception.c
dlls/ntdll/tests/exception.c
+77
-0
No files found.
dlls/ntdll/tests/exception.c
View file @
0b511b9a
...
...
@@ -841,6 +841,82 @@ static void test_simd_exceptions(void)
ok
(
got_exception
==
1
,
"got exception: %i, should be 1
\n
"
,
got_exception
);
}
struct
fpu_exception_info
{
DWORD
exception_code
;
DWORD
exception_offset
;
DWORD
eip_offset
;
};
static
DWORD
fpu_exception_handler
(
EXCEPTION_RECORD
*
rec
,
EXCEPTION_REGISTRATION_RECORD
*
frame
,
CONTEXT
*
context
,
EXCEPTION_REGISTRATION_RECORD
**
dispatcher
)
{
struct
fpu_exception_info
*
info
=
*
(
struct
fpu_exception_info
**
)(
frame
+
1
);
info
->
exception_code
=
rec
->
ExceptionCode
;
info
->
exception_offset
=
(
BYTE
*
)
rec
->
ExceptionAddress
-
(
BYTE
*
)
code_mem
;
info
->
eip_offset
=
context
->
Eip
-
(
DWORD
)
code_mem
;
++
context
->
Eip
;
return
ExceptionContinueExecution
;
}
static
void
test_fpu_exceptions
(
void
)
{
static
const
BYTE
fpu_exception_test_ie
[]
=
{
0x83
,
0xec
,
0x04
,
/* sub $0x4,%esp */
0x66
,
0xc7
,
0x04
,
0x24
,
0xfe
,
0x03
,
/* movw $0x3fe,(%esp) */
0x9b
,
0xd9
,
0x7c
,
0x24
,
0x02
,
/* fstcw 0x2(%esp) */
0xd9
,
0x2c
,
0x24
,
/* fldcw (%esp) */
0xd9
,
0xee
,
/* fldz */
0xd9
,
0xe8
,
/* fld1 */
0xde
,
0xf1
,
/* fdivp */
0xdd
,
0xd8
,
/* fstp %st(0) */
0xdd
,
0xd8
,
/* fstp %st(0) */
0x9b
,
/* fwait */
0xdb
,
0xe2
,
/* fnclex */
0xd9
,
0x6c
,
0x24
,
0x02
,
/* fldcw 0x2(%esp) */
0x83
,
0xc4
,
0x04
,
/* add $0x4,%esp */
0xc3
,
/* ret */
};
static
const
BYTE
fpu_exception_test_de
[]
=
{
0x83
,
0xec
,
0x04
,
/* sub $0x4,%esp */
0x66
,
0xc7
,
0x04
,
0x24
,
0xfb
,
0x03
,
/* movw $0x3fb,(%esp) */
0x9b
,
0xd9
,
0x7c
,
0x24
,
0x02
,
/* fstcw 0x2(%esp) */
0xd9
,
0x2c
,
0x24
,
/* fldcw (%esp) */
0xdd
,
0xd8
,
/* fstp %st(0) */
0xd9
,
0xee
,
/* fldz */
0xd9
,
0xe8
,
/* fld1 */
0xde
,
0xf1
,
/* fdivp */
0x9b
,
/* fwait */
0xdb
,
0xe2
,
/* fnclex */
0xdd
,
0xd8
,
/* fstp %st(0) */
0xdd
,
0xd8
,
/* fstp %st(0) */
0xd9
,
0x6c
,
0x24
,
0x02
,
/* fldcw 0x2(%esp) */
0x83
,
0xc4
,
0x04
,
/* add $0x4,%esp */
0xc3
,
/* ret */
};
struct
fpu_exception_info
info
;
memset
(
&
info
,
0
,
sizeof
(
info
));
run_exception_test
(
fpu_exception_handler
,
&
info
,
fpu_exception_test_ie
,
sizeof
(
fpu_exception_test_ie
));
ok
(
info
.
exception_code
==
EXCEPTION_FLT_STACK_CHECK
,
"Got exception code %#x, expected EXCEPTION_FLT_STACK_CHECK
\n
"
,
info
.
exception_code
);
ok
(
info
.
exception_offset
==
0x19
,
"Got exception offset %#x, expected 0x19
\n
"
,
info
.
exception_offset
);
ok
(
info
.
eip_offset
==
0x1b
,
"Got EIP offset %#x, expected 0x1b
\n
"
,
info
.
eip_offset
);
memset
(
&
info
,
0
,
sizeof
(
info
));
run_exception_test
(
fpu_exception_handler
,
&
info
,
fpu_exception_test_de
,
sizeof
(
fpu_exception_test_de
));
ok
(
info
.
exception_code
==
EXCEPTION_FLT_DIVIDE_BY_ZERO
,
"Got exception code %#x, expected EXCEPTION_FLT_DIVIDE_BY_ZERO
\n
"
,
info
.
exception_code
);
ok
(
info
.
exception_offset
==
0x17
,
"Got exception offset %#x, expected 0x17
\n
"
,
info
.
exception_offset
);
ok
(
info
.
eip_offset
==
0x19
,
"Got EIP offset %#x, expected 0x19
\n
"
,
info
.
eip_offset
);
}
#endif
/* __i386__ */
START_TEST
(
exception
)
...
...
@@ -918,6 +994,7 @@ START_TEST(exception)
test_rtlraiseexception
();
test_debugger
();
test_simd_exceptions
();
test_fpu_exceptions
();
VirtualFree
(
code_mem
,
1024
,
MEM_RELEASE
);
#endif
...
...
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