drivers/video/fbdev/atafb_utils.h

Source file repositories/reference/linux-study-clean/drivers/video/fbdev/atafb_utils.h

File Facts

System
Linux kernel
Corpus path
drivers/video/fbdev/atafb_utils.h
Extension
.h
Size
11274 bytes
Lines
402
Domain
Driver Families
Bucket
drivers/video
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (count < 16) {
			asm volatile ("\n"
				"	lsr.l	#1,%2 ; jcc 1f ; move.b (%1)+,(%0)+\n"
				"1:	lsr.l	#1,%2 ; jcc 1f ; move.w (%1)+,(%0)+\n"
				"1:	lsr.l	#1,%2 ; jcc 1f ; move.l (%1)+,(%0)+\n"
				"1:	lsr.l	#1,%2 ; jcc 1f ; move.l (%1)+,(%0)+ ; move.l (%1)+,(%0)+\n"
				"1:"
				: "=a" (d), "=a" (s), "=d" (count)
				: "0" (d), "1" (s), "2" (count));
		} else {
			long tmp;
			asm volatile ("\n"
				"	move.l	%0,%3\n"
				"	lsr.l	#1,%3 ; jcc 1f ; move.b (%1)+,(%0)+ ; subqw #1,%2\n"
				"	lsr.l	#1,%3 ; jcs 2f\n"  /* %0 increased=>bit 2 switched*/
				"	move.w	(%1)+,(%0)+  ; subqw  #2,%2 ; jra 2f\n"
				"1:	lsr.l   #1,%3 ; jcc 2f\n"
				"	move.w	(%1)+,(%0)+  ; subqw  #2,%2\n"
				"2:	move.w	%2,%-; lsr.l #2,%2 ; jeq 6f\n"
				"	lsr.l	#1,%2 ; jcc 3f ; move.l (%1)+,(%0)+\n"
				"3:	lsr.l	#1,%2 ; jcc 4f ; move.l (%1)+,(%0)+ ; move.l (%1)+,(%0)+\n"
				"4:	subq.l	#1,%2 ; jcs 6f\n"
				"5:	move.l	(%1)+,(%0)+; move.l (%1)+,(%0)+\n"
				"	move.l	(%1)+,(%0)+; move.l (%1)+,(%0)+\n"
				"	dbra	%2,5b ; clr.w %2; subq.l #1,%2; jcc 5b\n"
				"6:	move.w	%+,%2; btst #1,%2 ; jeq 7f ; move.w (%1)+,(%0)+\n"
				"7:	btst	#0,%2 ; jeq 8f ; move.b (%1)+,(%0)+\n"
				"8:"
				: "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
				: "0" (d), "1" (s), "2" (count));
		}
	} else {
		if (count < 16) {
			asm volatile ("\n"
				"	lsr.l	#1,%2 ; jcc 1f ; move.b -(%1),-(%0)\n"
				"1:	lsr.l	#1,%2 ; jcc 1f ; move.w -(%1),-(%0)\n"
				"1:	lsr.l	#1,%2 ; jcc 1f ; move.l -(%1),-(%0)\n"
				"1:	lsr.l	#1,%2 ; jcc 1f ; move.l -(%1),-(%0) ; move.l -(%1),-(%0)\n"
				"1:"
				: "=a" (d), "=a" (s), "=d" (count)
				: "0" ((char *) d + count), "1" ((char *) s + count), "2" (count));
		} else {
			long tmp;

			asm volatile ("\n"
				"	move.l	%0,%3\n"
				"	lsr.l	#1,%3 ; jcc 1f ; move.b -(%1),-(%0) ; subqw #1,%2\n"
				"	lsr.l	#1,%3 ; jcs 2f\n"  /* %0 increased=>bit 2 switched*/
				"	move.w	-(%1),-(%0) ; subqw  #2,%2 ; jra 2f\n"
				"1:	lsr.l	#1,%3 ; jcc 2f\n"
				"	move.w	-(%1),-(%0) ; subqw  #2,%2\n"
				"2:	move.w	%2,%-; lsr.l #2,%2 ; jeq 6f\n"
				"	lsr.l	#1,%2 ; jcc 3f ; move.l -(%1),-(%0)\n"
				"3:	lsr.l	#1,%2 ; jcc 4f ; move.l -(%1),-(%0) ; move.l -(%1),-(%0)\n"
				"4:	subq.l	#1,%2 ; jcs 6f\n"
				"5:	move.l	-(%1),-(%0); move.l -(%1),-(%0)\n"
				"	move.l	-(%1),-(%0); move.l -(%1),-(%0)\n"
				"	dbra	%2,5b ; clr.w %2; subq.l #1,%2; jcc 5b\n"
				"6:	move.w	%+,%2; btst #1,%2 ; jeq 7f ; move.w -(%1),-(%0)\n"
				"7:	btst	#0,%2 ; jeq 8f ; move.b -(%1),-(%0)\n"
				"8:"
				: "=a" (d), "=a" (s), "=d" (count), "=d" (tmp)
				: "0" ((char *) d + count), "1" ((char *) s + count), "2" (count));
		}
	}

	return 0;
}


/* ++andreas: Simple and fast version of memmove, assumes size is
   divisible by 16, suitable for moving the whole screen bitplane */
static inline void fast_memmove(char *dst, const char *src, size_t size)
{
	if (!size)
		return;
	if (dst < src)
		asm volatile ("\n"
			"1:	movem.l	(%0)+,%%d0/%%d1/%%a0/%%a1\n"
			"	movem.l	%%d0/%%d1/%%a0/%%a1,%1@\n"
			"	addq.l	#8,%1; addq.l #8,%1\n"
			"	dbra	%2,1b\n"
			"	clr.w	%2; subq.l #1,%2\n"
			"	jcc	1b"
			: "=a" (src), "=a" (dst), "=d" (size)
			: "0" (src), "1" (dst), "2" (size / 16 - 1)
			: "d0", "d1", "a0", "a1", "memory");
	else
		asm volatile ("\n"
			"1:	subq.l	#8,%0; subq.l #8,%0\n"

Annotation

Implementation Notes