Quantcast
Channel: The Old New Thing
Browsing all 3085 articles
Browse latest View live

Is the Terminate­Thread function synchronous?

A customer wanted to know whether the Terminate­Thread function was synchronous. In other words, does the Terminate­Thread function wait until the target thread has definitely terminated before...

View Article


Image may be NSFW.
Clik here to view.

Dark Pattern: Opt-in above the fold, but opt-out below the fold

One of my colleagues reminded me of a Dark Pattern employed by the installer for the media player for that internet protocol that got the rug pulled out from under it. When you got to the shovelware...

View Article


Server names: One of the remaining places where IT managers can be a little...

Some time ago, ComputerWorld ran a story on whimsical names for servers. I recall that at my university, one academic department had machines named up and down. I'm sure this led to some strange Who's...

View Article

Creating an apartment-aware PPL task from nothing

In the Parallel Patterns Library (PPL) of the Concurrency Runtime, there are these things called tasks. Some tasks are apartment-aware, which means that the default continuation context will execute...

View Article

Creating an awaitable lock for C++ PPL tasks

The C# language (well, more accurately, the BCL) has the Reader­Writer­Lock­Slim class which has a Wait­Async method which returns a task that completes asynchronously when the lock has been acquired....

View Article


Creating an awaitable lock for WinJS and JavaScript Promises

Last time, we created an awaitable lock for C++ PPL tasks. Let's do the same thing for WinJS Promises (because I needed one of those too). var AwaitableLock = WinJS.Class.define(function...

View Article

A puzzle aboard the Anacortes-Sidney ferry: How do the cars get off?

For a ferry that goes from one point to another with no stops in between, cars are loaded onto the ferry from one end, and en route, the cars face the direction of travel. When the ferry reaches the...

View Article

The PowerPC 600 series, part 1: Introduction

The PowerPC is a RISC processor architecture which grew out of IBM's POWER architecture. Windows NT support was introduced in Windows NT 3.51, and it didn't last long; the last version to support it...

View Article


The PowerPC 600 series, part 2: Condition registers and the integer exception...

The integer exception register xer contains a bunch of stuff, but the ones that are relevant to us are Bit Name 0 Summary overflow 1 Overflow 2 Carry Some instructions update the overflow and summary...

View Article


The PowerPC 600 series, part 3: Arithmetic

Before we start with arithmetic, we need to have a talk about carry. The PowerPC uses true carry for both addition and subtraction. This is different from the x86 family of processors, for which the...

View Article

The PowerPC 600 series, part 4: Bitwise operations and constants

The PowerPC 600 series includes the following bitwise logical operations: and rd, ra, rb ; rd = ra & rb or rd, ra, rb ; rd = ra | rb xor rd, ra, rb ; rd = ra ^ rb nand rd, ra, rb ; rd = ~(ra &...

View Article

The PowerPC 600 series, part 5: Rotates and shifts

The Swiss army knife instruction of the PowerPC 600 series instruction set is rlwinm, which stands for "rotate left word immediate and mask." rlwinm rd, ra, imm5a, imm5b, imm5c rlwinm. rd, ra, imm5a,...

View Article

The PowerPC 600 series, part 6: Memory access

The PowerPC 600 series has two addressing modes. We will demonstrate them with the lwz instruction, which loads a word from memory. lwz rd, disp16(ra/0) ; load word from memory at ra/0 +...

View Article


The PowerPC 600 series, part 7: Atomic memory access and cache coherency

On the PowerPC 600 series, memory accesses to suitably-aligned locations by a single register are atomic,¹ meaning that even in the face of a conflicting operation on another processor, the result...

View Article

The PowerPC 600 series, part 8: Control transfer

The PowerPC 600 series has a few types of control transfer instructions. Let's look at direct branches first. b target ; branch to target bl target ; branch to target and link The direct branch...

View Article


The PowerPC 600 series, part 9: The table of contents

We saw that the PowerPC 600 series gives you absolute addressing to the top and bottom 32KB of address space. But that doesn't buy you much on Windows NT programs, because all of those addresses are...

View Article

The PowerPC 600 series, part 10: Passing parameters, function prologues and...

We saw a little bit of the Windows NT software convention with our introduction to the table of contents. Today we'll start looking at the conventions related to the stack. (Believe it or not, this...

View Article


The PowerPC 600 series, part 11: Glue routines

The PowerPC has a concept of a "glue routine". This is a little block of code to assist with control transfer, most of the time to allow a caller in one module to call a function in another module....

View Article

The PowerPC 600 series, part 12: leaf functions

On Windows NT for the PowerPC, there is a leaf function optimization available provided your function meets these criteria: It calls no other functions. It does not have an exception handler. It does...

View Article

The PowerPC 600 series, part 13: Common patterns

Now that we understand function calls and the table of contents, we can demonstrate some common calling sequences. If you are debugging through PowerPC code, you'll need to be able to recognize these...

View Article
Browsing all 3085 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>