flat assembler
Message board for the users of flat assembler.

Index > Main > Esp: creating stacks bevor use

Author
Thread Post new topic Reply to topic
Syrasia



Joined: 25 Feb 2010
Posts: 11
Location: Saarland, Germany
Syrasia
Hi there,
i used the search, but no luck on this. Sorry Sad
So here my idea: creating stacks in allocated mem for later us in systems calls.
So if I then call som system function I would let esp point on my custom stack.
Is this possible? How far does ebp affect the stack?
And how big is my initial stack?
Also what of this is possible in long mode? Using rsp and rbp?
I am looking forward for your help.

_________________
Back to fasm, the best
Post 22 May 2011, 11:54
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

Of course it is possible.
I did it in kernel mode, it works fine.
Code:
     my_stack dd 4000h dup ? 
    ;4000h=4*1000h (Quad Core)
  ;or with "ExAllocatePoolWithTag"

      IA32_SYSENTER_ESP equ 175h
;-----------------------------------------------
      cli
 mov     ecx,IA32_SYSENTER_ESP
       rdmsr                                   ;(yy)

   mov     [CPU.R0_Stack + edi],eax        ;save old stack

 lea     eax,[esi + 1]                   ;4µPs (esi = 0,1,2,3)
      imul    eax,eax,1000h
       lea     eax,[my_stack + eax]

    wrmsr                                   ;edx from (yy)
      sti

     ;"KeSetSystemAffinityThread,next_core" ... and loop Smile
    


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 22 May 2011, 13:19
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.