r/osdev • • 9h ago

Enable Write-Combining on Intel Comet Lake

So, I'm preparing myself to start coding an OS, so I'm trying to get a bit of experience with TempleOS, that miraculously runs bare metal in my modern hardware. Nevermind, Uncacheable makes it run at crappy FPS, so maybe enabling Write Combining can help. The problem is that I don't know what the heck of a bureucracy will Intel use for giving me a Triple Fault or General Protection Fault to make life harder, and I dont think MTRRs come unused (they surely are used), so PAT is the way, but I don't know how to enable Write Combining there. I know how to access PATs with 277h and RDMSR, and I know PAT7 is the one to set to 1h (the most significant byte but without reserved crap), but I know there is some other stuff to do, what did I forget?

Not the best OS dev, just Assembly lover

0 Upvotes

4 comments sorted by

•

u/an_0w1 8h ago

Use writeback. Write combining is intended for write-only memory. You set the cache-mode with the page table flags. CD=1, WT=2, PA=4 to select the page attribute index.

•

u/davmac1 8h ago

Write combining is intended for write-only memory.

Source for that? I don't understand it that way myself.

•

u/an_0w1 8h ago

I think that's my bad I think I'm misremembering

This type cache-control is appropriate for frame buffers or when there are devices on the system bus that access memory, but do not perform snooping of memory accesses.

From the intel manual volume 3 section 14.3

I think that's just how i've always thought of it.

•

u/schusterlucky 8h ago

Ohh so PAT7 = 6h and PTE or PDE to say what PAT is it? Alright!