Jumping to TSS

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Jumping to TSS

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 9:08 pm, edited 1 time in total.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Jumping to TSS

Post by Pype.Clicker »

Code: Select all

push byte 12
is encoded as 0x6A 0x0C. when executed, it will put 0x00000012 on the stack (32 bytes, i don't remember if the value is sign-extended or zero-extended)

Code: Select all

 push 12 
is 0x68 0x0C 0x00 0x00 0x00, but it will have the very same effect on the stack.

http://courses.ece.uiuc.edu/ece291/arch ... f-pop.html

this should be all explained in the nasm docs as well ...
Tim

Re:Jumping to TSS

Post by Tim »

Perica Senjak wrote:So when retrieving arguments from the stack, i should take into account the padding??
No -- the opposite. You can assume that anything on the stack is a dword.

If you have a function like:

Code: Select all

void fn(unsigned char a, unsigned short b, unsigned long c, unsigned long long d);
...the stack will look like:
[tt]00 00 00 aa
00 00 bb bb
cc cc cc cc
dd dd dd dd
dd dd dd dd[/tt]
That is, a and b are padded with zeroes; c is unchanged; and d is split across two dwords. If a and b were signed then they would be padded with copies of their top bits; that is, 0xFF if they are negative, or 0x00 if they are zero or positive.
shad

Re:Jumping to TSS

Post by shad »

Is it me, or is the information (free information) on task switching (hardware or software) really this scarce?
Post Reply