Tiger -- Boot loader failure: bootx_startup returned (should not happen)

Per Christian Henden perchrh+mol at pvv.org
Fri Nov 25 17:05:58 MST 2005


Hi, 

I'm trying to run Mac OS X Tiger using mol on my linux pcc computer. 
I've downloaded mol-rsync, and added the patches to make it compile on 2.6.14,  
to work with tiger and to support large files. 
Find the diff between my tree and the rsync tree attached. 
This compiles well (with support for tap and sheep net disabled) with 2.6.14 
and gcc-3.3

When I run startmol -X after installing and configuring mol, this happens

-----

Mac-on-Linux 0.9.71-pre1 [Nov 26 2005 00:48]
Copyright (C) 1997-2004 Samuel Rydh
Starting MOL session 1
Loading Mac-on-Linux kernel module:
   /usr/local/lib/mol/0.9.71/modules/2.6.14/mol.ko
Running in PowerPC 7400 mode, 128 MB RAM
Timebase: 41.62 MHz, Bus: 166.48 MHz, Clock: 1416 MHz
Using USB mouse on /dev/input/mice
OHCI USB controller registered
Could not open '/var/local/mol/x11.kbd'
Video driver(s): [xvideo]

     640* 480, depth 8,32   { 0.0 } Hz
     800* 600, depth 8,32   { 0.0 } Hz
    1024* 768, depth 8,32   { 0.0 } Hz
    1152* 864, depth 8,32   { 0.0 } Hz
    1280*1024, depth 8,32   { 0.0 } Hz
    1600*1200, depth 8,32   { 0.0 } Hz

---> DHCP server not installed
Ethernet Interface 'tun-<tun1>' @ 00:00:0D:EA:DB:EE

    ip/mask: 192.168.41.2/255.255.255.0  gw: 192.168.41.1
    broadcast: 192.168.41.255  nameserver: 192.168.41.1


    CD    /dev/cdrom       CD/DVD         <read-only>   ------
    Unembedded HFS+ /dev/hda3                       <rw> 19073 MB

SCSI devices:

    [SCSI auto-probing disabled]

    SCSI  /dev/cdrom       [CDROM/DVD driver]


>> ==================================================
>> MacOS X Boot Loader 0.9.70
>> Candidate boot volume: /mol-blk at 0/disk at 0:0
>> /mol-blk at 0/disk at 0:0,\mach_kernel (4330232 bytes)
>> /mol-blk at 0/disk at 0:0,\System\Library\Extensions.mkext
>> ==================================================

>> --> Boot loader failure: bootx_startup returned (should not happen)

cleaning up...
---> DHCP server not installed
Terminating threads...
DONE

-----

I have the same behavior when I use the modified version of the bootloader 
(bootx) that uses more memory.

Is anyone using Linux 2.6.14 and the newest Tiger successfully with Mol at 
the moment? If so, how did you make it work?

Cheers, 

Per Christian Henden
-------------- next part --------------
diff -urNBb mol-rsync/src/kmod/include/misc.h.orig mol-rsync.tiger/src/kmod/include/misc.h.orig
--- mol-rsync/src/kmod/include/misc.h.orig	1970-01-01 01:00:00.000000000 +0100
+++ mol-rsync.tiger/src/kmod/include/misc.h.orig	2005-11-26 00:02:25.000000000 +0100
@@ -0,0 +1,87 @@
+/* 
+ *   Creation Date: <97/06/16 18:02:12 samuel>
+ *   Time-stamp: <2004/03/13 14:03:30 samuel>
+ *   
+ *	<misc.h>
+ *	
+ *	
+ *   
+ *   Copyright (C) 1997-2004 Samuel Rydh (samuel at ibrium.se)
+ *   
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation
+ *   
+ */
+
+#ifndef _H_MOD
+#define _H_MOD
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+   #define compat_verify_area(a,b,c)       ( ! access_ok(a,b,c) )
+#else
+   #define compat_verify_area(a,b,c)       verify_area(a,b,c)
+#endif
+
+
+
+
+extern int 	g_num_sessions;			/* number of active sessions */
+
+struct kernel_vars;
+
+/* init.c */
+extern int	common_init( void );
+extern void	common_cleanup( void );
+extern int	initialize_session( unsigned int sess_index );
+extern void	destroy_session( unsigned int sess_index );
+extern uint	get_session_magic( uint random_magic );
+
+/* arch specific functions */
+extern int	arch_common_init( void );
+extern void	arch_common_cleanup( void );
+extern struct kernel_vars *alloc_kvar_pages( void );
+extern void	free_kvar_pages( struct kernel_vars *kv );
+extern void	prevent_mod_unload( void );
+
+/* misc.c */
+struct dbg_op_params;
+struct perf_ctr;
+extern int	do_debugger_op( kernel_vars_t *kv, struct dbg_op_params *pb );
+extern int	handle_ioctl( kernel_vars_t *kv, int what, int arg1, int arg2, int arg3 );
+
+/* actions.c */
+extern int	perform_actions( void );
+extern void	cleanup_actions( void );
+
+/* bit table manipulation */
+static inline void
+set_bit_mol( int nr, char *addr )
+{
+	ulong mask = 1 << (nr & 0x1f);
+	ulong *p = ((ulong*)addr) + (nr >> 5);
+	*p |= mask;
+}
+
+static inline void 
+clear_bit_mol( int nr, char *addr )
+{
+	ulong mask = 1 << (nr & 0x1f);
+	ulong *p = ((ulong*)addr) + (nr >> 5);
+	*p &= ~mask;
+}
+
+/* typesafe min/max (stolen from kernel.h) */
+#define min_mol(x,y) ({ \
+        const typeof(x) _x = (x);       \
+        const typeof(y) _y = (y);       \
+        (void) (&_x == &_y);            \
+        _x < _y ? _x : _y; })
+
+#define max_mol(x,y) ({ \
+        const typeof(x) _x = (x);       \
+        const typeof(y) _y = (y);       \
+        (void) (&_x == &_y);            \
+        _x > _y ? _x : _y; })
+
+#endif
diff -urNBb mol-rsync/src/kmod/Linux/alloc.h mol-rsync.tiger/src/kmod/Linux/alloc.h
--- mol-rsync/src/kmod/Linux/alloc.h	2004-07-24 18:44:02.000000000 +0200
+++ mol-rsync.tiger/src/kmod/Linux/alloc.h	2005-11-26 00:02:25.000000000 +0100
@@ -21,6 +21,7 @@
 #include <linux/vmalloc.h>
 #include <linux/mm.h>
 #include <asm/uaccess.h>
