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
1
vote
0 answers

Error: Illegal descriptor Type 0 for int 0

I Can't switch to protected mode in a DOS EXE program written in MASM. When loading the descriptor DOSBox gives the error: Illegal descriptor type 0 int 0. I created a function to load the descriptor table with 3 descriptor Null, Code, Data. And…
Rajul
  • 51
  • 6
1
vote
1 answer

about hardware drivers in protected mode

Recently, I'm trying to write a simple OS. This is a big project. when I'm writing my code, I'm wondering how modern OS contact hardware under protected mode In real mode, we can just call the bios interrupt to accomplish this job. But I'm wondering…
1
vote
1 answer

Switching to protected mode from DOS not using DPMI

I learned x86-16 assembly and i want to learn to x86-32 assembly. I maked a simple 32-bit program but this code not work When program makes a far jump console displays 'JMP illegal descriptor 0' I use fasm and DOS Please show me what i'm doing…
micheal007
  • 137
  • 9
1
vote
1 answer

APM in protected mode?

I am trying to implement APM to my OS. While I can enable APM in real mode (using int 0x15), how I can switch power states in protected mode? I need to jump to real mode or vm86 mode? I readed the documentation and I got more confused This…
user10481362
1
vote
1 answer

Issue when entering protected-mode from bootloader

this assembly code enters the protected mode from bootloader but fails to reset CS segment (or do the far jump) after the far jump is called and reboots. If I remove the far jump it goes into the infinite loop (0x66,jmp $) in protected mode just…
user145453
  • 137
  • 10
1
vote
1 answer

Starting 32 bit protected mode

I'm trying to start 32 bit protected mode in assembly but when I run it in dosbox I get error: "JMP illegal descryptor type 10" and when I run it in real dos, whole PC just restarts. Whole code: org 100h cli lgdt [GdtDesc] mov…
Segy
  • 213
  • 2
  • 12
1
vote
1 answer

Boot loader makes different results after lgdt in different virtual machines

I'm writing a simple boot loader. The boot loader is compiled from two assembly files: boot.asm, protected_start.asm. boot.asm loads protected_start to 0x10000, sets GDTR, enters protected mode and jump to 0x10000. So the encoding is set to 16-bit…
paxbun
  • 316
  • 1
  • 2
  • 9
1
vote
1 answer

OS development : switching to 32bit mode breaks my code

EDIT: My problem solved when I move everything after BITS 32 to disk_double_error but now it is still broken yesy it displays the message but then when i hit Y it just restarts/reboots the system What may be the reason for that ? (sry for bad…
Programmer
  • 11
  • 5
1
vote
1 answer

Win32API.OpenFileMapping Throws Access Violation Exception From IE ToolBar

We are trying to Memory Mapping File Technique to share some information across the processes But when we use this in one of our component which is IE Toolbar it throws access violation exception when IE is running in protected mode. Can someone…
1
vote
1 answer

Is there a way to call user space function form linux kernel module?

Imagine a situation like this: I'll take a function pointer, which is located in the user space, from a syscall, and the kernel module calls back this function. (It would be important for this function to run in user space) Will the kenel module see…
1
vote
0 answers

Long jump to 32-bit code does not seem to take effect after switching to protected mode

After much debate with myself, I have finally decided to move my OS to Protected Mode. However, I am having a few issues executing Protected Mode code. The first step on the OSDev wiki was to enable the A20 line, something I had little trouble with…
1
vote
3 answers

OsDev syscall/sysret and sysenter/sysexit instructions enabling

I am building an 32 bit OS in assembly. I have setup the IDT and I am handling program interruptus through int instruction. How can I enable the syscall and sysenter instructions and how do I handle them/return? Is true that syscall instruction…
1
vote
0 answers

Reboot loop when enabling interrupts with sti

Whenever I try to enable interrupts using the sti command, the emulator instantly reboots. I am executing the following code in protected mode on bootup: void* idt = (void*) 0x00000; struct { uint16_t length; void* base; }…
user5501885
1
vote
0 answers

Trouble closing pdf window displayed in .net modal dialog Adobe Reader “protected mode” enabled

Hi ~ We have just updated Adobe Reader to DC. I've spent days searching for a solution to my problem but have come up empty. The situation is this..I am rendering a byte string in a .net aspx page that is launched as a modal dialog with code like…
BLotty
  • 11
  • 2
1
vote
2 answers

What debugger can you use on a DOS procted mode program?

I have a program written in CA-Clipper 5.2 and linked with Blinker 7. I recently learned how to compile it into protected mode in place of real mode. Now the real mode debugger won't work with the program. So now I need a way to debug my code. …
Slow Slosh
  • 31
  • 1
  • 4