Resent-Date: Mon, 11 Jan 1999 11:46:26 +0100 (MET)
To: linux-m68k@lists.linux-m68k.org
Subject: Penguin logo / kernel_thread
X-Yow: WHY are we missing KOJAK?
From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Date: 11 Jan 1999 11:46:16 +0100
Resent-From: linux-m68k@phil.uni-sb.de

Two more things for 2.2.0-pre4:

- Put the Penguin logo at the right place on afb/ilbm/iplan* frame
  buffers.
- Make kernel_thread a real function, this makes it possible to return
  from the thread even if called from an __init function (2.2.0-pre5 does
  this).

Andreas.

--- arch/m68k/kernel/m68k_ksyms.c.~2~	Thu Jan  7 02:21:59 1999
+++ arch/m68k/kernel/m68k_ksyms.c	Sun Jan 10 11:41:30 1999
@@ -50,6 +50,7 @@
 EXPORT_SYMBOL(enable_irq);
 EXPORT_SYMBOL(disable_irq);
 EXPORT_SYMBOL(kernel_set_cachemode);
+EXPORT_SYMBOL(kernel_thread);
 
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy);
--- arch/m68k/kernel/process.c.~2~	Wed Dec 23 18:02:36 1998
+++ arch/m68k/kernel/process.c	Sun Jan 10 11:24:31 1999
@@ -107,6 +107,44 @@
 		printk("USP: %08lx\n", rdusp());
 }
 
+/*
+ * Create a kernel thread
+ */
+int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
+{
+	int pid;
+	mm_segment_t fs;
+
+	fs = get_fs();
+	set_fs (KERNEL_DS);
+
+	{
+	register long retval __asm__ ("d0");
+	register long clone_arg __asm__ ("d1") = flags | CLONE_VM;
+
+	__asm__ __volatile__
+	  ("clrl %%d2\n\t"
+	   "trap #0\n\t"		/* Linux/m68k system call */
+	   "tstl %0\n\t"		/* child or parent */
+	   "jne 1f\n\t"			/* parent - jump */
+	   "lea %%sp@(-8192),%6\n\t"	/* reload current */
+	   "movel %3,%%sp@-\n\t"	/* push argument */
+	   "jsr %4@\n\t"		/* call fn */
+	   "movel %0,%%d1\n\t"		/* pass exit value */
+	   "movel %2,%0\n\t"		/* exit */
+	   "trap #0\n"
+	   "1:"
+	   : "=d" (retval)
+	   : "0" (__NR_clone), "i" (__NR_exit),
+	     "r" (arg), "a" (fn), "d" (clone_arg), "r" (current)
+	   : "d0", "d2");
+	pid = retval;
+	}
+
+	set_fs (fs);
+	return pid;
+}
+
 void flush_thread(void)
 {
 	unsigned long zero = 0;
--- drivers/video/fbcon.c.~2~	Sun Jan  3 10:32:54 1999
+++ drivers/video/fbcon.c	Sun Jan 10 12:36:00 1999
@@ -969,7 +969,9 @@
 	     * displayed on the right side, this allows scrollback feature
 	     * when bootlogo is displayed. */
             if (t != 0 && logo_shown == fg_console) {
+#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
 		struct display *p = &fb_display[unit];
+#endif
 		int lw = (smp_num_cpus * (LOGO_W + 8) - 7) / fontwidth(p) + 1;
 		logos_left = conp->vc_cols - lw;
 		while (logos_left < 0) logos_left += (LOGO_W + 8 - 7) / fontwidth(p);
@@ -1431,7 +1433,10 @@
     int w = op->width;
     int h = op->height;
     int size = h;
-    int i, j, k;
+    int i, k;
+#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
+    int j;
+#endif
     u8 *new_data, *data = op->data, *p;
 
 #ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
@@ -1848,7 +1853,7 @@
 	    int line_length = p->line_length;
 
 	    /* for support of Atari interleaved planes */
-#define MAP_X(x)	(line_length ? x : (x & ~1)*depth + (x & 1))
+#define MAP_X(x)	(line_length ? (x) : ((x) & ~1)*depth + ((x) & 1))
 #else
 #define MAP_X(x)	(x)
 #endif
@@ -1859,7 +1864,7 @@
 	    src = logo;
 	    for( y1 = 0; y1 < LOGO_H; y1++ ) {
 		for( x1 = 0; x1 < LOGO_LINE; x1++, src += logo_depth ) {
-		    dst = fb + y1*line + MAP_X(x1);
+		    dst = fb + y1*line + MAP_X(x/8+x1);
 		    for( bit = 0; bit < logo_depth; bit++ ) {
 			val = 0;
 			for( mask = 0x80, i = 0; i < 8; mask >>= 1, i++ ) {
@@ -1878,7 +1883,7 @@
 	    if (depth > logo_depth) {
 		for( y1 = 0; y1 < LOGO_H; y1++ ) {
 		    for( x1 = 0; x1 < LOGO_LINE; x1++ ) {
-			dst = fb + y1*line + MAP_X(x1) + logo_depth*plane;
+			dst = fb + y1*line + MAP_X(x/8+x1) + logo_depth*plane;
 			for( i = logo_depth; i < depth; i++, dst += plane )
 			    *dst = (i == logo_depth && logo_depth == 4)
 				   ? 0xff : 0x00;
--- include/asm-m68k/processor.h.~1~	Fri May 15 17:39:49 1998
+++ include/asm-m68k/processor.h	Sun Jan 10 11:25:40 1999
@@ -72,6 +72,8 @@
 {
 }
 
+extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
+
 #define copy_segments(nr, tsk, mm)	do { } while (0)
 #define release_segments(mm)		do { } while (0)
 
--- include/asm-m68k/unistd.h.~1~	Fri Oct  9 19:59:50 1998
+++ include/asm-m68k/unistd.h	Sun Jan 10 11:21:37 1999
@@ -323,49 +323,6 @@
 static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
 static inline _syscall1(int,delete_module,const char *,name)
 
-/*
- * This is the mechanism for creating a new kernel thread.
- *
- * NOTE! Only a kernel-only process(ie the swapper or direct descendants
- * who haven't done an "execve()") should use this: it will work within
- * a system call from a "real" process, but the process memory space will
- * not be free'd until both the parent and the child have exited.
- */
-static inline pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
-{
-	pid_t pid;
-	mm_segment_t fs;
-
-	fs = get_fs();
-	set_fs (KERNEL_DS);
-
-	{
-	register long retval __asm__ ("d0");
-	register long clone_arg __asm__ ("d1") = flags | CLONE_VM;
-
-	__asm__ __volatile__
-	  ("clrl %%d2\n\t"
-	   "trap #0\n\t"		/* Linux/m68k system call */
-	   "tstl %0\n\t"		/* child or parent */
-	   "jne 1f\n\t"			/* parent - jump */
-	   "lea %%sp@(-8192),%6\n\t"	/* reload current */
-	   "movel %3,%%sp@-\n\t"	/* push argument */
-	   "jsr %4@\n\t"		/* call fn */
-	   "movel %0,%%d1\n\t"		/* pass exit value */
-	   "movel %2,%0\n\t"		/* exit */
-	   "trap #0\n"
-	   "1:"
-	   : "=d" (retval)
-	   : "0" (__NR_clone), "i" (__NR_exit),
-	     "r" (arg), "a" (fn), "d" (clone_arg), "r" (current)
-	   : "d0", "d2");
-	pid = retval;
-	}
-
-	set_fs (fs);
-	return pid;
-}
-
 static inline pid_t wait(int * wait_stat)
 {
 	return waitpid(-1,wait_stat,0);

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org

