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
2
votes
1 answer

QEMU registers and eip are destroyed after moving 0x18 in ds

Im currently learning to build my own bootloader. I was able to setup a gdt and get into protected mode. But when i tried to move 0x18 (third segment in gdt) into ds most of my registers are destroyed and eip gets something random Code that causes…
Toboxos
  • 170
  • 9
2
votes
2 answers

Ancient history: Was any version of Turbo Pascal able to compile to Protected Mode on 286 or higher?

I remember 1990's Turbo Pascal 6.0 which had several compiler switches for 80286-specific features, all with a note that they work only in Real Mode but not in Protected Mode. Did Turbo Pascal ever have a compiler that could compile to 286 Protected…
Andrew J. Brehm
  • 4,448
  • 8
  • 45
  • 70
2
votes
1 answer

Video card programming without BIOS interrupts

Currently, I need to create custom OS to test some ideas. My question is: How to set resolution of video card without interrupts? My system supports multiboot standard and kernel starts in protected mode, so I probably cannot use BIOS services. I…
nintyfan
  • 386
  • 3
  • 16
2
votes
1 answer

Set custom base address of video memory VGA/VESA in assembly

I started programming in 32-bit protected mode. Im using it for high graph resolutions like 1280x1024 256 colors: mov ax,0x4F02 mov bx,0x107 int 0x10 but I have a problem with size of video memory (VRAM) because after switching to this resolution…
Segy
  • 213
  • 2
  • 12
2
votes
0 answers

Can not enter from 16 bits to 32 bits mode

I am trying to create a simple bootloader that load my kernel in 32 bits mode. I read many articles and forums and write a bootsector 512 bytes and then a bootloader stage2. In stage 2, i can load gdt,A20,protected mode. but when i jump to 32 bits…
madkne
  • 21
  • 1
  • 4
2
votes
1 answer

Windows 7 Internet Explorer 8 protected mode issue

I developed a Java applet that launches an executable file. When I launch an executable file using the applet - with "protected mode activated" - my sistem crashes. If I were to put my website in the trusted sites' list, it would work. However, I…
Kevin
  • 552
  • 2
  • 8
  • 17
2
votes
0 answers

Segment move for AT&T

How can I convert the following code into AT&T syntax? mov es:[di], al I'm trying to write a pixel to the screen with AT&T syntax in protected mode.
user2997204
  • 1,344
  • 2
  • 12
  • 24
2
votes
3 answers

Windows XP: Have my program run in kernel mode?

I'm currently learning about the different modes the Windows operating system runs in (kernel mode vs. user mode), device drivers, their respective advantages and disadvantages and computer security in general. I would like to create a practical…
Kalamari
  • 21
  • 1
  • 2
2
votes
1 answer

Entering Protected Mode: Triple-Fault

I am adding SMP to my kernel, in which the AP should boot. It starts in realmode and faults on entering protected mode. To be clear, it faults on the JMP 0x8:... after loading CR0. I am sure that the AP is getting its code, because looping anywhere…
Shukant Pal
  • 706
  • 6
  • 19
2
votes
1 answer

Unable to find element on closed window in Python using Selenium

def check_text(browser, sitename): browser.get(sitename) try: text = browser.find_element_by_class_name("text_content").text if "foo" in text: print("ok") else: print("not ok") except…
cosminp
  • 258
  • 2
  • 4
  • 15
2
votes
0 answers

Trying to return from Protected Mode to Real

i'm trying to go back to real mode, after protected, and processor just got stuck right after changing cr0 register. I'm using nasm, and compile my program as binary .img to run under virtualbox as bootloader. Probably I'm missing something with…
xdegtyarev
  • 135
  • 1
  • 8
2
votes
1 answer

x86 protected mode memory management

I'm newibe of x86 cpu. I read all materials about memory management of protected mode in x86. the materials are Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3A, System Programming Guide, Part 1 I believe I understand the…
김종현
  • 151
  • 1
  • 1
  • 4
2
votes
1 answer

Issues with exception handling

I was following Bran's tutorial on GDT, IDT and ISR. I wrote the exception handler, but when I tested it by dividing by zero, it went into a triple fault. I'm not sure what I did wrong. Here is descriptor_table.h: #ifndef…
2
votes
1 answer

x86 Switching to protected mode from real mode CPL (Current Privilege Level)

In x86, after we set the PE bit CR0, we do a far JMP to ensure that CS/EIP is changed. When I look at the logic flow in x86 programmers manual, corresponding to this far JMP instruction (protected mode), I see something like this: Set RPL field of…
Kamalakshi
  • 6,918
  • 3
  • 17
  • 21
2
votes
4 answers

int 13h in windows protected mode?

Could we use the Int 13h (direct disk read/write) in Windows operating systems or does the windows protected mode not allow us, and if so is there a work round? Thanks in advance.
Auxiliary
  • 2,687
  • 5
  • 37
  • 59