OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 8:42 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: a20 line on Hyper-v virtual machine
PostPosted: Wed Nov 18, 2015 7:15 pm 
Offline
Member
Member

Joined: Wed Nov 18, 2015 3:04 pm
Posts: 396
Location: San Jose San Francisco Bay Area
Hello there I implemented simple code to check a20 line that tests initial a20 state and toggle between enable/disable and check the a20 status again. Status check is done using port 92[1].
However, no matter setting the bit is set at 92[1], the actual test for a20 always comes out as turned on. Is i how it is designed for VM on hyperv?
The actual check that does the a20 status is:

save contents of 0000:0500h and ffff:510
copy 00h to 0000:0500h
copy 0ffh to ffff:0510h

compare 0000:0500 to ff.
if a20 is turned, the comparison should equal. (ffff:0510 wrapped to 0:500h)
if not comparison should not equal.

This is all done in real-mode.

Thanks.,

_________________
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails


Top
 Profile  
 
 Post subject: Re: a20 line on Hyper-v virtual machine
PostPosted: Wed Nov 18, 2015 7:45 pm 
Offline
Member
Member

Joined: Mon Jan 03, 2011 6:58 pm
Posts: 283
http://wiki.osdev.org/A20_Line


Top
 Profile  
 
 Post subject: Re: a20 line on Hyper-v virtual machine
PostPosted: Thu Nov 19, 2015 10:29 am 
Offline
Member
Member

Joined: Wed Sep 07, 2011 3:34 pm
Posts: 112
The A20 line is usually enabled on reset or (if not) by BIOS on modern PCs. Additionally, once enabled you probably won't be able to disable it even if you wanted to. So your bootloader really only needs to turn it on if it's not already on. My bare-metal projects include code to turn on the A20 line but I've never been able to test it, since I don't have a system that doesn't boot without it already enabled.


Top
 Profile  
 
 Post subject: Re: a20 line on Hyper-v virtual machine
PostPosted: Fri Nov 20, 2015 12:24 am 
Offline
Member
Member

Joined: Wed Nov 18, 2015 3:04 pm
Posts: 396
Location: San Jose San Francisco Bay Area
ok thanks, it looks like a20 is always enabled on hyper-v. May be just leave it there then.
I always put the logic wrong on my OP.

_________________
key takeaway after spending yrs on sw industry: big issue small because everyone jumps on it and fixes it. small issue is big since everyone ignores and it causes catastrophy later. #devilisinthedetails


Top
 Profile  
 
 Post subject: Re: a20 line on Hyper-v virtual machine
PostPosted: Fri Nov 20, 2015 3:40 am 
Offline
Member
Member

Joined: Thu Feb 09, 2012 6:53 am
Posts: 67
Location: Czechoslovakia
Properly designed hypervisor may intercept all attempts to turn off A20 (few ways via various ports) and then simulate A20 off for nonroot mode using EPT (Intel) / Nested Paging (AMD). Root mode will alway run with A20 on, as well nonroot, just physical memory for nonroot will look like A20 disabled.

_________________
hypervisor-based solutions developer (Intel, AMD)


Top
 Profile  
 
 Post subject: Re: a20 line on Hyper-v virtual machine
PostPosted: Fri Nov 20, 2015 8:29 am 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
You'll find that Virtual Machines are not true hardware "simulators". There are a lot of things that VMs do differently (or not at all) that real hardware does.

The rule of thumb appears to be, as long as Windows runs, that's good enough.

In most cases, end user performance is more important than strict accuracy. You'll find that some unimportant hardware registers aren't even implemented, or are just hard wired to a specific value.

_________________
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott


Top
 Profile  
 
 Post subject: Re: a20 line on Hyper-v virtual machine
PostPosted: Mon Nov 23, 2015 9:47 pm 
Offline
Member
Member

Joined: Wed Mar 09, 2011 3:55 am
Posts: 509
ggodw000 wrote:
ok thanks, it looks like a20 is always enabled on hyper-v. May be just leave it there then.


Unless your operating system will be running old DOS code, you don't need for it to be off (and probably need it to be on). Even then, you can simulate A20 being off with paging without needing to do anything with the A20 line at all. So if your A20 enabling code finds that A20 is already on, you're good to go. The only time you have a problem is if you can't turn it on.


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 34 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