OSDev.org

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

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Get EFI/UEFI Memory Map
PostPosted: Sun May 21, 2017 5:00 am 
Offline
Member
Member
User avatar

Joined: Sat May 20, 2017 1:25 am
Posts: 51
Location: PCI bus: 3, slot: 9, function: 5
How can i get EFI/UEFI memory map like BIOS eax=0x0000E820, int 0x15 ?
Also how can detect if the os is running under Bios or EFI/UEFI ?

_________________
How people react when a new update of your OS is coming:
Linux user: Cool, more free stuff!
Mac user: Ooh I have to pay!
Windows user: Ah not again!


Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Sun May 21, 2017 5:44 am 
Offline
Member
Member

Joined: Wed Oct 30, 2013 1:57 pm
Posts: 306
Location: Germany
It seems that you haven't done your homework. Just searching for 'UEFI' on the wiki gets me to this page. Getting the memory map in UEFI involves calling a function that will return it to you. To figure out which one exactly it is is your job. Tip: you need a part of the memory map information to exit boot services. Also, judging by the wiki, it would probably take some major hack to get a UEFI (kernel) binary to also be a valid multiboot(2)-kernel at the same time. I haven't seen this done before, and you probably shouldn't be eager to be the first to do it.

All of this goes to say that by doing basic research, it is fairly obvious that you know whether you're running on UEFI or good old BIOS at compile time, as you'll be creating separate binaries.

_________________
managarm


Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Sun May 21, 2017 7:43 am 
Online
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 641
Location: Ukraine, Bachmut
zero effort. I understand, you want to do great things, but you don't want to mess around learning and routines. this combination always fails.
go and read the UEFI specification. it writes about memory map quite well.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Wed Jun 14, 2017 5:00 am 
Offline

Joined: Tue Jun 13, 2017 3:17 am
Posts: 23
no92 wrote:
It seems that you haven't done your homework. Just searching for 'UEFI' on the wiki gets me to this page. Getting the memory map in UEFI involves calling a function that will return it to you. To figure out which one exactly it is is your job. Tip: you need a part of the memory map information to exit boot services. Also, judging by the wiki, it would probably take some major hack to get a UEFI (kernel) binary to also be a valid multiboot(2)-kernel at the same time. I haven't seen this done before, and you probably shouldn't be eager to be the first to do it.

All of this goes to say that by doing basic research, it is fairly obvious that you know whether you're running on UEFI or good old BIOS at compile time, as you'll be creating separate binaries.

Linux has a compile option (CONFIG_EFI_STUB) that when enabled makes it valid for both UEFI and multiboot.

_________________
NekOS: https://hg.sr.ht/~scoopta/NekOS


Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Wed Jun 14, 2017 1:02 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

Scoopta wrote:
Linux has a compile option (CONFIG_EFI_STUB) that when enabled makes it valid for both UEFI and multiboot.


Note: Linux doesn't use multi-boot (normally it uses Linux Boot Protocol).


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Thu Jun 15, 2017 8:45 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
Brendan wrote:
Scoopta wrote:
Linux has a compile option (CONFIG_EFI_STUB) that when enabled makes it valid for both UEFI and multiboot.


Note: Linux doesn't use multi-boot (normally it uses Linux Boot Protocol).


I would call this splitting hairs, though it is fair to say that it is not so much that Linux running MultiBoot as it is MultiBoot running Linux.

While Linux has the LBP, that is not in and of itself a boot loader; rather, it is a protocol for communicating with a boot loader during the pass-off. It doesn't much care how it is loaded, so long as the loader provides the necessary information and sets the operational mode before transferring control.

MultiBoot was designed specifically with LBP in mind. Most of the oddities of MultiBoot, and of GRUB in particular, are due to the requirements of the Linux initialization. It was written to work with other systems, of course, Windows in particular (though you will not that, last I checked, it chainboots Windows rather than loading it), as being able to boot both Windows and Linux on a single system was the entire point of it, but it is primarily a Linux-oriented protocol.

AFAIK, the 'official' default boot loader for Linux is still LILO, but in practice, the majority of Linux installations have used GRUB since around 2005.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Last edited by Schol-R-LEA on Thu Jun 15, 2017 8:50 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Thu Jun 15, 2017 8:48 am 
Offline
Member
Member
User avatar

Joined: Wed Jan 06, 2010 7:07 pm
Posts: 792
You seem to be confusing multiboot and grub? All of LILO, Grub, Syslinux, etc. use Linux's boot protocol. All of ones that boot Windows use chainloading. At no point is multiboot involved.

_________________
[www.abubalay.com]


Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Thu Jun 15, 2017 8:53 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
Rusky wrote:
You seem to be confusing multiboot and grub? All of LILO, Grub, Syslinux, etc. use Linux's boot protocol. All of ones that boot Windows use chainloading. At no point is multiboot involved.


GRUB is a MultiBoot loader, and in fact was originally intended as the reference implementation of the MultiBoot protocol - part of the reason its UI is so shallow and minimal is because the expectation was that other implementations would follow. GRUB is, or at least was, meant only to demonstrate how the MultiBoot Protocol works.

Windows is chainloaded on all MB loaders because Windows doesn't support MB, and in fact doesn't work with any loader other than its own. The provision for chainloading was a core feature of MBP from the start, because the whole point was to make it easier for Linux and Windows to exist on the same box. Windows doesn't play well with others, hence the need for chainloading.

What surprises me is that multi-booting - or even single-booting an OS directly on bare metal - is still a thing at all. I would have expected that the use of hypervisors (with a rump OS that just lets you launch and switch between OSes) would be universal by now, but given the massive pain that can be involved in using either HyperV or Xen I suppose I can see why. Also, a lot of people can't afford the memory and disk space to make it feasible - I know I can't - but still, I would expect it to be the rule rather than the exception, even for consumers who would have no need or wish to run multiple systems.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: Get EFI/UEFI Memory Map
PostPosted: Thu Jun 15, 2017 10:55 am 
Offline
Member
Member
User avatar

Joined: Wed Jan 06, 2010 7:07 pm
Posts: 792
Chainloading isn't part of MultiBoot, it merely happens to be supported by several bootloaders that also support MultiBoot and the Linux protocol.

(FWIW, I think most people do use VMs for running multiple OSes at this point, and only use rebooting for experimentation or if they need graphics acceleration and don't want to bother with PCI passthrough.)

_________________
[www.abubalay.com]


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 66 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