+#include <asm/io.h>
 
 #ifdef LINUX_26
 #include <asm/cacheflush.h>
diff -urNBb mol-rsync/src/kmod/Linux/dev.c mol-rsync.tiger/src/kmod/Linux/dev.c
--- mol-rsync/src/kmod/Linux/dev.c	2004-07-24 18:44:02.000000000 +0200
+++ mol-rsync.tiger/src/kmod/Linux/dev.c	2005-11-26 00:02:25.000000000 +0100
@@ -151,7 +151,7 @@
 
 	switch( cmd ) {
 	case MOL_IOCTL_GET_DIRTY_FBLINES:  /* short *retbuf, int size -- npairs */
-		if( verify_area(VERIFY_WRITE, (short*)p1, p2) )
+		if( compat_verify_area(VERIFY_WRITE, (short*)p1, p2) )
 			break;
 		ret = get_dirty_fb_lines( kv, (short*)p1, p2 );
 		break;
@@ -169,7 +169,7 @@
 		break;
 
 	case MOL_IOCTL_SET_RAM: /* void ( char *lvbase, size_t size ) */
-		if( verify_area(VERIFY_WRITE, (char*)p1, p2) )
+		if( compat_verify_area(VERIFY_WRITE, (char*)p1, p2) )
 			break;
 		ret = 0;
 		kv->mmu.userspace_ram_base = p1;
diff -urNBb mol-rsync/src/kmod/ptaccess.c mol-rsync.tiger/src/kmod/ptaccess.c
--- mol-rsync/src/kmod/ptaccess.c	2004-07-24 18:44:02.000000000 +0200
+++ mol-rsync.tiger/src/kmod/ptaccess.c	2005-11-26 00:02:25.000000000 +0100
@@ -22,6 +22,7 @@
 #include "performance.h"
 
 extern int do_intercept_tlbie( kernel_vars_t *kv, ulong pte0, ulong pte1, ulong pteoffs );
+extern int do_intercept_tlbie_block( kernel_vars_t *kv, ulong pteoffs, ulong length );
 
 #define	MMU	(kv->mmu)
 #define	MREGS	(kv->mregs)
@@ -49,6 +50,37 @@
 	return RVEC_NOP;
 }
 
+int
+do_intercept_tlbie_block( kernel_vars_t *kv, ulong pteoffs, ulong length )
+{
+	unsigned int finish;
+
+	//printk("do_intercept_tlbie_block: pteoffs %08lX length %08lX\n", pteoffs, length);
+
+	if (pteoffs + length > MMU.hash_mask) {
+		printk("do_intercept_tlbie_block: length exceeding hash!\n");
+		finish = MMU.hash_mask + 1;
+	} else
+		finish = pteoffs + length;
+
+	if (MMU.pthash_inuse_bits == NULL)
+		return RVEC_NOP;
+
+	while (pteoffs < finish) {
+		if (check_bit_mol(pteoffs >> 3, MMU.pthash_inuse_bits)) {
+			ulong pte0, pte1;
+
+			pte0 = *((unsigned int *) (MMU.hash_base + pteoffs));
+			pte1 = *((unsigned int *) (MMU.hash_base + pteoffs + 4));
+			do_intercept_tlbie(kv, pte0, pte1, pteoffs);
+		} 
+
+		pteoffs += 8;
+	}
+
+	return RVEC_NOP;
+}
+
 #ifdef EMULATE_603
 
 extern int do_tlbli( kernel_vars_t *kv, ulong ea );
