Subsections

Operating System Interface

Exception Interface

As the AMD64 manuals describe, the processor changes mode to handle exceptions, which may be synchronous, floating-point/coprocessor or asynchronous. Synchronous and floating-point/coprocessor exceptions, being caused by instruction execution, can be explicitly generated by a process. This section, therefore, specifies those exception types with defined behavior. The AMD64 architecture classifies exceptions as faults, traps, and aborts. See the Intel386 ABI for more information about their differences.

Hardware Exception Types

The operating system defines the correspondence between hardware exceptions and the signals specified by signal (BA_OS) as shown in table [*]. Contrary to the i386 architecture, the AMD64 does not define any instructions that generate a bounds check fault in long mode.


Table: Hardware Exceptions and Signals
Number Exception name Signal
0 divide error fault SIGFPE
1 single step trap/fault SIGTRAP
2 nonmaskable interrupt none
3 breakpoint trap SIGTRAP
4 overflow trap SIGSEGV
5 (reserved)  
6 invalid opcode fault SIGILL
7 no coprocessor fault SIGFPE
8 double fault abort none
9 coprocessor overrun abort SIGSEGV
10 invalid TSS fault none
11 segment no present fault none
12 stack exception fault SIGSEGV
13 general protection fault/abort SIGSEGV
14 page fault SIGSEGV
15 (reserved)  
16 coprocessor error fault SIGFPE
other (unspecified) SIGILL


Table: Floating-Point Exceptions
Code Reason
FPE_FLTDIV floating-point divide by zero
FPE_FLTOVF floating-point overflow
FPE_FLTUND floating-point underflow
FPE_FLTRES floating-point inexact result
FPE_FLTINV invalid floating-point operation

Special Registers

The AMD64 architecture defines floating point instructions. At process startup the two floating point units, SSE2 and x87, both have all floating-point exception status flags cleared. The status of the control words is as defined in tables [*] and [*].


Table: x87 Floating-Point Control Word
Field Value Note
RC 0 Round to nearest
PC 11 Double extended precision
PM 1 Precision masked
UM 1 Underflow masked
OM 1 Overflow masked
ZM 1 Zero divide masked
DM 1 Denormal operand masked
IM 1 Invalid operation masked


Table: MXCSR Status Bits
Field Value Note
FZ 0 Do not flush to zero
RC 0 Round to nearest
PM 1 Precision masked
UM 1 Underflow masked
OM 1 Overflow masked
ZM 1 Zero divide masked
DM 1 Denormal operand masked
IM 1 Invalid operation masked
DAZ 0 Denormals are not zero

Virtual Address Space

Although the AMD64 architecture uses 64-bit pointers, implementations are only required to handle 48-bit addresses. Therefore, conforming processes may only use addresses from 0x0000000000000000 to 0x00007fffffffffff3.15.

No other changes required.

Page Size

Systems are permitted to use any power-of-two page size between 4KB and 64KB, inclusive.

No other changes required.

Virtual Address Assignments

Conceptually processes have the full address space available. In practice, however, several factors limit the size of a process.

Figure: Virtual Address Configuration
\begin{figure}\noindent\rule{\linewidth}{0.3mm}
\begin{center}
\begin{tabular}...
...e{2-2}
\end{tabular} \end{center}\noindent\rule{\linewidth}{0.3mm}
\end{figure}

Although applications may control their memory assignments, the typical arrangement appears in figure [*].

Figure: Conventional Segment Arrangements
\begin{figure}\noindent\rule{\linewidth}{0.3mm}
\begin{center}
\begin{tabular}...
...e{2-2}
\end{tabular} \end{center}\noindent\rule{\linewidth}{0.3mm}
\end{figure}



Footnotes

...0x00007fffffffffff3.15
0x0000ffffffffffff is not a canonical address and cannot be used.
Jan Hubicka 2003-05-04