develooper Front page | perl.perl6.internals | Postings from October 2002

RE: [perl #18127] [PATCH] Implicit stack direction probe

Thread Previous | Thread Next
Garrett Goebel
October 29, 2002 10:19
RE: [perl #18127] [PATCH] Implicit stack direction probe
Message ID:
Dan Sugalski wrote:
> Leopold Toetsch wrote:
> >
> > Can we really have e.g. odd aligned PMCs on stack?
> the specs are available *somewhere*, and we should see
> about digging them up and getting a final answer one way
> or another.

A gold mine of cpu specs:

Intel Architecture Software Development Manual - Volume 1: Basic

Chapter 4.2.2 Stack Alignment

The stack pointer for a stack segment should be aligned on 16-bit (word) or
32-bit (double-word) boundaries, depending on the width of the stack
segment. The D flag in the segment descriptor for the current code segment
sets the stack-segment width (refer to Chapter 3, Protected-Mode Memory
Managementof the Intel Architecture Software Developer's Manual, Volume 3).
The PUSH and POP instructions use the D flag to determine how much to
decrement or increment the stack pointer on a push or pop operation,
respectively. When the stack width is 16 bits, the stack pointer is
incremented or decremented in 16-bit increments; when the width is 32 bits,
the stack pointer is incremented or decremented in 32-bit increments.

The processor does not check stack pointer alignment. It is the
responsibility of the programs, tasks, and system procedures running on the
processor to maintain proper alignment of stack pointers. Misaligning a
stack pointer can cause serious performance degradation and in some
instances program failures.

And also interesting:
Tuning 64-bit floating point code on x86 using gcc, Visual C, and Intel C

Garrett Goebel
IS Development Specialist

ScriptPro                   Direct: 913.403.5261
5828 Reeds Road               Main: 913.384.1008
Mission, KS 66202              Fax: 913.384.2180

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About