diff -urNBb mol-rsync/src/kmod/ptintercept.S mol-rsync.tiger/src/kmod/ptintercept.S
--- mol-rsync/src/kmod/ptintercept.S	2004-07-24 18:44:02.000000000 +0200
+++ mol-rsync.tiger/src/kmod/ptintercept.S	2005-11-26 00:02:25.000000000 +0100
@@ -157,7 +157,6 @@
 do_stfiw:
 do_stswi:
 do_stswx:
-do_stmw:
 	lwz	r6,xNIP(r1)
 	DEBUGGER_SAVE(0x1882)			// unimplemented store instruction
 
@@ -258,3 +257,47 @@
 	// r4=PTE0, r5=PTE1
 	LOADI	r3,EXTERN(do_intercept_tlbie)
 	b	call_kernel
+
+	// stmw uses another emulator entry point because it might overwrite a bunch of PTEs
+do_stmw:
+	mtlr	r4
+
+	// save some debugging info
+//	stw	r2,xDBG_TRACE_SPACE(r1)
+
+	SET_MSR_DR /**/ r6
+
+	// now do the stmw. we do that manually since we have to access emulator regs.
+	mr	r4,r2				// r4: memory pointer
+	srwi	r6,r5,3				// r6: rS
+1:	cmpwi	r5,32 << 3			// loop condition
+	bge	2f
+	EMU_LOAD_GPR r5, /**/ R3		// r0 = value
+	stw	r0,0(r4)			// store the value
+	addi	r5,r5,1 << 3			// update register counter
+	addi	r4,r4,4				// and memory pointer
+	b	1b
+
+2:	CLEAR_MSR_DR /**/ r0
+
+	// load up r4 and r5 for do_intercept_tlbie_block (see below)
+	subfic	r5,r6,32			// number of registers (=words) stored
+	slwi	r5,r5,2				// number of bytes stored
+	add	r4,r2,r5			// last byte stored
+	addi	r4,r4,7				// alignment to
+	rlwinm  r5,r4,0,~0x7			// PTE size
+	rlwinm	r4,r2,0,~0x7			// pte block pointer
+	sub	r5,r5,r4			// substract block pointer -> length (in bytes)
+	lwz	r3,K_TLBHASH_BASE_EA(r1)	// calculate tlb offset
+	sub	r4,r4,r3			// tlb offset
+	b	st_block_continue
+
+	// transfer to C-function [r2=dar, r4=pte block offset, r5=pte block length]
+st_block_continue:
+	BUMP("pt_intercept_taken")
+	lwz	r6,xNIP(r1)
+	addi	r6,r6,4				// inc NIP
+	bl	save_middle_regs
+
+	LOADI 	r3,EXTERN(do_intercept_tlbie_block)
+	b	call_kernel
diff -urNBb mol-rsync/src/lib/llseek.c mol-rsync.tiger/src/lib/llseek.c
--- mol-rsync/src/lib/llseek.c	2004-07-24 18:44:02.000000000 +0200
+++ mol-rsync.tiger/src/lib/llseek.c	2005-11-26 00:02:25.000000000 +0100
@@ -25,6 +25,9 @@
 #define BLKGETSIZE _IO(0x12,96)		/* from <linux/fs.h> */
 #endif
 
+#define _FILE_OFFSET_BITS 64
+#define _LARGE_FILES 
+
 ulong
 get_file_size_in_blks( int fd )
 {
diff -urNBb mol-rsync/src/netdriver/tun.c mol-rsync.tiger/src/netdriver/tun.c
--- mol-rsync/src/netdriver/tun.c	2004-07-24 18:44:01.000000000 +0200
+++ mol-rsync.tiger/src/netdriver/tun.c	2005-11-26 00:02:25.000000000 +0100
@@ -240,7 +240,7 @@
 	DBG(KERN_INFO "%s: tun_chr_write %d\n", tun->name, count);
 
 	for (i = 0, len = 0; i < count; i++) {
-		if (verify_area(VERIFY_READ, iv[i].iov_base, iv[i].iov_len))
+		if (compat_verify_area(VERIFY_READ, iv[i].iov_base, iv[i].iov_len))
 			return -EFAULT;
 		len += iv[i].iov_len;
 	}
@@ -304,7 +304,7 @@
 	DBG(KERN_INFO "%s: tun_chr_read\n", tun->name);
 
 	for (i = 0, len = 0; i < count; i++) {
-		if (verify_area(VERIFY_WRITE, iv[i].iov_base, iv[i].iov_len))
+		if (compat_verify_area(VERIFY_WRITE, iv[i].iov_base, iv[i].iov_len))
 			return -EFAULT;
 		len += iv[i].iov_len;
 	}


More information about the mol-general mailing list