Questions tagged [real-mode]

x86 real mode is where a CPU begins execution. It has a 20-bit memory address space and unlimited direct software access to all addressable memory, I/O addresses and peripheral hardware. It has no concept of virtual memory, paging or memory protection as in protected-mode and long-mode. Use this tag for programming questions related to real mode.

Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs.

Real mode is characterized by

  • a 20-bit segmented memory address space (giving exactly 1 MiB of addressable memory) and
  • unlimited direct software access to all addressable memory, I/O addresses and peripheral hardware, it
  • provides no support for memory protection, multitasking, or code privilege levels.

Before the release of the 80286, which introduced real mode was the only available mode for x86 CPUs. In the interests of backwards compatibility, all x86 CPUs start in real mode when reset, though its possible to emulate real mode on other systems when starting on other modes.

281 questions
8
votes
1 answer

Near call/jump tables don't always work in a bootloader

General Problem I've been developing a simple bootloader and have stumbled on a problem on some environments where instructions like these don't work: mov si, call_tbl ; SI=Call table pointer call [call_tbl] ; Call print_char using near…
Michael Petch
  • 46,082
  • 8
  • 107
  • 198
8
votes
2 answers

Why test port 0x64 in a bootloader before switching into protected mode?

In my MIT OS course (686) I have found some code that I don't understand. I'm trying to understand the instruction inb $0x64, %al in boot/boot.S. My understanding is that it's reading one byte from data port 0x64 into AL, What is port 0x64? Which…
Mike
  • 1,841
  • 2
  • 18
  • 34
8
votes
2 answers

Segment size in x86 real mode

I have one doubt regarding the size of segments in real mode as they can't be more than 64K but can be less than that. My question is how these segment size and base address is initialized? Like there are GDT's and LDT's in protected mode. Real mode…
Arka Sharma
  • 289
  • 1
  • 3
  • 10
7
votes
1 answer

Transition from real to protected mode in the Linux kernel

I am currently studying low level organization of operating systems. In order to achive that I am trying to understand how Linux kernel is loaded. A thing that I cannot comprehend is the transition from 16-bit (real mode) to 32-bit (protected mode).…
7
votes
1 answer

What does the colon : mean in x86 assembly GAS syntax as in %ds:(%bx)?

I am new to x86 assembly and I am trying to understand the code in this document : http://www.cs.cmu.edu/~410-s07/p4/p4-boot.pdf page 3 : movw $0x1234, %ax movw %ax, %ds movw $0x5678, %bx # The following instruction is the same as "movw $0x1337,…
Lilás
  • 1,111
  • 1
  • 16
  • 29
6
votes
3 answers

CONCEPT OF MOV AX,CS and MOV DS,AX

Can someone please explain the functions of these three instructions? ORG 1000H MOV AX,CS MOV DS,AX I know what the code, data, and extra segments are in theory, but: How they are implemented in this program? Why is the entire segment…
Muthu Ganapathy Nathan
  • 3,199
  • 16
  • 47
  • 77
6
votes
1 answer

Any way to list the BIOS drive numbers in real mode

Is there any way to list the BIOS drive indexes in real mode (E.g. 0x80, 0x81 ...)? I did not find any interrupt that is in charge of listing drive numbers!!
6
votes
1 answer

16-bit C compiler for real-mode kernel development?

I've tried nearly every C compiler with every setting, and I have yet to find a C compiler that can compile C into Intel x86 code that is suitable for Real Mode kernel development. I don't need any spiels on why you should use protected mode; I just…
Joseph Caruso
  • 175
  • 1
  • 11
6
votes
1 answer

How does setting the PE flag in CR0 enable protected mode?

I am trying to understand how a machine goes from power on to running a kernel. From what I've gathered, it is useful to switch into protected mode during boot up in order to gain access to more addressable memory even if we will eventually switch…
Pedro Cattori
  • 2,735
  • 1
  • 25
  • 43
6
votes
2 answers

Reset vector in 386+ processors

The wikipedia page for Reset vector says (for 386+ processors): The value of the selector portion of the CS register at reset is F000h, the value of the base portion of the CS register is FFFF0000h, and the value of the IP register at reset is…
Cygnus
  • 3,222
  • 9
  • 35
  • 65
6
votes
1 answer

Why do interrupts need to be disabled before switching to protected mode from real mode?

I saw in many many oses (and some bootloader), they all disable interrupt (cli) before switch to protected mode from real mode. Why we need do that?
Bình Nguyên
  • 2,252
  • 6
  • 32
  • 47
5
votes
1 answer

16 bit C code for real mode kernel

I don't know how to compile my C kernel for 16 bit real mode. I have tried a variety of compilers with no luck. My bootloader simply loads raw sectors from the floppy (my kernel lives right after the first sector on the disk) to the physical memory…
TheFuzz
  • 2,607
  • 6
  • 29
  • 48
5
votes
1 answer

Why isn't my code working when adding .386?

As explained in the title, I need to make this code able to do the same things it do using just 16bit but adding .386 to the code so I can use 32bit registers. But when I add the .386 now my code isn't printing anything, any idea how I can fix this.…
Diego Esquivel
  • 182
  • 1
  • 12
5
votes
2 answers

how does cpu calculate 20-bit address in real mode

i know it uses physical address = segment register << 4 + offset register. Although these two registers are 16-bits, how can 8086 handle a 20-bit plus operation?
Oxdeadbeef
  • 1,033
  • 2
  • 11
  • 26
5
votes
1 answer

Is there a way to get the list of all BIOS interrupts present on the current system programmatically?

I'm looking for a list of BIOS interrupts supplied by my PC. To get the most common BIOS calls, there are various public resources, but I was hoping for a list of all (possibly not very public) BIOS calls for my PC. Is there a program to do this, or…
S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
1
2
3
18 19