1
0
Fork 0
aedrix-kernel/arch/arm/include/arch/properties.h

37 lines
1.6 KiB
C

/*
Copyright (C) 2012, Aaron Lindsay <aaron@aclindsay.com>
This file is part of Aedrix.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PROPERTIES_H
#define PROPERTIES_H
extern uint32 kernel_start, kernel_end;
extern uint32 tt_base_virtual, tt_base_physical;
#define _kernel_virt_phys_offset ((tt_base_virtual - tt_base_physical)>>2)
/* Note: this result is shifted left by one because 1<<31 = 2^32/2, and we want to calculate how much space we need for enough translation table entries to map the entire 32-bit range, not just half of it */
#define _init_page_table_size (((uint32)(1<<31)/CONFIG_INIT_PAGE_SIZE)<<1)
#define kernel_start_physical() (kernel_start_virtual() - _kernel_virt_phys_offset)
#define kernel_end_physical() (((uint32 *)tt_base_physical) + _init_page_table_size)
#define kernel_start_virtual() &kernel_start
#define kernel_end_virtual() (((uint32 *)tt_base_virtual) + _init_page_table_size)
#endif /* PROPERTIES_H */