Questions tagged [protected-mode]

x86 protected mode allows system software to support virtual memory, paging and preemptive multi-tasking.

x86 protected mode allows system software to support virtual memory, paging and preemptive multi-tasking.

  • Protected mode was first added to the x86 architecture in 1982, with the release of Intel's 80286 processor, and later extended with the release of the 80386 processor in 1985.
  • To maintain backward compatibility, x86 processors begins executing instructions in real mode.

To enter protected mode:

  • The Global Descriptor Table (GDT) must first be created with a minimum of three entries: a null descriptor, a code segment descriptor and data segment descriptor.
  • In an IBM-compatible machine, the A20 line (21st address line) also must be enabled to allow the use of all the address lines so that the CPU can access beyond 1 megabyte of memory.
  • Then the PE bit must be set in the CR0 register and a far jump must be made to clear the prefetch input queue:
; set PE bit
mov eax, cr0
or eax, 1
mov cr0, eax

; far jump (cs = selector of code segment)
jmp cs:@pm

@pm:
; Now we are in PM.
214 questions
0
votes
1 answer

Ask for clarification about "the segment registers continue to point to the same linear addresses as in real address mode"

The question is about persistent validity of code segment selector while switching from real mode to protected mode on intel i386. The switching code is as follows (excerpted from bootasm.S of xv6 x86 version): 9138 # Switch from real to protected…
zzzhhh
  • 319
  • 1
  • 8
0
votes
0 answers

Need a little bit help to run 32 bit code in protected mode properly

I need a little bit help. Actually, the problem is, after reading the 2nd sector of the disk and switching the protected mode on, the Qemu emulator is rebooting continuously. I am trying to solve the problem and want to run 32 bit code properly, oh!…
user15087572
0
votes
0 answers

Confused about x86 protected mode memory layout

After some time trying to write an x86 bootloader and asking my way on here in the process I think I need to take a step back and clear up some misconceptions i have about what I'm actually trying to achieve: I understand that at the beginning of…
Peter
  • 2,919
  • 1
  • 16
  • 35
0
votes
1 answer

How to switch to 320x200 256colors in protected mode and with no bios interrupts

I gave up the real mode kernel since I always got R_386_16 truncated to fit and made a new kernel. The new kernel is running in protected mode, and booted from grub. I'm attempting to create a custom text rendering engine with adjustable fonts,but…
Clement Poon
  • 79
  • 1
  • 6
0
votes
0 answers

Cannot plot pixel in specific x, y coordinates

I finally managed to draw a pixel on the screen using the VESA BIOS Extensions in the protected mode. But I'm having a problem putting it in a different position (for example I want it to be in x=100, y=50). According to…
MARSHMALLOW
  • 1,315
  • 2
  • 12
  • 24
0
votes
1 answer

How to work with Isolated Storage and IE Protected Mode?

I have an Internet Explorer addin/plugin and need to use IsolatedStorage (.NET/C#/3.5) under "Low Privileges"/Protected Mode, so I plan to write to %USERPROFILE%\AppData\LocalLow How can I select that path?
0
votes
0 answers

Why is aI returning 32 instead of 64 in protected mode for IN AL, DX from IO port 0x1F7?

I want to send commands to the hard drive. I am aware that hard drive needs to be ready to receive and send commands. For the following code fragment why is al returning 32 instead of 64 in protected mode? ;no drive commands were executed…
CoderRC
  • 16
  • 1
0
votes
1 answer

Webdriver disable enhanced protected mode

I am using webdriver on IE11. And per selenium there are a set of required setting to run in IE11 one of them is to disabled "enhanced protected mode" in Internet Option > Advanced > Security (not the same as the enabled protected mode in Internet…
0
votes
1 answer

Video Output in Protected/Long Mode

I have a question about plotting pixels on screen in protected/long mode and video generation is OS in general. How I can display something on screen in high resolution, such as 19201080, or better for me, in 16801050 ( because of my little bit old…
user14629769
0
votes
1 answer

Why can't CPL be changed when running in an unprivileged ring (user mode)?

If the current privilege level is encoded in CS, which is modifiable by user-mode code, why can’t user-mode code modify CS to change CPL?
zerocool
  • 3,256
  • 2
  • 24
  • 40
0
votes
0 answers

(ATA PIO) Garbage reads from port

I have been trying to write a ATA PIO driver to load files from protected mode, but it would seem that all the data I recieve from the port is garbage (0xffff). This is my first time writing a PIO driver so Iam not really sure what I'm doing is…
qwn
  • 347
  • 3
  • 15
0
votes
1 answer

operand type mismatch for `out', 'in'

I have this function: uint8_t getcmosflpd(void) { uint8_t c; outb(0x70, 0x10); c = inb(0x70); return c; } When I compile it, I obtain this errors: /tmp/ccMmuD7U.s:28: Error: operand type mismatch for `out' /tmp/ccMmuD7U.s:39: Error:…
user10481362
0
votes
1 answer

Simple Bootloader to enter protected mode

I am attempting to write a simple bootloader for x86 architecture that should just output the character 'A', enter protected mode, then halt. My code, with comments, is as follows: BITS 16 ORG 0x7c00 jmp 0:start ;set cs to 0 start: mov…
0
votes
2 answers

Does offset operator in x86 returns logical address or offset address?

In real address mode: mov esi, OFFSET var ;esi 32 bit In protected mode: MOV si, OFFSET arr ;si 16 bit ; but MOV instructions works only if both the destination and source have same size Please help me clear my concept I am beginner.
Mrcreamio
  • 73
  • 2
  • 10
0
votes
0 answers

Excel is opening in Protected Mode after deletion of sheets using Java Apache POI

I have to delete some sheets from an Excel File. I have used the below code to delete the unnecessary sheets from the Excel file. public static boolean deleteUnnecessarySheets(Workbook workbook, boolean authorize) { if(workbook !=…