flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Help! Problem with CPL downgrate in..

Author
Thread Post new topic Reply to topic
narada



Joined: 15 Feb 2008
Posts: 77
Location: Ukraine, Dnepropetrovsk
narada 23 May 2010, 19:28
Embarassed Very siiimple english Embarassed Embarassed Embarassed

1) Needed info^
Code:
os_code_l db 0xFF,0xFF,0x00,0x00,0x00,10011000b,01001111b,0x00
os_ss_l db 0x80, 0x00, 0x00, 0x00, 0x00, 10010010b, 01001111b, 0x00
os_data_l db 0xFF, 0xFF, 0x00, 0x00, 0x00, 10010010b, 01001111b, 0x00
app_code_l db 0xFF, 0xFF, 0x00, 0x00, 0x00, 11111000b, 01001111b, 0x00 
app_ss_l db 0x80, 0x00, 0x00, 0x00, 0x00, 11110010b, 01001111b, 0x00
app_data_l db 0xFF, 0xFF, 0x00, 0x00, 0x00, 11110010b, 01001111b, 0x00
    


I need to start CPL3-code (app_code:u_mode) from CPL0 (this code running in CPL0 of course) with IRETD:
Code:
      mov      dx, os_ss
  mov      ss, dx
     mov     esp, os_stack

   mov      ax, app_data
       mov      ds, ax

 mov     eax, app_ss ; SS
    push    eax

     mov     eax, app_stack ; STACK
      push    eax

     push    dword 0x13202 ; EFLAGS

  mov     eax, app_code ; CS
  push    eax

     mov     eax, u_mode ; EIP
   push    eax

     IRETD
    

In this case I got GPL. But, if I am using os_code (DPL0) instead of app_code (DPL3) all gone right ok. So why Ring0 -> Ring0 = Ok, but Ring0 -> Ring3 != Ok??? Question Question Question[/code]

_________________
http://www.omegicus.com
Post 23 May 2010, 19:28
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 24 May 2010, 11:44
narada,

Make sure that priority levels meet the requirements (app_code and app_ss selectors should have RPL==3, i.e. app_code = app_code_l+3 or something like that).
Post 24 May 2010, 11:44
View user's profile Send private message Reply with quote
narada



Joined: 15 Feb 2008
Posts: 77
Location: Ukraine, Dnepropetrovsk
narada 24 May 2010, 12:55
No... with RPL all fine...
May be this is not an answer, but when I initialized TR register (added tss_selector and LTR ... ... ) all start working propertly...

it's very interesting... as I understood, IRETD instruction or another (instead of Jxx) needed a TSS...

(Times ago all worked fine, but I decided to do scheduler withous TSS, as software task swith... and now I am using sowtware t.sw., but TSS structure just must be in system... as think...)
Post 24 May 2010, 12:55
View user's profile Send private message Visit poster's website ICQ Number 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-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.