OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 4:32 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Some questions about x86-64 modes
PostPosted: Wed Mar 15, 2017 10:18 pm 
Offline

Joined: Fri Jan 20, 2017 4:35 pm
Posts: 11
Hi,

i am following that tutorial http://wiki.osdev.org/Setting_Up_Long_Mode and am blocked at some points, first "The Switch from Real Mode" so we are in real mode here so why do we use ecx and others 32 bits elements ? Other question, at "Entering the 64-bit Submode" what is the difference between IA32e mode and 64-bit long mode ? I understand the first allows us to execute 32bits code but does it allows us to execute 64bits code also ? And the second, i understand it allows us to execute 64 bits code, what are avantages to use one or other ? Last question, at same point as the previous, there is writed "Our GDT (see chapter 4.8.1 and 4.8.2 of the AMD64 Architecture Programmer's Manual Volume 2) should look like this:", here is specified amd processor does x86-64 intel has the same working ?


Top
 Profile  
 
 Post subject: Re: Some questions about x86-64 modes
PostPosted: Thu Mar 16, 2017 1:18 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
ComputerMail wrote:
first "The Switch from Real Mode" so we are in real mode here so why do we use ecx and others 32 bits elements ?

Because 32-bit operations are convenient, even in real mode.

ComputerMail wrote:
Other question, at "Entering the 64-bit Submode" what is the difference between IA32e mode and 64-bit long mode ?

The wiki page was wrong, it's supposed to say "compatibility mode" instead of "IA-32e". (IA-32e is Intel's name for AMD64.) I've corrected the wiki page.

ComputerMail wrote:
I understand the first allows us to execute 32bits code but does it allows us to execute 64bits code also ?

You can't execute 64-bit code in compatibility mode.

ComputerMail wrote:
And the second, i understand it allows us to execute 64 bits code, what are avantages to use one or other ?

That question has been answered many times. Have you already tried asking Google?

ComputerMail wrote:
here is specified amd processor does x86-64 intel has the same working ?

Yes. (There are a few small differences between AMD64 and IA-32e, but the GDT is not one of them.)


Top
 Profile  
 
 Post subject: Re: Some questions about x86-64 modes
PostPosted: Thu Mar 16, 2017 1:21 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
This should be posted in OS Development and not in this subforum.

The difference between real mode and protected mode is not their operand size but the way that segment registers are handled. Real mode only allows accessing 1 MiB of memory but it does not prevent execution of 32-bit instructions. In 16-bit modes (= real mode and 16-bit protected mode) 32-bit instructions need an operand size override prefix. Likewise in 32-bit modes 16-bit instructions need such a prefix.

IA32e is Intel's term for 64-bit long mode. Intel's and AMD's implementations of x86_64 are almost binary compatible (except for things like VT-x/SVM, Machine Check, Performance Monitoring, ...).

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group