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

The SuperH-3, part 9: Constants

Loading constants on the SH-3 is a bit of a pain. We saw that the MOV instruction supports an 8-bit signed immediate, but what if you need to load something outside that range? The assembler allows you...

View Article


Why is there a huge spike in cruise ship width at 32 meters?

I found a web page that listed the sizes of a large number of cruise ships. Plot out¹ the widths:...

View Article


The SuperH-3, part 10: Control transfer

Yes, we have once again reached the point where we have to talk about branch delay slots. I will defer to the background information I provided when the issue arose in the discussion of the MIPS R4000....

View Article

The SuperH-3, part 11: Atomic operations

The SH-3 has a very limited number of read-modify-write operations. To recap: AND.B #imm, @(r0, GBR) ; @(r0 + gbr) &= 8-bit immediate OR.B #imm, @(r0, GBR) ; @(r0 + gbr) |= 8-bit immediate XOR.B...

View Article

The SuperH-3, part 12: Calling convention and function prologues/epilogues

The calling convention used by Windows CE for the SH-3 processor looks very much like the calling convention for other RISC architectures on Windows. The short version is that the first four parameters...

View Article


The SuperH-3, part 13: Misaligned data, and converting between signed vs...

When going through compiler-generated assembly language, there are some patterns you’ll see over and over again. Note that the code you see may not look exactly like this due to compiler instruction...

View Article

The SuperH-3, part 14: Patterns for function calls

Function calls on the SH-3 are rather cumbersome. The BSR instruction has a reach of only 4KB, which makes it impractical for compiler-generated code because the compiler doesn’t know where the linker...

View Article

The SuperH-3, part 15: Code walkthough

Once again, we wrap up our processor retrospective series by walking through a simple function from the C runtime library. extern FILE _iob[]; int fclose(FILE *stream) { int result = EOF; if...

View Article


Custom-printing your own attendee pass to the Windows 95 launch

I attended a good-bye event for one of the classic Microsoft Redmond campus buildings, and I learned from one of the attendees of the farewell event that he and a few others crashed the Windows 95...

View Article


One byte used to cost a dollar

Back in the days when software was distributed on floppy disks (remember floppy disks?), the rule of thumb for Windows was one byte costs a dollar. In other words, considering the cost of materials,...

View Article

The sad history of Visual Studio’s custom __if_exists keyword

The Visual Studio C++ compiler has this weird nonstandard keyword called __if_exists. (And its twin __if_not_exists.) Why does this keyword exist, and how should I use it? Let’s get this out of the...

View Article

On resolving the type vs member conflict in C++, revisited

Some time ago, I wrote about the type vs. member conflict, known informally as The Color Color problem. I may have started in the deep end of the pool, so here’s a little bit of getting-up-to-speed so...

View Article

What to do if you can’t get the stovetop in your London apartment to turn on

During our family summer vacation, we found ourselves unable to get the stovetop in our London apartment to work. The oven worked, but not the stovetop (known as a “hob” in England). The property...

View Article


The sad history of Unicode printf-style format specifiers in Visual C++

Windows adopted Unicode before most other operating systems.[citation needed] As a result, Windows’s solutions to many problems differ from solutions adopted by those who waited for the dust to...

View Article

If FlushInstructionCache doesn’t do anything, why do you have to call it,...

You are supposed to call the Flush­Instruction­Cache function when you generate or modify code at runtime, so that when the CPU tries to execute the newly-generated or newly-modified modified code, it...

View Article


Stupid Alexa trick: Speaking French with a horrible American accent

Here’s a stupid Alexa trick. Use the Alexa app to set the language to something other than English, say, French. Ask Alexa a question. It will respond in French. Use the Alexa app to set the language...

View Article

Any sufficiently advanced technology is indistinguishable from a bomb

One of my relatives is an electrical engineer, and he was part of a small team sent to a customer site to run diagnostics and do other things that electrical engineers do. The team traveled with...

View Article


The COM_INTERFACE_ENTRY must be a COM interface, but nobody actually checks

A customer had some code written with the Active Template Library, more commonly known as ATL. Apparently, ATL is still a thing! Anyway, their problem was that their component that had been working...

View Article

Making the COM_INTERFACE_ENTRY macro better at detecting misuse

Last time, we studied a crash involving improper use of the COM_INTERFACE_ENTRY macro. Can we make it better at detecting misuse at compile time? We want to make sure that IWidget­Provider­Info...

View Article

It rather involved being on the other side of this airtight hatchway:...

A security vulnerability report arrived that said that if you passed a carefully-malformed value to the Call­Window­Proc function, then it would call an unexpected function. Recall that when you call...

View Article
Browsing all 3085 articles
Browse latest View live


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