From: "Vesa Jääskeläinen" <chaac@nic.fi>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [RFC] Platform information services
Date: Fri, 15 Aug 2008 23:26:42 +0300 [thread overview]
Message-ID: <48A5E682.3070006@nic.fi> (raw)
In-Reply-To: <1218831181.2510.56.camel@localhost>
Javier Martín wrote:
>>> An use case would be in the proposed drivemap module, in the function
>>> installing an interrupt handler in the real-mode IVT: instead of the
>>> current code with magic addresses,
>>>
>>> /* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
>>> grub_uint32_t *ivtslot = (grub_uint32_t*)0x0000004c;
>>>
>>> The module could be like this:
>>>
>>> /* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
>>> grub_uint32_t *ivtslot = 19 +
>>> (grub_uint32_t*)grub_machine_get_fwstruct(GRUB_I386_PC_IVT);
>> The better way that complies with all your error cases provided:
>>
>> grub_ivt_entry_t *entry;
>> entry = grub_get_ivt_entry(0x13);
>> *entry = new_value;
> This was another of the solutions I was considering in this thread (the
> "many-functions approach"), I just found the single-function solution
> more elegant in the case of "large numbers" (>10) of structures becoming
> visible through this method, but your snippet looks fine and "safer".
It is only visible within platform where it is used, so that is not a
problem. "Large number" of structures are still needed for that platform
(and if they are not needed, then there is no need for the function) and
that need cannot be discarded in anyway. Unless you want to use magic
numbers to define offsets...
So I would dismiss the idea and continue to use other methods.
>> of course grub_ivt_entry_t could be renamed to be something like
>> grub_realmode_addr_t.
> grub_realmode_farptr_t would suit better IMO.
Please be free to use that.
next prev parent reply other threads:[~2008-08-15 20:26 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
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 [this message]
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=48A5E682.3070006@nic.fi \
--to=chaac@nic.fi \
--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.