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

Writing to windows Event Log from within IE extension in Protected Mode - fails with Access Denied

In a BHO running within Internet Explorer on Windows 7 with Protected Mode On, I'm trying to write to the windows event log. I'm writing to a source that already exists, and it's in the Application Log so I don't see why this would be blocked.…
Rory
  • 40,559
  • 52
  • 175
  • 261
0
votes
0 answers

section not metioned in linker script

What happens if I dont provide any information in my likner script for some section? Where it would be located? For example if I have following linker script SECTIONS { .text = { *(.text) } } And in my .S file I have some another section…
PepeHands
  • 1,368
  • 5
  • 20
  • 36
0
votes
0 answers

Possibility of existence of CPU backdoor on famous CPUs

I'm not claiming that this has already happened. My question is, how can I make sure that there is not an undocumented CPU instruction designed intentionally to be used as a backdoor? An illegal opcode or a sequence of instructions, which, when…
0
votes
1 answer

How to record real-time stream in IE browser plugin

I am writing an IE plugin (32bit ActiveX dll) for Win7/Win10/Vista to record data from one or more remote IP camera(s). Recording to some target directories (mostly in NTFS partition and/or on USB devices) are not successful due to fopen_s(&fp,…
user1547688
  • 121
  • 1
  • 8
0
votes
1 answer

Firefox protected mode and as3 flash player microphone bug?

I am building a cam publishing client in as3 for flash. It's almost finished, but I encountered some weird problem. In all browsers it works like a charm, but I discovered after two days of debugging that the "protected mode" of Firefox crashes the…
rsdrsd
  • 307
  • 1
  • 4
  • 13
0
votes
2 answers

How to setup Stack segment in protected mode?

This problem is that I defined one Data and Stack segment in x86 protected mode with selector under GDT. When jmp to protected mode, It seems I can access the data section but crash when push eax. See following Code: %include…
0
votes
1 answer

about GDT and processes

how does GDT reflected on linear space of process ( if I understand it right, GDTR contains page and offset ) .? or another version of this question : GDTR is unique for each process .?
Volodymyr Boiko
  • 1,533
  • 15
  • 29
0
votes
1 answer

Interrupt Descriptor Table Gate

I've written this code to create a sample IDT and load it in to the proper register. I've checked Intel System programming guides for proper structures, and yet I can't get interrupts working. While running kernel code in Bochs, and triggering…
0
votes
1 answer

Why cannot BIOS be written to run in protected mode?

Are there still 8088 based computers or pre-80286 computers in use? Why should this backward-compatibility feature of "first-starting-in-real-mode" be still present if those old processors are not in use anymore? Why cannot processors directly run…
Kamalakshi
  • 6,918
  • 3
  • 17
  • 21
0
votes
1 answer

Protected mode, setting segment registers

I'm recently playing with gnu-assembler in simple os development. I'm using code below to switch CPU to protected mode. In order to do this I set GDT as follow and performed far jump to given label wit 0x08 as GDT offset (to set CS). CPU did not…
Ufo
  • 225
  • 5
  • 17
0
votes
2 answers

How to program in 16 bit protected mode with more than 64kb of data?

I want to write some code for the 16 bit protected mode, specifically a simple operating system with some programs. I know this sounds silly and it probably is, but I'm interested in understanding how to write programs under these constraints. I'd…
fuz
  • 88,405
  • 25
  • 200
  • 352
0
votes
1 answer

C++ - 32 bit Protected Mode

I am working on an OS kernel which will be written in 32 bit C++. I need to figure out how I can enable 32 bit protected mode/enable the a20 gate in C++. So, may you tell me if that is possible and if so how? Thank you.
crank123
  • 251
  • 1
  • 4
  • 17
0
votes
2 answers

Infinite loop when i try to compile a C program, with self made kernel,in protected mode, using nasm and qemu

My operating system is Ubuntu. I am trying to follow through a tutorial building a kernel..Even though i ve built the kernel, when i try to compile a simple C program that prints an 'X' on the top left corner of the screen in qemu,the screen just…
Mistah Oua
  • 11
  • 3
0
votes
2 answers

How to use combination keys using IN instruction assembly protected mode?

I'm using this code to get input from keyboard but i can't figure a way to get combination keys like "shift + a" = A keypressed: in al,60h test al,80h jnz keypressed and al,7fh mov bx,table dec al xlat cmp…
HM2D
  • 1
  • 2
0
votes
2 answers

How to print a string in protected mode in c

I am starter in os Deving and manage to make a bootloader and then a kernel.I cam successfully jumped to protected mode and transfer the control to kernel.I able to write single characters but printing string is not working.This is my printString()…