Code: Select all
stack is no more 16 bytes aligned !
What is wrong here and how do i correct this.
bart.
Code: Select all
stack is no more 16 bytes aligned !
put your asm code?6.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
(see “Segment Descriptors” in Chapter 3, “Protected-Mode Memory Management,” of
the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 3A).
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. Pushing a 16-bit value onto a 32-bit wide stack can
result in stack misaligned (that is, the stack pointer is not aligned on a doubleword
boundary). One exception to this rule is when the contents of a segment register (a
16-bit segment selector) are pushed onto a 32-bit wide stack. Here, the processor
automatically aligns the stack pointer to the next 32-bit boundary.
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.
Code: Select all
Procedure LoadHiScore()
If FileSize("Vulcan.vc") > 0
If ReadFile(0, "vulcan.vc")
hiscore = ReadLong(0)+1234567890
unlock = ReadLong(0)+1234567890
gameBeat = ReadLong(0)+1234567890
maxEnemKilled = ReadLong(0)+1234567890
hiPlayer$ = ReadString(0,#PB_Ascii,6)
If unlock < 0 Or unlock > 3
unlock = 0
EndIf
CloseFile(0)
EndIf
EndIf
EndProcedure
Code: Select all
Procedure test2()
EndProcedure
Procedure test()
!SUB RSP, 8 ; changer stack alignment !!error !!
test2()
!add rsp, 8
EndProcedure
test()
Code: Select all
a = 10
Gosub label
End
Select a
Case 10
label:
Debug 1
Default
Debug 2
EndSelect
Return