flat assembler
Message board for the users of flat assembler.

Index > OS Construction > cpl3 -> cpl0 ??

Author
Thread Post new topic Reply to topic
maslan



Joined: 08 Sep 2003
Posts: 54
maslan
hi guys

Code:
create_task:
  push  ebp
  mov  ebp, esp
  mov  esp, dword [ebp+08]

  ;---------------------;
  ; push dword ss3    ;      -----------> (1) ?
  ; push dword esp3  ;      -----------> (2) ?
  ;---------------------;

  push  dword  0202h  ; eflags
  push  dword  08h  ; cs
  mov  eax, dword [ebp+12]
  push  dword  eax  ; eip
  push  dword  00h  ; eax
  push  dword  00h  ; ecx
  push  dword  00h  ; edx
  push  dword  00h  ; ebx
  mov  eax, dword [ebp+16]
  push  dword  eax  ; esp  -------------> (3)  ? ; this is the 
  push  dword  00h  ; ebp
  push  dword  00h  ; esi
  push  dword  00h  ; edi
  push  dword  10h  ; gs
  push  dword  10h  ; fs
  push  dword  10h  ; es
  push  dword  10h  ; ds
  push  dword  00h  ; error code
  push  dword  20h  ; interrupt number
  mov  eax, esp
  mov  esp, ebp
  pop  ebp
  ret
    


Code:
int create_task(int , int , int);
/* 1st parameter : process kernel stack */
/* 2nd parameter : process eip */
/* 3rd parameter : process user stack */
    



for example if a user process called a syscall by an int instruction, and the parameters where pushed on the process stack rather than the registers, which is the same technique used by *BSD. so which should point to the real user stack of the process esp3 number (2) or esp number (3) ?
another thing what should i initially set the eso3 number (2) & esp number (3) when i create a new process ?

_________________
Maslan
I'm searching for perfection so, even if u need portability u 've to use Assembly
---
http://www.maslanlab.org
---
http://libosdk.berlios.de
http://maslanedit.sf.net
http://maslancms.sf.net
Post 24 Oct 2005, 16:25
View user's profile Send private message 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 YouTube, Twitter.

Website powered by rwasa.