mmustructs: don't use addr to name structures
This breaks too easily, for example if &some_linker_variable is used. The names don't matter at all, use preprocessor __COUNTER__. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
e55fd562ec
commit
c9814f5104
1 changed files with 11 additions and 2 deletions
|
@ -129,10 +129,13 @@ struct mmu_region {
|
|||
* region_size has to be provided in bytes
|
||||
* for read write access = MMU_ENTRY_READ/MMU_ENTRY_WRITE
|
||||
* for supervisor/user mode access = MMU_ENTRY_SUPERVISOR/MMU_ENTRY_USER
|
||||
*
|
||||
* Preprocessor indirection layers used to ensure __COUNTER__ is expanded
|
||||
* properly.
|
||||
*/
|
||||
|
||||
#define MMU_BOOT_REGION(addr, region_size, permission_flags) \
|
||||
static struct mmu_region region_##addr \
|
||||
#define __MMU_BOOT_REGION(id, addr, region_size, permission_flags) \
|
||||
static struct mmu_region region_##id \
|
||||
__attribute__((__section__(".mmulist"), used)) = \
|
||||
{ \
|
||||
.address = addr, \
|
||||
|
@ -140,6 +143,12 @@ struct mmu_region {
|
|||
.flags = permission_flags, \
|
||||
}
|
||||
|
||||
#define _MMU_BOOT_REGION(id, addr, region_size, permission_flags) \
|
||||
__MMU_BOOT_REGION(id, addr, region_size, permission_flags)
|
||||
|
||||
#define MMU_BOOT_REGION(addr, region_size, permission_flags) \
|
||||
_MMU_BOOT_REGION(__COUNTER__, addr, region_size, permission_flags)
|
||||
|
||||
/*
|
||||
* The following defines the format of a 32-bit page directory entry
|
||||
* that references a page table (as opposed to a 4 Mb page).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue