Rev 934 | Rev 1132 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 934 | Rev 972 | ||
---|---|---|---|
Line 25... | Line 25... | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <arch/mm/frame.h> |
29 | #include <arch/mm/frame.h> |
- | 30 | #include <arch/boot/memmap.h> |
|
30 | #include <arch/mm/memory_init.h> |
31 | #include <arch/mm/memory_init.h> |
31 | #include <mm/frame.h> |
32 | #include <mm/frame.h> |
- | 33 | #include <align.h> |
|
- | 34 | #include <macros.h> |
|
- | 35 | ||
- | 36 | __address last_frame = 0; |
|
32 | 37 | ||
33 | void frame_arch_init(void) |
38 | void frame_arch_init(void) |
34 | { |
39 | { |
- | 40 | pfn_t minconf = 2; |
|
- | 41 | count_t i; |
|
- | 42 | pfn_t start, conf; |
|
- | 43 | size_t size; |
|
- | 44 | ||
- | 45 | for (i = 0; i < memmap.count; i++) { |
|
- | 46 | start = ADDR2PFN(ALIGN_UP(memmap.zones[i].start, FRAME_SIZE)); |
|
- | 47 | size = SIZE2FRAMES(ALIGN_DOWN(memmap.zones[i].size, FRAME_SIZE)); |
|
- | 48 | ||
- | 49 | if ((minconf < start) || (minconf >= start + size)) |
|
- | 50 | conf = start; |
|
- | 51 | else |
|
- | 52 | conf = minconf; |
|
- | 53 | ||
- | 54 | zone_create(start, size, conf, 0); |
|
- | 55 | if (last_frame < ALIGN_UP(memmap.zones[i].start + memmap.zones[i].size, FRAME_SIZE)) |
|
- | 56 | last_frame = ALIGN_UP(memmap.zones[i].start + memmap.zones[i].size, FRAME_SIZE); |
|
- | 57 | } |
|
- | 58 | ||
35 | /* First is exception vector, second is 'implementation specific' */ |
59 | /* First is exception vector, second is 'implementation specific' */ |
36 | frame_mark_unavailable(0, 2); |
60 | frame_mark_unavailable(0, 2); |
- | 61 | ||
- | 62 | /* Merge all zones to 1 big zone */ |
|
- | 63 | zone_merge_all(); |
|
37 | } |
64 | } |