Runtime Code Patching – Not for the Faint of Heart

I have been involved in several conversations recently that have revolved around the joys of runtime code patching. I am always shocked to hear people say that they are ok with this idea of code patching at runtime. Moreover – it shocks me that they think it is easy to get right! I do think…


Getting the Crashing Stack From a Bugcheck

Sorry for the long delay on posting – I have been slammed lately. I decided to write a post about debugging and take a short break from the bare metal stuff we have been discussing as of late. 🙂 When a bugcheck occurs in Windows, the following basic sequence of events occurs: 1. An exception (“exception”…


It Goes to Eleven and … to the NT Insider!

Well – for anyone bored enough to track such things, I have been pretty slammed lately and haven’t blogged anything. I have a bunch of stuff queued up though. Upcoming posts (in the next few days hopefully) are: 1. The Anatomy of a Context Switch 2. The Anatomy of an Interrupt 3. The Anatomy of…


Why Your User Mode Pointer Captures Are Probably Broken

There is a problem that I suspect is pretty widespread in the majority of driver code. The problem is the improper capturing of user mode pointers. I decided to write a blog about it and try to get a feel for if I am right or not. J  I figure that if people comment with…


How Does KeMemoryBarrier Work?

KeMemoryBarrier is a kernel DDK support macro. There is also a WIN32 macro called MemoryBarrier that is implemented identically (there is an observance test hidden here!) – so we will just talk about KeMemoryBarrier here, but everything we say about it also applies to MemoryBarrier. If you read the doc for KeMemoryBarrier, it says this: “The KeMemoryBarrier routine creates a…


The Joys of Compiler and Processor Reordering: Why You Technically Need Read-Side Barriers

In a previous post on compiler and processor reordering, I said that for multi-threaded, lock-free code to be totally correct – you need a barrier on the read sides of the code – but that it was pretty complicated and wasn’t required on any processors that Windows currently runs on. I also said that if there were equally…


The Joys of Compiler and Processor Reordering

So I thought that a good first technical blog entry would be one about a common – but “hardly thought about by most programmers” problem called “reordering”. It is a subtle problem but very important to understand if you write lock-less multithreaded code or write code that directly reads and writes mapped hardware registers.  …


It Goes to Eleven

I am brand new to the world of blogs so I apologize in advance to any one that reads this blog. Please let me know if I am doing something rude or ignorant. 🙂 “Allow myself to .. introduce … myself …” My name is Jonathan Morrison and I work on the Kernel OCA/Reliability team at Microsoft. I spend…


Hello World!

Well – you have to do it don’t you?