logo       

[PATCH] Centralizing understanding of far pointers: msg#00503

grub-devel-gnu

Subject: [PATCH] Centralizing understanding of far pointers

This patch modifies the machine-specific memory.h (currently, just the
i386-specific file), adding a new type grub_machine_farptr and two
functions to convert between such far pointers and normal C pointers.

The code performing the mapping between realmode and pmode addresses is
simple, and thus is repeated in many source files like drivemap, vbe*,
mmap, etc. However, as simple as it is, its ad-hoc application tends to
be quite unwieldy, generating long code that is verges close to the tag
of write-only code.

The i386 farptr type has been implemented as an union between the uint32
that was used until now (.raw_bits) and a structure separating the
uint16 segment and offset parts for easy access and debug printing.

This post has three attachments: the patch to memory.h itself, a patch
to the i386 mmap.c and its helper asm file, to show the impact of this
patch (I've also taken the liberty of adding an offset macro just like
in drivemap, and make the changed code more elegant in my opinion), and
another patch doing the same for drivemap.

NOTE: this patch depends on the PTR_TO_UINT macro added by another patch
still on discussion, [1].

[1] http://lists.gnu.org/archive/html/grub-devel/2009-07/msg00398.html

--
-- Lazy, Oblivious, Recurrent Disaster -- Habbit

Attachment: rmode.patch
Description: Text Data

Attachment: example_mmap.patch
Description: Text Data

Attachment: example_drivemap.patch
Description: Text Data

_______________________________________________
Grub-devel mailing list
Grub-devel@xxxxxxx
http://lists.gnu.org/mailman/listinfo/grub-devel
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise