Re: doubt in protected mode



OS wrote:
Hi all,

I have doubt about the memory manager. When i compile any asm
program

*assembly* code gets *assembled* by an *assembler*... not *compiled* by
a *compiler* ;)

1) if the base address for code and data segment is zero and paging is
disabled , which part of memory will the code and data will be copied

Zeroing-out CS/DS is a 16-bit Real Mode concept. In 32-bit Protected
Mode, Segment Selector Registers point to an entry in the GDT, which in
itself specifies how memory is to be accessed. If you did indeed
zero-out CS/DS (and even SS) in 32-bit Protected Mode, you'd probably
run into a GPF due to CS/DS/SS addressing the mandatory "null" entry in
the GDT. Depending on how critical this access is, you could easily
triple-fault the computer.

2) will the content of the data segment in the real mode, copied to the
data segment in the
protected or how to know whether the content of code and data segment
belongs to real or
protected mode,

That is the job of the OS programmer.

3) which part of code segment and data segment will be copied in real
mode and
which part of code and data segment will be copied to protected
mode ? when i executed a
asm program

Redundant question. All-in-all, it sounds like you do not have an
understanding of OS basics. It takes much more than simply setting
registers to have an OS Kernel.

CLI
STI
GDT/GDTR
IDT/IDTR
EOI
TSS

If you don't thoroughly understanding what those acronyms/instructions
are, what they mean and what they do... and you are serious about OS
Dev, then you need to Google for material like Dark Fiber's OS Faq
and/or search sites like osdev.org... get a copy of Intel's processor
docs (PDF) and start reading.

Good luck.

.



Relevant Pages

  • doubt in protected mode
    ... I have doubt about the memory manager. ... When i compile any asm ... the map file which will contain information about the code segment ... Now iam jumping to protected mode. ...
    (comp.lang.asm.x86)
  • doubt in protected mode
    ... I have doubt about the memory manager. ... When i compile any asm ... the map file which will contain information about the code segment ... Now iam jumping to protected mode. ...
    (alt.lang.asm)
  • Re: What exactly is Protected Mode?
    ... > Protected mode seems to me to indicate a flag is triggered somewhere ... (memory manager unit), it used a completely brain-dead addressing ... In short, the 8086 was a cheap and cheerful microprocessor, similar to ... BUT, at the same time, Intel could not simply unveil a brand new chip ...
    (alt.lang.asm)
  • Re: [PATCH] x86: percpu_to_op() misses memory and flags clobbers
    ... I found x86 asm was a litle bit optimistic. ... memory and possibly eflags. ... The "+m" already tells gcc that var is a ...
    (Linux-Kernel)
  • Re: [patch] spinlocks: remove volatile
    ... for all the issues that are fundamental today: CPU memory ordering in SMP, ... We're not talking about "asm volatile". ... If all the output operands are for that purpose, ...
    (Linux-Kernel)