Your SlideShare is downloading. ×
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Real to protected_mode
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Real to protected_mode

255

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
255
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 01/29/15 Protected Mode Assignment 1 Switching from Real to Protected Mode • Programme Assignments • Define Global Descriptor Table • Main Programme Body 0000h 4Gb x00h
  • 2. 01/29/15 Protected Mode Assignment 2 Programme Assignments .386p Code segment use16 Assume cs: code , ss: stack realadd dd 0 taskadd dd 0 msg0 db ‘ in Real Mode ‘,0 msg1 db ‘ in Protected Model Mode ‘,0 msg2 db ‘ Back in Real Mode ‘,0 msg3 db ‘ < Your own declarations> ‘,0 x00h
  • 3. 01/29/15 Protected Mode Assignment 3 Define Global Descriptor Table Code Segment cs_32 Data Segment ds_32 Extra Segment es_32
  • 4. 01/29/15 Protected Mode Assignment 4 Define Global Descriptor Table <Code Segment cs_32> ------------------------------------------------------------------------------------------ cs_32: ; 08h ----------------------------------------------------------------------------- dw 0ffffh ; segment Limit c1: dw 00h ; Base Address 15:00 c2: db 00h ; Base Address 23:16 db 09Ah : b ’1001 1010’ db 00h ; b ‘ 0000 0000’ C3 db 00h ; Base Address 24:31 ---------------------------------------------------------------------------------------------
  • 5. 01/29/15 Protected Mode Assignment 5 Define Global Descriptor Table <Extra Segment es_32> ------------------------------------------------------------------------------------------ es_32: ; 10h ------------------------------------------------------------------------------------------ dw 0ffffh ; segment Limit e1: dw 8000h ; Base Address 15:00 e2: db 0bh ; Base Address 23:16 db 092h : b ’1001 1010’ db 00h ; b ‘ 0000 0000’ e3 db 00h ; Base Address 24:31 ---------------------------------------------------------------------------------------------
  • 6. 01/29/15 Protected Mode Assignment 6 Define Global Descriptor Table <Data Segment ds_32> ------------------------------------------------------------------------------------------ ds_32: ; 18h ------------------------------------------------------------------------------------------ dw 0ffffh ; segment Limit d1: dw 0000h ; Base Address 15:00 d2: db 00h ; Base Address 23:16 db 092h : b ’1001 1010’ db 00h ; b ‘ 0000 0000’ d3 db 00h ; Base Address 24:31 ---------------------------------------------------------------------------------------------
  • 7. 01/29/15 Protected Mode Assignment 7 Global Descriptor Table x00h cs_32 es_32 ds_32 gdt_Start cs_32(08h) es_32(10h) ds_32(18h) gdt_End Null Desc(0h)
  • 8. 01/29/15 Protected Mode Assignment 8 Global Descriptor Table x00h gdt_start: cs_32: es_32: ds_32: gdt_end: gdt_reg label fword gdt_limit dw gdt_end - gdt_start gdt_base dd 0 cs_32(08h) es_32(10h) ds_32(18h) gdt_End Null Desc(0h) gdt_Start
  • 9. 01/29/15 Protected Mode Assignment 9 Main Programme Body Begin: Display Some Message (Graphics Mode) Set up Global Descriptor Table Load Global Descriptor Table Register Switch to Protected Mode Jump to Protected Mode Display Message Switch to Real Mode Exit: pm: rmd:
  • 10. 01/29/15 Protected Mode Assignment 10 Display Some Message (Graphics Mode) Graphics Display B800h es = B800 ds = cs clear screen si = msg0 di = (80 * Lines(hor) ) * 2 cx = length of Msg Loop es: [di] = al = [si] inc si ; inc di loop cx
  • 11. 01/29/15 Protected Mode Assignment 11 Display Some Message (Graphics Mode) ax = cs lea si, realadd mov word ptr [si+2],ax lea ax,[rmd] mov word ptr [si],ax pm: rmd:
  • 12. 01/29/15 Protected Mode Assignment 12 Set up Global Descriptor Table ax = cs eax << ax ebx << eax ebx << 4 ; Address is 20 bits eax = ebx c1 = d1 = ax eax >> 16 ; Shift Right by 16 d2 = c2 = al d3 = c3 = ah ---------------------------------------------------------------------- c1 , d1 c2 d2c3 , d3
  • 13. 01/29/15 Protected Mode Assignment 13 Load Global Descriptor Table Register ---------------------------------------------------------------------------------- eax = ax = cs eax << 4 ebx << bx = gdt_Start ebx = eax + ebx cs:gdt_Base = ebx lgdt cs:gdtreg
  • 14. 01/29/15 Protected Mode Assignment 14 Switch To Protected Mode cr0<PE> = 1 { eax = cr0 or al,01 cr0 = eax } jump to Protected Mode pm: es = 10 ds = 18 display as before using si di pm: rmd:
  • 15. 01/29/15 Protected Mode Assignment 15 Switch To Protected Mode cr0<PE> = 1 { eax = cr0 or al,01 ` cr0 = eax } db oeah dw pm dw 08h pm: es = 10 ds = 18 display as before using si di pm: rmd:
  • 16. 01/29/15 Protected Mode Assignment 16 Main Programme Body CR0<PE> = 0 jmp dword ptr realadd rmd: Display Data in Real Mode Exit using int 21(4ch) pm: rmd:

×