<commit_before>/**
 * @file
 * @brief Virtual memory subsystem
 *
 * @date 05.10.2012
 * @author <NAME>
 */

#include <embox/unit.h>

#include <assert.h>
#include <errno.h>
#include <stdint.h>

#include <hal/mmu.h>
#include <mem/vmem.h>
#include <mem/vmem/vmem_alloc.h>
#include <kernel/sched/sched_lock.h>

#include "../kernel/task/common.h"
#include <stdint.h>
#include <kernel/printk.h>

/* Section pointers. */
extern char _text_vma, _rodata_vma, _bss_vma, _data_vma;
extern char _text_len, _rodata_len, _bss_len, _data_len;

static inline int vmem_map_kernel(mmu_ctx_t ctx) {
	int err = 0;

	/* Map sections. */
	err |= vmem_map_on_itself(ctx, &_text_vma, (size_t) &_text_len,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, &_rodata_vma, (size_t) &_rodata_len,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, &_bss_vma, (size_t) &_bss_len_with_reserve,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, &_data_vma, (size_t) &_data_len,
			VMEM_PAGE_WRITABLE);

	/* Map special info. */
	err |= vmem_map_on_itself(ctx, VIRTUAL_TABLES_START, VIRTUAL_TABLES_LEN,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, VIRTUAL_PAGES_INFO_START, VIRTUAL_PAGES_INFO_LEN,
			VMEM_PAGE_WRITABLE);

	// XXX below
	// for sparc
	err |= vmem_map_on_itself(ctx, (void *) 0x80000000, (size_t) 0x1000,
			VMEM_PAGE_WRITABLE);

	// for microblaze
	err |= vmem_map_on_itself(ctx, (void *) 0x84000000, (size_t) 0x1000,
			VMEM_PAGE_WRITABLE);

	// mapping x86 video buffer
	err |= vmem_map_on_itself(ctx, (void *) 0xB8000, (size_t) 0x1000,
			VMEM_PAGE_WRITABLE);
<commit_msg>vmem - fix declrations<commit_after>/**
 * @file
 * @brief Virtual memory subsystem
 *
 * @date 05.10.2012
 * @author <NAME>
 */

#include <embox/unit.h>

#include <assert.h>
#include <errno.h>
#include <stdint.h>

#include <hal/mmu.h>
#include <mem/vmem.h>
#include <mem/vmem/vmem_alloc.h>
#include <kernel/sched/sched_lock.h>

#include "../kernel/task/common.h"
#include <stdint.h>
#include <kernel/printk.h>

/* Section pointers. */
extern char _text_vma, _rodata_vma, _data_vma, _bss_vma;
extern char _text_len, _rodata_len, _data_len, _bss_len_with_reserve;

static inline int vmem_map_kernel(mmu_ctx_t ctx) {
	int err = 0;

	/* Map sections. */
	err |= vmem_map_on_itself(ctx, &_text_vma, (size_t) &_text_len,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, &_rodata_vma, (size_t) &_rodata_len,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, &_data_vma, (size_t) &_data_len,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, &_bss_vma, (size_t) &_bss_len_with_reserve,
			VMEM_PAGE_WRITABLE);

	/* Map special info. */
	err |= vmem_map_on_itself(ctx, VIRTUAL_TABLES_START, VIRTUAL_TABLES_LEN,
			VMEM_PAGE_WRITABLE);
	err |= vmem_map_on_itself(ctx, VIRTUAL_PAGES_INFO_START, VIRTUAL_PAGES_INFO_LEN,
			VMEM_PAGE_WRITABLE);

	// XXX below
	// for sparc
	err |= vmem_map_on_itself(ctx, (void *) 0x80000000, (size_t) 0x1000,
			VMEM_PAGE_WRITABLE);

	// for microblaze
	err |= vmem_map_on_itself(ctx, (void *) 0x84000000, (size_t) 0x1000,
			VMEM_PAGE_WRITABLE);

	// mapping x86 video buffer
	err |= vmem_map_on_itself(ctx, (void *) 0xB8000, (size_t) 0x1000,
			VMEM_PAGE_WRITABLE);

{'fraction_non_alphanumeric': 0.13602251407129456, 'fraction_numerical': 0.030644152595372107, 'mean_word_length': 5.1166347992351815, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3263918', 'n_tokens_mistral': 1546, 'n_tokens_neox': 1426, 'n_words': 250}