Last change
on this file since 2641 was 378, checked in by bird, 22 years ago |
#563: wanna do this on linux too.
|
-
Property cvs2svn:cvs-rev
set to
1.2
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.2 KB
|
Line | |
---|
1 | / control.s (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes
|
---|
2 |
|
---|
3 | .globl __control87
|
---|
4 | .globl _control87
|
---|
5 |
|
---|
6 | .text
|
---|
7 |
|
---|
8 |
|
---|
9 | / unsigned _control87 (unsigned new, unsigned mask)
|
---|
10 |
|
---|
11 | #define cw_old 0(%esp)
|
---|
12 | #define cw_new 2(%esp)
|
---|
13 | /define ret_addr 4(%esp)
|
---|
14 | #define new 8(%esp)
|
---|
15 | #define mask 12(%esp)
|
---|
16 |
|
---|
17 | _control87:
|
---|
18 | __control87:
|
---|
19 | pushl %ecx /* Dummy (for control word) */
|
---|
20 | fstcw cw_old /* Store control word into memory */
|
---|
21 | movl mask, %ecx /* Get mask */
|
---|
22 | jecxz 1f /* Do not set cw => done */
|
---|
23 | movl new, %edx /* Get new bits */
|
---|
24 | andl %ecx, %edx /* Mask new bits by mask bits */
|
---|
25 | notl %ecx
|
---|
26 | movl cw_old, %eax /* Get old cw */
|
---|
27 | andl %ecx, %eax /* Apply mask to old cw */
|
---|
28 | orl %edx, %eax /* Insert new bits */
|
---|
29 | movw %ax, cw_new /* Put new cw into memory */
|
---|
30 | fldcw cw_new /* Load control word */
|
---|
31 | 1: popl %eax /* Return old cw in lower 16 bits */
|
---|
32 | movzwl %ax, %eax /* Clear upper 16 bits */
|
---|
33 | ret
|
---|
34 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.