From: Chris L. <sa...@sk...> - 2000-07-04 01:04:29
|
Okay, here's a patch that should make it compile happier with SMP. It makes the following changes: 1. Define the __SMP__ macro [bad, shouldn't go in top level makefile] 2. Converting the cpu_number_map array to a macro so that sched.c will compile... 3. #include <linux/sched.h> from asm/smp.h so that dereferencing current works right... 4. Comment out #error in do_bh 5. #ifdef out some stuff in irq.c to fix undefined symbol refs: apic_timer_irqs and cpu_online_map. 6. Silence some undefined function name warnings 7. #ifndef CONFIG_SMP around EXPORT_SYMBOL(current_task); The "Makefile" change is not optimal (ie it would be better to change all the __SMP__s to CONFIG_SMP throughout the source) but this should work. In spite of making these changes I'm still getting this error: VFS: Mounted root (ext2 filesystem) readonly. Warning: unable to open an initial console. Seg fault in signals Which I'm having problems decifering. It looks like an illegal address for a task_struct in restore_state (process_kern.c). This may be fixed in one of your patches, although I applied both patches listed on your Dear Diary page (http://user-mode-linux.sourceforge.net/diary.html) and they didn't help... Besides those two patches, this is based on the 2.4.0test2 patch. Help! :) -Chris --- Makefile- Mon Jul 3 04:44:05 2000 +++ Makefile Mon Jul 3 04:30:57 2000 @@ -85,7 +85,7 @@ CPPFLAGS := -D__KERNEL__ -I$(HPATH) -CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer +CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -D__SMP__ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) # use '-fno-strict-aliasing', but only if the compiler can take it --- include/asm-um/smp.h- Mon Jul 3 04:35:41 2000 +++ include/asm-um/smp.h Mon Jul 3 04:48:46 2000 @@ -2,6 +2,7 @@ #define __UM_SMP_H #include "asm/current.h" +#include "linux/sched.h" /* Get the definition of task_struct */ #ifdef __SMP__ @@ -9,7 +10,8 @@ #define cpu_logical_map(n) (n) -extern int cpu_number_map[]; +#define cpu_number_map(x) (cpu_number_map_a[x]) +extern int cpu_number_map_a[]; #define PROC_CHANGE_PENALTY 15 /* Pick a number, any number */ --- arch/um/kernel/smp.c- Mon Jul 3 04:39:11 2000 +++ arch/um/kernel/smp.c Mon Jul 3 04:39:05 2000 @@ -26,7 +26,7 @@ struct cpuinfo_um cpu_data[NR_CPUS]; /* which CPU maps to which logical number */ -int cpu_number_map[NR_CPUS]; +int cpu_number_map_a[NR_CPUS]; spinlock_t um_bh_lock = SPIN_LOCK_UNLOCKED; --- arch/um/kernel/process_kern.c- Mon Jul 3 05:05:03 2000 +++ arch/um/kernel/process_kern.c Mon Jul 3 10:34:23 2000 @@ -228,7 +228,9 @@ if (softirq_state[0].active&softirq_state[0].mask) do_softirq(); #else -#error Need to update do_bh +/* + * #error Need to update do_bh + */ #endif } --- arch/um/kernel/irq.c- Mon Jul 3 05:00:37 2000 +++ arch/um/kernel/irq.c Mon Jul 3 05:00:19 2000 @@ -117,7 +117,7 @@ p += sprintf(p, "%10u ", atomic_read(&nmi_counter(cpu_logical_map(j)))); p += sprintf(p, "\n"); -#if CONFIG_SMP +#if CONFIG_SMP_x p += sprintf(p, "LOC: "); for (j = 0; j < smp_num_cpus; j++) p += sprintf(p, "%10u ", @@ -609,7 +609,7 @@ err = parse_hex_value(buffer, count, &new_value); -#if CONFIG_SMP +#if CONFIG_SMP_x /* * Do not allow disabling IRQs completely - it's a too easy * way to make the system unusable accidentally :-) At least --- arch/um/kernel/syscall_kern.c- Mon Jul 3 05:01:32 2000 +++ arch/um/kernel/syscall_kern.c Mon Jul 3 05:03:08 2000 @@ -18,6 +18,9 @@ #include "kern_util.h" #include "user_util.h" +long sys_mount(char * dev_name, char * dir_name, char * type, + unsigned long new_flags, void * data); + long um_mount(char * dev_name, char * dir_name, char * type, unsigned long new_flags, void * data) { @@ -186,6 +189,9 @@ fd_set *inp, *outp, *exp; struct timeval *tvp; }; + +asmlinkage long +sys_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp); int old_select(struct sel_arg_struct *arg) { --- arch/um/kernel/um_arch.c- Mon Jul 3 05:03:53 2000 +++ arch/um/kernel/um_arch.c Mon Jul 3 05:06:04 2000 @@ -147,8 +147,10 @@ physmem_size = memparse(argv[i] + strlen("mem="), &retptr); #ifdef __SMP__ - else if(!strncmp(argv[i], "ncpus=", strlen("ncpus="))) + else if(!strncmp(argv[i], "ncpus=", strlen("ncpus="))) { + extern int strtoul(const char*, void *, int); ncpus = strtoul(argv[i] + strlen("ncpus="), NULL, 10); + } #endif else if(!strncmp(argv[i], "debugtrace", strlen("debugtrace"))) debug_trace = 1; --- arch/um/kernel/init_task.c- Mon Jul 3 05:35:34 2000 +++ arch/um/kernel/init_task.c Mon Jul 3 05:35:45 2000 @@ -10,7 +10,9 @@ #include "asm/pgtable.h" #include "user_util.h" +#ifndef CONFIG_SMP EXPORT_SYMBOL(current_task); +#endif static struct vm_area_struct init_mmap = INIT_MMAP; static struct fs_struct init_fs = INIT_FS; |