The function from above really doesn't have anything to do with paging at all.
I would advise you against following any tutorials, because that is one of the most crucial parts of an operating system.
Intel manuals are a good way to start:
https://software.intel.com/sites/defaul ... -3abcd.pdf, take a look at Chapter 4 called Paging, it has everything you will need. It might take a few (x10) reads.
Paging is something very specific and requires a good understanding of the mechanism itself, before you can code anything.
You primary goals should be:
1.Figure out how it works (in details) in your head.
2.Figure out what a page directory, page directory entry, page table and page itself is. I would suggest you using bit-fields, leave clunky arrays of integers and bit-shifts alone.
3.Figure out how to translate an address aka how to map it. Physical -> Virtual
4.Enable paging by setting PG bit in CR0.
5.Tell us how badly does it triple fault, remember: paging structures don't like unaligned addresses. It has to fail at least once, it is perfectly normal to experience some issues at the very beginning.
This was just a really really short overview. You still have a lot of decision to make: higher half, PAE or not, PSE or not (you are not ready for this yet, not a good idea)...
Feel free to ask anything you want. Currently I don't have any more time but if you want I can explain you in detail how I did it and what paths did I take.