From 61bb1c6cdea1486157fb83b27de443e19bf934b4 Mon Sep 17 00:00:00 2001 From: YOSHIFUJI Hideaki Date: Tue, 4 Oct 2005 13:00:39 -0700 Subject: [PATCH] --- yaml --- r: 9637 b: refs/heads/master c: 87bf9c97b4b3af8dec7b2b79cdfe7bfc0a0a03b2 h: refs/heads/master i: 9635: edeb69d6a5dc9cbb4c043bd0adfe0ac1d8b9468d v: v3 --- [refs] | 2 +- trunk/arch/um/include/registers.h | 12 ++++- trunk/arch/um/include/sysdep-x86_64/ptrace.h | 4 ++ trunk/arch/um/kernel/sysrq.c | 8 +++- trunk/arch/um/os-Linux/sys-i386/registers.c | 19 ++++---- trunk/arch/um/os-Linux/sys-x86_64/registers.c | 19 ++++---- trunk/arch/um/sys-i386/sysrq.c | 13 +++++- trunk/arch/um/sys-i386/user-offsets.c | 2 +- trunk/drivers/net/tokenring/ibmtr.c | 5 +++ trunk/drivers/scsi/megaraid/megaraid_sas.c | 1 - trunk/fs/bfs/dir.c | 2 +- trunk/fs/bfs/inode.c | 44 ++++++------------- trunk/include/asm-um/processor-generic.h | 23 +++++----- trunk/include/asm-um/processor-i386.h | 15 +++++-- trunk/include/asm-um/processor-x86_64.h | 14 ++++-- trunk/include/linux/bfs_fs.h | 42 +++++++++--------- trunk/net/ipv6/udp.c | 4 +- 17 files changed, 134 insertions(+), 95 deletions(-) diff --git a/[refs] b/[refs] index 3bfcd727a176..26e896f6e0fa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fad1c45c939bb246a488be1fa06f539e85b80545 +refs/heads/master: 87bf9c97b4b3af8dec7b2b79cdfe7bfc0a0a03b2 diff --git a/trunk/arch/um/include/registers.h b/trunk/arch/um/include/registers.h index 4892e5fcef07..0a35e6d0baa0 100644 --- a/trunk/arch/um/include/registers.h +++ b/trunk/arch/um/include/registers.h @@ -15,6 +15,16 @@ extern void save_registers(int pid, union uml_pt_regs *regs); extern void restore_registers(int pid, union uml_pt_regs *regs); extern void init_registers(int pid); extern void get_safe_registers(unsigned long * regs); -extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer); #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/include/sysdep-x86_64/ptrace.h b/trunk/arch/um/include/sysdep-x86_64/ptrace.h index 8f0656766c21..331aa2d1f3f5 100644 --- a/trunk/arch/um/include/sysdep-x86_64/ptrace.h +++ b/trunk/arch/um/include/sysdep-x86_64/ptrace.h @@ -218,6 +218,10 @@ struct syscall_args { case RBP: UPT_RBP(regs) = __upt_val; break; \ case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \ case CS: UPT_CS(regs) = __upt_val; break; \ + case DS: UPT_DS(regs) = __upt_val; break; \ + case ES: UPT_ES(regs) = __upt_val; break; \ + case FS: UPT_FS(regs) = __upt_val; break; \ + case GS: UPT_GS(regs) = __upt_val; break; \ case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \ default : \ panic("Bad register in UPT_SET : %d\n", reg); \ diff --git a/trunk/arch/um/kernel/sysrq.c b/trunk/arch/um/kernel/sysrq.c index b331e970002f..f80850091e79 100644 --- a/trunk/arch/um/kernel/sysrq.c +++ b/trunk/arch/um/kernel/sysrq.c @@ -62,7 +62,13 @@ void show_stack(struct task_struct *task, unsigned long *esp) if (esp == NULL) { if (task != current && task != NULL) { + /* XXX: Isn't this bogus? I.e. isn't this the + * *userspace* stack of this task? If not so, use this + * even when task == current (as in i386). + */ esp = (unsigned long *) KSTK_ESP(task); + /* Which one? No actual difference - just coding style.*/ + //esp = (unsigned long *) PT_REGS_IP(&task->thread.regs); } else { esp = (unsigned long *) &esp; } @@ -78,5 +84,5 @@ void show_stack(struct task_struct *task, unsigned long *esp) } printk("Call Trace: \n"); - show_trace(task, esp); + show_trace(current, esp); } diff --git a/trunk/arch/um/os-Linux/sys-i386/registers.c b/trunk/arch/um/os-Linux/sys-i386/registers.c index aee4812333c6..3125d320722c 100644 --- a/trunk/arch/um/os-Linux/sys-i386/registers.c +++ b/trunk/arch/um/os-Linux/sys-i386/registers.c @@ -5,7 +5,6 @@ #include #include -#include #include "sysdep/ptrace_user.h" #include "sysdep/ptrace.h" #include "uml-config.h" @@ -127,11 +126,13 @@ void get_safe_registers(unsigned long *regs) memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); } -void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) -{ - struct __jmp_buf_tag *jmpbuf = buffer; - - UPT_SET(uml_regs, EIP, jmpbuf->__jmpbuf[JB_PC]); - UPT_SET(uml_regs, UESP, jmpbuf->__jmpbuf[JB_SP]); - UPT_SET(uml_regs, EBP, jmpbuf->__jmpbuf[JB_BP]); -} +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/os-Linux/sys-x86_64/registers.c b/trunk/arch/um/os-Linux/sys-x86_64/registers.c index 4b638dfb52b0..44438d15c3d6 100644 --- a/trunk/arch/um/os-Linux/sys-x86_64/registers.c +++ b/trunk/arch/um/os-Linux/sys-x86_64/registers.c @@ -5,7 +5,6 @@ #include #include -#include #include "ptrace_user.h" #include "uml-config.h" #include "skas_ptregs.h" @@ -75,11 +74,13 @@ void get_safe_registers(unsigned long *regs) memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long)); } -void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer) -{ - struct __jmp_buf_tag *jmpbuf = buffer; - - UPT_SET(uml_regs, RIP, jmpbuf->__jmpbuf[JB_PC]); - UPT_SET(uml_regs, RSP, jmpbuf->__jmpbuf[JB_RSP]); - UPT_SET(uml_regs, RBP, jmpbuf->__jmpbuf[JB_RBP]); -} +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/arch/um/sys-i386/sysrq.c b/trunk/arch/um/sys-i386/sysrq.c index d5244f070539..e3706d15c4f5 100644 --- a/trunk/arch/um/sys-i386/sysrq.c +++ b/trunk/arch/um/sys-i386/sysrq.c @@ -88,7 +88,9 @@ void show_trace(struct task_struct* task, unsigned long * stack) task = current; if (task != current) { - ebp = (unsigned long) KSTK_EBP(task); + //ebp = (unsigned long) KSTK_EBP(task); + /* Which one? No actual difference - just coding style.*/ + ebp = (unsigned long) PT_REGS_EBP(&task->thread.regs); } else { asm ("movl %%ebp, %0" : "=r" (ebp) : ); } @@ -97,6 +99,15 @@ void show_trace(struct task_struct* task, unsigned long * stack) ((unsigned long)stack & (~(THREAD_SIZE - 1))); print_context_stack(context, stack, ebp); + /*while (((long) stack & (THREAD_SIZE-1)) != 0) { + addr = *stack; + if (__kernel_text_address(addr)) { + printk("%08lx: [<%08lx>]", (unsigned long) stack, addr); + print_symbol(" %s", addr); + printk("\n"); + } + stack++; + }*/ printk("\n"); } diff --git a/trunk/arch/um/sys-i386/user-offsets.c b/trunk/arch/um/sys-i386/user-offsets.c index 26b68675053d..677fc26a9bbe 100644 --- a/trunk/arch/um/sys-i386/user-offsets.c +++ b/trunk/arch/um/sys-i386/user-offsets.c @@ -46,7 +46,7 @@ void foo(void) OFFSET(HOST_SC_FP_ST, _fpstate, _st); OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env); - DEFINE(HOST_FRAME_SIZE, FRAME_SIZE); + DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE); DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_i387_struct)); DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fxsr_struct)); diff --git a/trunk/drivers/net/tokenring/ibmtr.c b/trunk/drivers/net/tokenring/ibmtr.c index 32057e65808b..e7b001017b9a 100644 --- a/trunk/drivers/net/tokenring/ibmtr.c +++ b/trunk/drivers/net/tokenring/ibmtr.c @@ -531,6 +531,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) if (!time_after(jiffies, timeout)) continue; DPRINTK( "Hardware timeout during initialization.\n"); iounmap(t_mmio); + kfree(ti); return -ENODEV; } ti->sram_phys = @@ -644,6 +645,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) DPRINTK("Unknown shared ram paging info %01X\n", ti->shared_ram_paging); iounmap(t_mmio); + kfree(ti); return -ENODEV; break; } /*end switch shared_ram_paging */ @@ -673,6 +675,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) "driver limit (%05x), adapter not started.\n", chk_base, ibmtr_mem_base + IBMTR_SHARED_RAM_SIZE); iounmap(t_mmio); + kfree(ti); return -ENODEV; } else { /* seems cool, record what we have figured out */ ti->sram_base = new_base >> 12; @@ -687,6 +690,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) DPRINTK("Could not grab irq %d. Halting Token Ring driver.\n", irq); iounmap(t_mmio); + kfree(ti); return -ENODEV; } /*?? Now, allocate some of the PIO PORTs for this driver.. */ @@ -695,6 +699,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr) DPRINTK("Could not grab PIO range. Halting driver.\n"); free_irq(dev->irq, dev); iounmap(t_mmio); + kfree(ti); return -EBUSY; } diff --git a/trunk/drivers/scsi/megaraid/megaraid_sas.c b/trunk/drivers/scsi/megaraid/megaraid_sas.c index c3f637395734..1b3148e842af 100644 --- a/trunk/drivers/scsi/megaraid/megaraid_sas.c +++ b/trunk/drivers/scsi/megaraid/megaraid_sas.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include diff --git a/trunk/fs/bfs/dir.c b/trunk/fs/bfs/dir.c index 5af928fa0449..e240c335eb23 100644 --- a/trunk/fs/bfs/dir.c +++ b/trunk/fs/bfs/dir.c @@ -108,7 +108,7 @@ static int bfs_create(struct inode * dir, struct dentry * dentry, int mode, inode->i_mapping->a_ops = &bfs_aops; inode->i_mode = mode; inode->i_ino = ino; - BFS_I(inode)->i_dsk_ino = ino; + BFS_I(inode)->i_dsk_ino = cpu_to_le16(ino); BFS_I(inode)->i_sblock = 0; BFS_I(inode)->i_eblock = 0; insert_inode_hash(inode); diff --git a/trunk/fs/bfs/inode.c b/trunk/fs/bfs/inode.c index 3af6c73c5b5a..c7b39aa279d7 100644 --- a/trunk/fs/bfs/inode.c +++ b/trunk/fs/bfs/inode.c @@ -357,46 +357,28 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) } info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1)>>BFS_BSIZE_BITS; /* for statfs(2) */ - info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - le32_to_cpu(bfs_sb->s_start))>>BFS_BSIZE_BITS; + info->si_freeb = (le32_to_cpu(bfs_sb->s_end) + 1 - cpu_to_le32(bfs_sb->s_start))>>BFS_BSIZE_BITS; info->si_freei = 0; info->si_lf_eblk = 0; info->si_lf_sblk = 0; info->si_lf_ioff = 0; - bh = NULL; for (i=BFS_ROOT_INO; i<=info->si_lasti; i++) { - struct bfs_inode *di; - int block = (i - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1; - int off = (i - BFS_ROOT_INO) % BFS_INODES_PER_BLOCK; - unsigned long sblock, eblock; - - if (!off) { - brelse(bh); - bh = sb_bread(s, block); - } - - if (!bh) - continue; - - di = (struct bfs_inode *)bh->b_data + off; - - if (!di->i_ino) { + inode = iget(s,i); + if (BFS_I(inode)->i_dsk_ino == 0) info->si_freei++; - continue; - } - set_bit(i, info->si_imap); - info->si_freeb -= BFS_FILEBLOCKS(di); - - sblock = le32_to_cpu(di->i_sblock); - eblock = le32_to_cpu(di->i_eblock); - if (eblock > info->si_lf_eblk) { - info->si_lf_eblk = eblock; - info->si_lf_sblk = sblock; - info->si_lf_ioff = BFS_INO2OFF(i); + else { + set_bit(i, info->si_imap); + info->si_freeb -= inode->i_blocks; + if (BFS_I(inode)->i_eblock > info->si_lf_eblk) { + info->si_lf_eblk = BFS_I(inode)->i_eblock; + info->si_lf_sblk = BFS_I(inode)->i_sblock; + info->si_lf_ioff = BFS_INO2OFF(i); + } } + iput(inode); } - brelse(bh); if (!(s->s_flags & MS_RDONLY)) { - mark_buffer_dirty(info->si_sbh); + mark_buffer_dirty(bh); s->s_dirt = 1; } dump_imap("read_super", s); diff --git a/trunk/include/asm-um/processor-generic.h b/trunk/include/asm-um/processor-generic.h index 075771c371f6..2d242360c3d6 100644 --- a/trunk/include/asm-um/processor-generic.h +++ b/trunk/include/asm-um/processor-generic.h @@ -13,7 +13,6 @@ struct task_struct; #include "linux/config.h" #include "asm/ptrace.h" #include "choose-mode.h" -#include "registers.h" struct mm_struct; @@ -137,15 +136,19 @@ extern struct cpuinfo_um cpu_data[]; #define current_cpu_data boot_cpu_data #endif - -#ifdef CONFIG_MODE_SKAS -#define KSTK_REG(tsk, reg) \ - ({ union uml_pt_regs regs; \ - get_thread_regs(®s, tsk->thread.mode.skas.switch_buf); \ - UPT_REG(®s, reg); }) -#else -#define KSTK_REG(tsk, reg) (0xbadbabe) -#endif +#define KSTK_EIP(tsk) (PT_REGS_IP(&tsk->thread.regs)) +#define KSTK_ESP(tsk) (PT_REGS_SP(&tsk->thread.regs)) #define get_wchan(p) (0) #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/include/asm-um/processor-i386.h b/trunk/include/asm-um/processor-i386.h index 4108a579eb92..431bad3ae9d7 100644 --- a/trunk/include/asm-um/processor-i386.h +++ b/trunk/include/asm-um/processor-i386.h @@ -43,10 +43,17 @@ static inline void rep_nop(void) #define ARCH_IS_STACKGROW(address) \ (address + 32 >= UPT_SP(¤t->thread.regs.regs)) -#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP) -#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP) -#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP) - #include "asm/processor-generic.h" #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/include/asm-um/processor-x86_64.h b/trunk/include/asm-um/processor-x86_64.h index e1e1255a1d36..0beb9a42ae05 100644 --- a/trunk/include/asm-um/processor-x86_64.h +++ b/trunk/include/asm-um/processor-x86_64.h @@ -36,9 +36,17 @@ extern inline void rep_nop(void) #define ARCH_IS_STACKGROW(address) \ (address + 128 >= UPT_SP(¤t->thread.regs.regs)) -#define KSTK_EIP(tsk) KSTK_REG(tsk, RIP) -#define KSTK_ESP(tsk) KSTK_REG(tsk, RSP) - #include "asm/processor-generic.h" #endif + +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * Emacs will notice this stuff at the end of the file and automatically + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ diff --git a/trunk/include/linux/bfs_fs.h b/trunk/include/linux/bfs_fs.h index 8ed6dfdcd783..c1237aa92e38 100644 --- a/trunk/include/linux/bfs_fs.h +++ b/trunk/include/linux/bfs_fs.h @@ -20,19 +20,19 @@ /* BFS inode layout on disk */ struct bfs_inode { - __le16 i_ino; + __u16 i_ino; __u16 i_unused; - __le32 i_sblock; - __le32 i_eblock; - __le32 i_eoffset; - __le32 i_vtype; - __le32 i_mode; - __le32 i_uid; - __le32 i_gid; - __le32 i_nlink; - __le32 i_atime; - __le32 i_mtime; - __le32 i_ctime; + __u32 i_sblock; + __u32 i_eblock; + __u32 i_eoffset; + __u32 i_vtype; + __u32 i_mode; + __s32 i_uid; + __s32 i_gid; + __u32 i_nlink; + __u32 i_atime; + __u32 i_mtime; + __u32 i_ctime; __u32 i_padding[4]; }; @@ -41,17 +41,17 @@ struct bfs_inode { #define BFS_DIRS_PER_BLOCK 32 struct bfs_dirent { - __le16 ino; + __u16 ino; char name[BFS_NAMELEN]; }; /* BFS superblock layout on disk */ struct bfs_super_block { - __le32 s_magic; - __le32 s_start; - __le32 s_end; - __le32 s_from; - __le32 s_to; + __u32 s_magic; + __u32 s_start; + __u32 s_end; + __s32 s_from; + __s32 s_to; __s32 s_bfrom; __s32 s_bto; char s_fsname[6]; @@ -66,15 +66,15 @@ struct bfs_super_block { #define BFS_INO2OFF(ino) \ ((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE) #define BFS_NZFILESIZE(ip) \ - ((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE) + ((cpu_to_le32((ip)->i_eoffset) + 1) - cpu_to_le32((ip)->i_sblock) * BFS_BSIZE) #define BFS_FILESIZE(ip) \ ((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip)) #define BFS_FILEBLOCKS(ip) \ - ((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock)) + ((ip)->i_sblock == 0 ? 0 : (cpu_to_le32((ip)->i_eblock) + 1) - cpu_to_le32((ip)->i_sblock)) #define BFS_UNCLEAN(bfs_sb, sb) \ - ((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) + ((cpu_to_le32(bfs_sb->s_from) != -1) && (cpu_to_le32(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY)) #endif /* _LINUX_BFS_FS_H */ diff --git a/trunk/net/ipv6/udp.c b/trunk/net/ipv6/udp.c index e4cad11f284a..bf9519341fd3 100644 --- a/trunk/net/ipv6/udp.c +++ b/trunk/net/ipv6/udp.c @@ -99,7 +99,7 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) next:; } result = best; - for(;; result += UDP_HTABLE_SIZE) { + for(i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++, result += UDP_HTABLE_SIZE) { if (result > sysctl_local_port_range[1]) result = sysctl_local_port_range[0] + ((result - sysctl_local_port_range[0]) & @@ -107,6 +107,8 @@ static int udp_v6_get_port(struct sock *sk, unsigned short snum) if (!udp_lport_inuse(result)) break; } + if (i >= (1 << 16) / UDP_HTABLE_SIZE) + goto fail; gotit: udp_port_rover = snum = result; } else {