Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Mar 2001 23:29:41 +0600 (NOVT)
From:      Alexey Dokuchaev <danfe@inet.ssc.nsu.ru>
To:        freebsd-hackers@freebsd.org
Subject:   Linux -> FreeBSD VM functions
Message-ID:  <Pine.LNX.4.10.10103212233240.22100-100000@inet.ssc.nsu.ru>
In-Reply-To: <Pine.LNX.4.10.10103190158060.7285-100000@inet.ssc.nsu.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello!

I seems to have a lot of VM-relevant code to port, and I'd like to get
answers for several questions arised along the way:

---

	* How do I port something like this:

<code ostype="linux">
	. . .

        static inline unsigned long 
        get_kvirt_address(unsigned long address)
        {
            pgd_t *pg_dir;
            pmd_t *pg_mid_dir;
            pte_t *pg_table;
            unsigned long ret_addr = 0;
            
            pg_dir = pgd_offset(current->mm, address);
            if (pgd_none(*pg_dir))
                goto done;

            pg_mid_dir = pmd_offset(pg_dir, address);
            if (pmd_none(*pg_mid_dir))
                goto done;

            pg_table = pte_offset(pg_mid_dir, address);
            if (!pte_present(*pg_table))
                goto done;

            ret_addr = pte_page(*pg_table);

          done:
            return ret_addr;
        }

	. . .
</code>

	Is simple PHYS_TO_VM_PAGE will do?

---

	* What about this one:

<code ostype="linux">
	. . .

if (PageReserved(mem_map + GET_MAP_NR(page))) { ... }

	. . .
</code>

	And this one:

<code ostype="linux">
	. . .

	mem_map_reserve(GET_MAP_NR(page));

	. . .
</code>

---

	* There seem to be these flags defined in linux/mm.h:

<code ostype="linux">

/* Page flag bit values */
#define PG_locked		 0
#define PG_error		 1
#define PG_referenced		 2
#define PG_dirty		 3
#define PG_uptodate		 4
#define PG_free_after		 5
#define PG_decr_after		 6
#define PG_swap_unlock_after	 7
#define PG_DMA			 8
#define PG_Slab			 9
#define PG_swap_cache		10
#define PG_skip			11
#define PG_reserved		31

</code>

	How do those relate to FreeBSD vision of things?

---

I will really appreciate any help with regard to this, since this is my
first serious in-depth look at VM internals of both linux and FreeBSD, and
there seem to be no technical (that is, not plain overviews) of both VM
subsystems.

--
	Regs,
	Alexey


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.10.10103212233240.22100-100000>