Skip to contentSkip to conversation

Regarding virtual to physical memory mapping..

DISCUSSION kiran pawar 4 participants 4 messages Dec 31, 2009 – Jan 1, 2010

lore
Share & tools
lore
#0 lore raw

Hi all,
I am working on grub-1.97.1. I wanted to know if there is any mechanism
in grub2 that maps virtual addresses to physical addresses below 1 MB?
When I checked the code for grub-0.97, I found that there are function
as below

           #define  phys_to_virt(x) (x)
           #define  virt_to_phys(x) (x)

Are there any similar functions in grub-1.97.1?

Also, when I allocated memory using grub_malloc() and printed the address returned from the function it was (0x7da6d810). This seems to be a 32-bit address. I wanted to know whether I can allocate some memory in the region below 1MB?

Regards,
Kiran Pawar.

#1 lore raw
Quoted 9 lines · kiran pawar

Hi all,
I am working on grub-1.97.1. I wanted to know if there is any
mechanism in grub2 that maps virtual addresses to physical addresses below 1 MB?
When I checked the code for grub-0.97, I found that there are
function as below

           #define  phys_to_virt(x) (x)
           #define  virt_to_phys(x) (x)

grub runs without paging enabled. So such function is identity on x86.

Quoted 6 lines

Are there any similar functions in grub-1.97.1?

Also, when I allocated memory using grub_malloc() and printed the address returned from the function it was (0x7da6d810). This seems to be a 32-bit address. I wanted to know whether I can allocate some memory in the region below 1MB?

Only in experimental branch. But we're not currently sure if we will use this. If you want to make a BIOS call then use memory at GRUB_SCRATCH_ADDR. If you do something else please explain

Quoted 10 lines

Regards,
Kiran Pawar.
------------------------------------------------------------------------

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw
Quoted 8 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines · kiran pawar

Also, when I allocated memory using grub_malloc() and printed the address returned from the function it was (0x7da6d810). This seems to be a 32-bit address. I wanted to know whether I can allocate some memory in the region below 1MB?

Only in experimental branch. But we're not currently sure if we will use this. If you want to make a BIOS call then use memory at GRUB_SCRATCH_ADDR. If you do something else please explain

How come not? Here's how it's done in drivemap, for example
handler_base = grub_mmap_malign_and_register (16, total_size,
&drivemap_mmap, GRUB_MACHINE_MEMORY_RESERVED, GRUB_MMAP_MALLOC_LOW);

Signature · 1 line
-- Lazy, Oblivious, Recurrent Disaster -- Habbit
#3 lore raw
In reply to Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 4 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 2 lines

I wanted to know whether I can allocate some
memory in the region below 1MB?

Only in experimental branch. But we're not currently sure if we will use this.

We can use this. My concerns are with making intrusive changes in the standard heap. I think it's important that kern/mm.c is small and simple, but this doesn't preclude doing more fancy stuff in non-core areas.

Sorry if I was unclear about it.

Signature · 3 lines
Robert Millan

  "Be the change you want to see in the world" -- Gandhi