Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

x264 0.118 DOS port (Announce)

posted by Rugxulo Homepage, Usono, 18.10.2011, 19:25

> Unfortunately when I tested compiled x264 to compress sample video it
> crashes immediatelly:
>
> C:\X264>X264.EXE -o out.flv example.y4m
> y4m [info]: 384x288p 0:0 @ 25/1 fps (cfr)
> x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle
> SSE4.2
> x264 [info]: profile High, level 2.1
> Exiting due to signal SIGSEGV
> General Protection Fault at eip=000d9e10
>


SIGSEGV isn't the same as SIGILL, so perhaps your cpu indeed supports SSE 4.2 (which isn't implemented that frequently on most average cpus). That would've been my first naive guess, but I can't say for sure.

> (running under XP NTVDM)
> maybe it's issue with sse or something else messed up...
>
> I remember that here was some talking about SSE and crashing under DOS but
> I don't remember the result, any idea?

You have to flip a bit in CR4 so that the OS can (ideally) know to save SSE state across task switches (FXSAVE, FXRSTOR). Otherwise it fails by default so that you won't depend on it being saved (when it's not). Obviously they expected all OSes these days to multitask, so it wasn't important to consider DOS, so DOS (despite being safe) couldn't use SSE until flipping that bit (while under ring 0 only).

Honestly, I would've almost rather had HIMEMX or JEMM386 or even KERNEL.SYS flip it for us, but they never did. Instead we've got HDPMI32 and CWSDPMI (r5 2008 or r7 2010) to do it. Then it works.

(And dare I say, SSE isn't exactly commonly used in DOS, and most compilers don't support generation for it. Even the ones that do are weak.)

> I had to disable HAVE_MMX in config.h that also turned off dynamic
> CPU detection and it's working now. It works regardless C opt.
> flags. There are also some ASM files compiled by YASM...

Yeah, hand-written assembly will almost always beat any (average) compiler at SIMD. Strange that HAVE_MMX disables dynamic detection of SSE as they are entirely different. It doesn't waste much time to check once via CPUID at startup, but admittedly, most people these days only use new-ish cpus, so they don't care (as Pentium4 and AMD64 both include SSE2, and those are both very common).

P.S. I don't think anybody ever bothered trying to support PAQ8 with SSE4's dot product instructions, though I always personally wondered if it would've helped or not (somewhat cynically doubt it, but who knows). I'm too dumb to figure it out myself, or at least I think so, so I haven't tried. I do actually have access to a SSE4 cpu these days, but I dunno, I'm too luddite / cynical to care almost, it's just frustrating to have ten bazillion technologies that are all arcane, fairly redundant, soon to be obsoleted, etc. (Intel is already working on AVX2. Ugh. Stop the madness!)

 

Complete thread:

Back to the forum
Board view  Mix view
22778 Postings in 2122 Threads, 402 registered users (0 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum