CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Other Programming > Assembly
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Assembly Questions and Answers for Assembly here!

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old March 10th, 2005, 12:43 PM
    abcd12321 abcd12321 is offline
    Junior Member
     
    Join Date: Feb 2005
    Posts: 6
    abcd12321 is an unknown quantity at this point (<10)
    protected mode

    protected mode prevents user programs from modifying the operating system by assigning a lower privelidge to it.my question is,what's there to stop someone from writing code with the highest privelidge and the modifying the OS's core?





    thanks
    Reply With Quote
      #2    
    Old March 10th, 2005, 01:26 PM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: protected mode

    Quote:
    Originally Posted by abcd12321
    protected mode prevents user programs from modifying the operating system by assigning a lower privelidge to it.my question is,what's there to stop someone from writing code with the highest privelidge and the modifying the OS's core?
    The GDT ... The Global Descriptor Table. This table - a set of data - defines where the segments starts and ends. If they can be accessed with reading/writing, what privilige level they are etc. etc.

    The lgdt instructions loads a new GDT into the memory. A tutorial on the GDT.

    This is a dumm GDT which specifies that every memory is highest privileged (kernel) memory. This is dumm, but at first easier to understand:

    Code:
    SECTION .data
    	
    gdt:
    ; NULL descriptor
    	dw 0		; limit 15:0
    	dw 0		; base 15:0
    	db 0		; base 23:16
    	db 0		; type
    	db 0		; limit 19:16, flags
    	db 0		; base 31:24
    
    ; unused descriptor
    	dw 0
    	dw 0
    	db 0
    	db 0
    	db 0
    	db 0
    
    LINEAR_DATA_SEL	equ	$-gdt
    	dw 0FFFFh
    	dw 0
    	db 0
    	db 92h		; present, ring 0, data, expand-up, writable
    	db 0CFh		; page-granular (4 gig limit), 32-bit
    	db 0
    
    LINEAR_CODE_SEL	equ	$-gdt
    	dw 0FFFFh
    	dw 0
    	db 0
    	db 9Ah		; present,ring 0,code,non-conforming,readable
    	db 0CFh		; page-granular (4 gig limit), 32-bit
    	db 0
    gdt_end:
    
    gdt_ptr:
    	dw gdt_end - gdt - 1
    	dd gdt
    And loades is this GDT by the following instruction:

    Code:
    lgdt [gdt_ptr]
    (NASM code)
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Other Programming > Assembly


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:10 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009