Add include/arch/properties.h files
Will include architecture-specific properties about the kernel. Currently they mainly hold macros for calculating where the kernel starts and ends in physical and virtual memory.
This commit is contained in:
parent
806d00f471
commit
e69440c698
36
arch/arm/include/arch/properties.h
Normal file
36
arch/arm/include/arch/properties.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
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 */
|
32
arch/i386/include/arch/properties.h
Normal file
32
arch/i386/include/arch/properties.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
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_phys, kernel_end_phys;
|
||||||
|
extern uint32 kernel_start, kernel_end;
|
||||||
|
|
||||||
|
#define kernel_start_physical() &kernel_start_phys
|
||||||
|
#define kernel_end_physical() &kernel_end_phys
|
||||||
|
#define kernel_start_virtual() &kernel_start
|
||||||
|
#define kernel_end_virtual() &kernel_end
|
||||||
|
|
||||||
|
#endif /* PROPERTIES_H */
|
Loading…
Reference in New Issue
Block a user