Adressing specific pointer in C
Posted: Mon Jun 06, 2011 4:24 am
Hi hi,
I wrote some code in assembly to create an array of memory map entries. I store them at an address specified by es:di. I store the pointer of the array in a label:
Not sure if that is correct.. mmr looks like this:
I have a global routine which returns the address of mmr. That works, I can access the entry count and the entry size (tested it in C). But I can't get that pointer to the first entry working.. The entries are stored at the correct place because I have tested that in assembly with an segment:offset pointer.
-- Bietje
Edit:
Code I have tried so far:
I wrote some code in assembly to create an array of memory map entries. I store them at an address specified by es:di. I store the pointer of the array in a label:
Code: Select all
lea edx, [es:di]
mov [mmr], edx
Code: Select all
mmr:
dd 0 ; pointer address
dw 0 ;entry count
db 24 ; entry size
-- Bietje
Edit:
Code I have tried so far:
Code: Select all
unsigned int testmm()
{
unsigned char * mmr = getmmr(); // get the address of mmr
unsigned char * entryarray = ((unsigned char*)((unsigned short)*(mmr))); // address to the first entry
unsigned int acpi = *(entryarray+20); // get a known value from the first entry
return acpi;
// struct mmap_entry entries[6];
}