iansjack wrote:
I can see a couple of potential problems with your use of bitfields (apart from the obvious one that you have allocated 65 bits in page_t).
1. Possible packing problems. As your structs are not packed it's possible that each bitfield is occupying 64 bits.
2. The order in which the compiler allocates bits for bitfields is not specified in the C standard. It varies between processor and compiler.
Either of these may not matter in your case, or one or both may apply - I don't know which compiler you are using. The easiest way to check is to look at the tables actually produced by your code. It should be fairly obvious if there is a problem. As for bitfields, I'd avoid them and use masks instead.
65? I went over that thing like 50 times and didn't notice it...
All of the issues are now fixed but nothing has changed.
I am actually writing this in C++ not C, don't know about the way C++ orders bitfields, but they worked for me in the past as far as paging goes.
I use GCC cross-compiler to compile my code.
I am looking at the tables and I don't see anything interesting.
Anyways, here is the rest of my code:
https://pastebin.com/BRX2va4E I hope somebody can notice something awfully wrong.
Edit: ignore line 47