From: "Javier Martín" <lordhabbit@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [RFC] Platform information services
Date: Thu, 14 Aug 2008 23:29:22 +0200 [thread overview]
Message-ID: <1218749362.19647.20.camel@localhost> (raw)
In-Reply-To: <20080814180005.GB5614@thorin>
[-- Attachment #1: Type: text/plain, Size: 2990 bytes --]
El jue, 14-08-2008 a las 20:00 +0200, Robert Millan escribió:
> On Thu, Aug 14, 2008 at 06:38:41PM +0200, Javier Martín wrote:
> > Yes, but this is a "kernel" design decision that is specified nowhere
> > to the modules writers. Thus, this could change tomorrow and the
> > scheme would break down.
>
> GRUB is being developed as a whole, which includes kernel and modules. If
> we modify the kernel in a way that could break modules, it's part of the
> procedure to check modules and make sure they don't break because of this
> (although, of course, we could always make mistakes).
>
That is a very sane policy, but in this case I'm arguing that an
improvement could be made so that such process would not be necessary,
or would be much lighter, regarding a particular section of the kernel
because modules would not rely on certain assumptions about the internal
implementation of GRUB: separation of interface and implementation.
However, there is not a consistent, fully-documented kernel-module
interface, and module developers usually do not know what invariants
hold in their environment - they find it by trial and error. This needs
to change eventually, particularly in the documentation part (please
avoid GRUB ending like ALSA): the GRUBInternals page in the wiki should
be filled up and updated a bit more often.
WRT "kernel and modules going hand by hand", think about external
modules: if the drivemap module is finally rejected for introduction in
GRUB, I will not scrap it, but keep it as a module external to the
official GNU sources and possibly offer it in a web in the form of
patches to the official GRUB2. In this case, changes made to the kernel
would not take into account that module, which would break if I weren't
monitoring this list daily.
Additionally, the cost of this function in platforms which don't have
any structs registered yet, as the function could be a stub like this:
void* grub_machine_get_platform_structure (int stidx)
{
grub_error (GRUB_ERR_BAD_ARGUMENT, "Struct %d not supported", stidx);
return 0;
}
The kernel space taken would most likely be less than 50 bytes. For
i386-pc, it could be like this (also lightweight) function:
void* grub_machine_get_platform_structure (int stidx)
{
grub_errno = GRUB_ERR_NONE;
switch (stidx)
{
case GRUB_MACHINE_I386_IVT:
return /* Call to asm function that runs SIDT in real mode */ ;
case GRUB_MACHINE_I386_BDA:
return (void*)0x400;
default:
grub_error (GRUB_ERR_BAD_ARGUMENT, "Struct %d not supported",
stidx);
return 0;
}
}
BTW, I've noticed that when using the function, if the result is stored
in "void* p", then the success check cannot only rely on "if (p)",
because 0 is also a legal address (i.e. for the IVT). Thus, the checks
should be like "if (p || grub_errno == GRUB_ERR_NONE)" with the
implementation ensuring that errno is correctly set on success.
-Habbit
[-- Attachment #2: Esta parte del mensaje está firmada digitalmente --]
[-- Type: application/pgp-signature, Size: 827 bytes --]
next prev parent reply other threads:[~2008-08-14 21:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-14 3:36 [RFC] Platform information services Javier Martín
2008-08-14 16:09 ` Vesa Jääskeläinen
2008-08-14 16:38 ` Javier Martín
2008-08-14 17:41 ` Vesa Jääskeläinen
2008-08-14 21:45 ` Javier Martín
2008-08-14 18:00 ` Robert Millan
2008-08-14 21:29 ` Javier Martín [this message]
2008-08-15 16:31 ` Vesa Jääskeläinen
2008-08-15 17:03 ` Javier Martín
2008-08-15 17:14 ` Vesa Jääskeläinen
2008-08-15 17:59 ` Javier Martín
2008-08-15 18:35 ` Vesa Jääskeläinen
2008-08-15 19:18 ` Javier Martín
2008-08-15 19:46 ` Vesa Jääskeläinen
2008-08-15 20:13 ` Javier Martín
2008-08-15 20:26 ` Vesa Jääskeläinen
2008-08-15 22:38 ` Isaac Dupree
2008-08-15 23:06 ` Javier Martín
2008-08-16 7:03 ` Vesa Jääskeläinen
2008-08-16 12:20 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1218749362.19647.20.camel@localhost \
--to=lordhabbit@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.