You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
(82) |
Jun
(72) |
Jul
(39) |
Aug
(104) |
Sep
(61) |
Oct
(55) |
Nov
(101) |
Dec
(48) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(52) |
Feb
(67) |
Mar
(18) |
Apr
(16) |
May
(33) |
Jun
(12) |
Jul
(102) |
Aug
(168) |
Sep
(65) |
Oct
(60) |
Nov
(43) |
Dec
(121) |
2002 |
Jan
(69) |
Feb
(32) |
Mar
(90) |
Apr
(59) |
May
(45) |
Jun
(43) |
Jul
(33) |
Aug
(21) |
Sep
(11) |
Oct
(20) |
Nov
(26) |
Dec
(3) |
2003 |
Jan
(12) |
Feb
(18) |
Mar
(11) |
Apr
(11) |
May
(41) |
Jun
(76) |
Jul
(77) |
Aug
(15) |
Sep
(38) |
Oct
(56) |
Nov
(19) |
Dec
(39) |
2004 |
Jan
(17) |
Feb
(52) |
Mar
(36) |
Apr
(34) |
May
(48) |
Jun
(85) |
Jul
(38) |
Aug
(42) |
Sep
(41) |
Oct
(77) |
Nov
(27) |
Dec
(19) |
2005 |
Jan
(32) |
Feb
(35) |
Mar
(29) |
Apr
(8) |
May
(7) |
Jun
(31) |
Jul
(46) |
Aug
(93) |
Sep
(65) |
Oct
(85) |
Nov
(219) |
Dec
(47) |
2006 |
Jan
(170) |
Feb
(103) |
Mar
(49) |
Apr
(43) |
May
(45) |
Jun
(29) |
Jul
(77) |
Aug
(82) |
Sep
(43) |
Oct
(45) |
Nov
(26) |
Dec
(85) |
2007 |
Jan
(42) |
Feb
(48) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(53) |
Jul
(175) |
Aug
(212) |
Sep
(91) |
Oct
(103) |
Nov
(110) |
Dec
(5) |
2008 |
Jan
(20) |
Feb
(11) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(5) |
Sep
(3) |
Oct
(12) |
Nov
|
Dec
|
From: NIIBE Y. <gn...@m1...> - 2002-01-05 05:37:37
|
I'll add the tag linux-2_5_0 for the current repository. Then, install the changes of mainline 2.5.0 to 2.5.1, and remove the file AGAINST-2.5.0 and add AGAINST-2.5.1. Also, rotate the ChangeLog files. -- |
From: Adrian M. <ad...@mc...> - 2002-01-05 00:55:53
|
A new, much improved, pre-release version of the open sound system (OSS) compatible AICA sounddriver for Linux on the Dreamcast is available for testing. This version implements a new buffering mechanism that has meant continuous playing of PCM and MP3 samples. The driver needs to be tested in very high demand environments (eg MPEG video) as there is potential for synchronisation problems - I haven't ported any such applications, but I know others have and could test this. Anyway: The files are at: http://www.mcmen.demon.co.uk/linuxdc/aica You need aica.c and arm7.h to build the drivers However, as this is an OSS driver you will also need a minimal OSS system on your DC. The files and a smaple makefile are also available at the above address to build this. Simply download, alter to fit your set up and install with insmod soundcore.o and insmod aica.o Please feel free to post any questions to me or (preferably) the linuxdc-dev (and others if you feel it appropriate - but don't spam people) list. Happy New Year to all, Adrian |
From: NIIBE Y. <gn...@m1...> - 2002-01-04 05:20:21
|
Jeremy Siegel wrote: > One of our folks pointed me at Hitachi's website > (www.hitachi-ul.co.jp/SH-SE/LNX/download.html) which includes patches > against 2.4.2 and 2.4.13 kernels for support of the 7727 and 7751 Solution > Engine boards. Anybody know if those are expected to be merged into the > community tree? Is it just a matter of someone being willing to do the > check-in, or is there some specific reason they're not there? (The site > is mostly japanese except for file names, so I can't really interpret > it...) I don't know the specific reason. I just know that Takeshi Yoshii at Hitachi ULSI Co, Ltd, married last year and has been quite busy. We will have some sort of workshop, here in Tsukuba, Japan this month. He and Nozawa will come, so I expect merging around that time. -- |
From: Adrian M. <ad...@mc...> - 2002-01-01 12:05:10
|
On Friday 28 Dec 2001 2:54 am, NIIBE Yutaka wrote: > Adrian McMenamin wrote: > > costab[k] = 1.0 / (2.0 * cos( 3.14159265358979323846 * ((double) k * 2.0 > > + 1.0) / (double) divv)); > > [...] > > > So: the questions are - is this a known problem, has it been fixed in > > later kernels or have I just got it wrong? > > I don't know if this is related, we have a FPU bug wrt floating point > to double conversion. For example, compiling runtime of Java, GCC > fails because of exception. > > I have experimental fix for this issue, I'll send this to linuxsh-dev > soon. Just to close this. I rebuilt my tools and upgraded to gcc 3.0.3 and now the programme compiles and runs fine. Not sure what the problem was exactly - could have been a badly patched compiler, could have been a corrupted library - but it works now. Adrian |
From: Jeremy S. <js...@mv...> - 2002-01-01 01:19:51
|
One of our folks pointed me at Hitachi's website (www.hitachi-ul.co.jp/SH-SE/LNX/download.html) which includes patches against 2.4.2 and 2.4.13 kernels for support of the 7727 and 7751 Solution Engine boards. Anybody know if those are expected to be merged into the community tree? Is it just a matter of someone being willing to do the check-in, or is there some specific reason they're not there? (The site is mostly japanese except for file names, so I can't really interpret it...) Thanks, --Jeremy Siegel |
From: Jeremy S. <js...@mv...> - 2001-12-28 23:49:45
|
Apparently when I sent the patch up last month I transposed a couple lines :-( which means the attached fix is required. Robert, will you be able to include this next time you update your patches? Thanks! --Jeremy Siegel |
From: NIIBE Y. <gn...@m1...> - 2001-12-28 02:59:02
|
Here is an update of FPU patch, which includes fcnvsd exception fix by Kaz. Please note that we need new GCC to build the kernel with this patch. ftp://ftp.m17n.org/pub/linux-sh/testing/gcc-sh-linux_3.0.3-2.diff.gz For me, it works fine with the case of GNU Java. 2001-12-28 NIIBE Yutaka <gn...@m1...> (do_fpu_error): Handle denormalized floating point number. Remove un-needed grab_fpu. * arch/sh/kernel/head.S (_stext): Don't initialize FPU, as FPU is not used by kernel. (SR): Initial value with FD=1 (no FPU use). * include/asm-sh/processor.h (unlazy_fpu): Don't need to grab_fpu. (clear_fpu): Call release_fpu. * arch/sh/kernel/entry.S (PF_USEDFPU, __PF_USEDFPU): Removed. (restore_all, handle_exception): Simplified. (__fpu_prepare_fd, __init_task_flags): Removed * arch/sh/kernel/fpu.c (enable_fpu_in_danger): Removed. (fpu_prepare_fd): Removed. 2001-12-28 Kazumoto Kojima <kk...@rr...> * include/asm-sh/processor.h (FPSCR_ENABLE_MASK, FPSCR_FLAG_MASK): New macros. * arch/sh/kernel/fpu.c (denormal_to_double, ieee_fpe_handler): New functions. Index: arch/sh/kernel/entry.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/entry.S,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 entry.S --- arch/sh/kernel/entry.S 2001/10/15 20:44:47 1.1.1.1 +++ arch/sh/kernel/entry.S 2001/12/28 02:48:09 @@ -66,7 +66,6 @@ need_resched = 20 tsk_ptrace = 24 PT_TRACESYS = 0x00000002 -PF_USEDFPU = 0x00100000 ENOSYS = 38 EINVAL = 22 @@ -567,12 +566,6 @@ __irq_stat: .align 2 restore_all: -#if defined(__SH4__) - mov.l __fpu_prepare_fd, r0 - jsr @r0 - stc sr, r4 -#endif - ! mov.l @r15+, r0 mov.l @r15+, r1 mov.l @r15+, r2 @@ -585,7 +578,7 @@ restore_all: stc sr, r8 mov.l __blrb_flags, r9 ! BL =1, RB=1 or r9, r8 - ldc r8, sr ! here, change the register bank + ldc r8, sr ! here, change the register bank ! mov.l @r15+, r8 mov.l @r15+, r9 @@ -594,25 +587,25 @@ restore_all: mov.l @r15+, r12 mov.l @r15+, r13 mov.l @r15+, r14 - mov.l @r15+, k4 ! original stack pointer + mov.l @r15+, k4 ! original stack pointer ldc.l @r15+, spc lds.l @r15+, pr - mov.l @r15+, k3 ! original SR + mov.l @r15+, k3 ! original SR ldc.l @r15+, gbr lds.l @r15+, mach lds.l @r15+, macl - add #4, r15 ! Skip syscall number + add #4, r15 ! Skip syscall number ! ! Calculate new SR value - mov k3, k2 ! original SR value + mov k3, k2 ! original SR value mov.l 1f, k1 stc sr, k0 - and k1, k0 ! Get current FD-bit + and k1, k0 ! Get current FD-bit mov.l 2f, k1 - and k1, k2 ! Mask orignal SR value - or k0, k2 ! Inherit current FD-bit + and k1, k2 ! Mask orignal SR value + or k0, k2 ! Inherit current FD-bit ! - mov k3, k0 ! Calculate IMASK-bits + mov k3, k0 ! Calculate IMASK-bits shlr2 k0 and #0x3c, k0 cmp/eq #0x3c, k0 @@ -620,69 +613,15 @@ restore_all: shll2 k0 mov g_imask, k0 ! -7: or k0, k2 ! Set the IMASK-bits +7: or k0, k2 ! Set the IMASK-bits ldc k2, ssr ! -#if defined(__SH4__) - shll k2 - shll k2 - bf 9f ! user mode - /* Kernel to kernel transition */ - mov.l 1f, k1 - tst k1, k3 - bf 9f ! it hadn't FPU - ! Kernel to kernel and FPU was used - ! There's the case we don't get FPU now - stc sr, k2 - tst k1, k2 - bt 8f - ! We need to grab FPU here - xor k1, k2 - ldc k2, sr ! Grab FPU - mov.l __init_task_flags, k1 - mov.l @k1, k2 - mov.l __PF_USEDFPU, k0 - or k0, k2 - mov.l k2, @k1 ! Set init_task.flags |= PF_USEDFPU - ! - ! Restoring FPU... - ! -8: mov.l 3f, k1 - lds k1, fpscr - fmov.s @r15+, fr0 - fmov.s @r15+, fr1 - fmov.s @r15+, fr2 - fmov.s @r15+, fr3 - fmov.s @r15+, fr4 - fmov.s @r15+, fr5 - fmov.s @r15+, fr6 - fmov.s @r15+, fr7 - fmov.s @r15+, fr8 - fmov.s @r15+, fr9 - fmov.s @r15+, fr10 - fmov.s @r15+, fr11 - fmov.s @r15+, fr12 - fmov.s @r15+, fr13 - fmov.s @r15+, fr14 - fmov.s @r15+, fr15 - lds.l @r15+, fpscr - lds.l @r15+, fpul -9: -#endif mov k4, r15 rte nop .align 2 __blrb_flags: .long 0x30000000 -#if defined(__SH4__) -__fpu_prepare_fd: - .long SYMBOL_NAME(fpu_prepare_fd) -__init_task_flags: - .long SYMBOL_NAME(init_task_union)+4 -__PF_USEDFPU: - .long PF_USEDFPU -#endif 1: .long 0x00008000 ! FD 2: .long 0xffff7f0f ! ~(IMASK+FD) 3: .long 0x00080000 ! SZ=0, PR=1 @@ -732,61 +671,21 @@ handle_exception: ! Using k0, k1 for scratch registers (r0_bank1, r1_bank), ! save all registers onto stack. ! - stc ssr, k0 ! from kernel space? - shll k0 ! Check MD bit (bit30) by shifting it into the T bit - shll k0 -#if defined(__SH4__) - bf/s 8f ! it's from user to kernel transition - mov r15, k0 ! save original stack to k0 - /* It's a kernel to kernel transition. */ - /* Is the FPU disabled? */ - mov.l 2f, k1 - stc ssr, k0 - tst k1, k0 - mov.l 4f, k1 - bf/s 9f ! FPU is not enabled, no need to save it - mov r15, k0 ! save original stack to k0 - ! FPU is enabled, save it - ! /* XXX: Need to save another bank of FPU if all FPU feature is used */ - ! /* Currently it's not the case for GCC (only udivsi3_i4, divsi3_i4) */ - sts.l fpul, @-r15 - sts.l fpscr, @-r15 - mov.l 6f, k1 - lds k1, fpscr - mov.l 3f, k1 - fmov.s fr15, @-r15 - fmov.s fr14, @-r15 - fmov.s fr13, @-r15 - fmov.s fr12, @-r15 - fmov.s fr11, @-r15 - fmov.s fr10, @-r15 - fmov.s fr9, @-r15 - fmov.s fr8, @-r15 - fmov.s fr7, @-r15 - fmov.s fr6, @-r15 - fmov.s fr5, @-r15 - fmov.s fr4, @-r15 - fmov.s fr3, @-r15 - fmov.s fr2, @-r15 - fmov.s fr1, @-r15 - bra 9f - fmov.s fr0, @-r15 -#else - mov.l 3f, k1 - bt/s 9f ! it's a kernel to kernel transition, and skip the FPU save. - mov r15, k0 ! save original stack to k0 anyway -#endif -8: /* User space to kernel */ + stc ssr, k0 ! Is it from kernel space? + shll k0 ! Check MD bit (bit30) by shifting it into... + shll k0 ! ...the T bit + bt/s 9f ! It's a kernel to kernel transition. + mov r15, k0 ! save original stack to k0 + /* User space to kernel */ mov #0x20, k1 - shll8 k1 ! k1 <= 8192 == THREAD_SIZE + shll8 k1 ! k1 <= 8192 == THREAD_SIZE add current, k1 mov k1, r15 ! change to kernel stack ! - mov.l 4f, k1 ! let kernel release FPU -9: ! Save the user registers on the stack. - ! At this point, k1 should have been set to the new SR value - mov #-1, k4 - mov.l k4, @-r15 ! syscall_nr (default: -1) +9: mov #-1, k4 + mov.l 3f, k1 + ! Save the user registers on the stack. + mov.l k4, @-r15 ! syscall_nr (default: -1) ! sts.l macl, @-r15 sts.l mach, @-r15 @@ -806,11 +705,11 @@ handle_exception: mov.l r9, @-r15 mov.l r8, @-r15 ! - stc sr, r8 ! Back to normal register bank, and - or k1, r8 ! Block all interrupts, may release FPU + stc sr, r8 ! Back to normal register bank, and + or k1, r8 ! Block all interrupts mov.l 5f, k1 - and k1, r8 ! ... - ldc r8, sr ! ...changed here. + and k1, r8 ! ... + ldc r8, sr ! ...changed here. ! mov.l r7, @-r15 mov.l r6, @-r15 @@ -831,9 +730,7 @@ handle_exception: nop .align 2 1: .long SYMBOL_NAME(exception_handling_table) -2: .long 0x00008000 ! FD=1 3: .long 0x000000f0 ! FD=0, IMASK=15 -4: .long 0x000080f0 ! FD=1, IMASK=15 5: .long 0xcfffffff ! RB=0, BL=0 6: .long 0x00080000 ! SZ=0, PR=1 Index: arch/sh/kernel/fpu.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/fpu.c,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 fpu.c --- arch/sh/kernel/fpu.c 2001/10/15 20:44:48 1.1.1.1 +++ arch/sh/kernel/fpu.c 2001/12/28 02:48:09 @@ -18,6 +18,10 @@ #include <asm/processor.h> #include <asm/io.h> +/* + * Save FPU registers onto task structure. + * Assume called with FPU enabled (SR.FD=0). + */ void save_fpu(struct task_struct *tsk) { @@ -118,7 +122,8 @@ restore_fpu(struct task_struct *tsk) * double precission represents signaling NANS. */ -void fpu_init(void) +static void +fpu_init(void) { asm volatile("lds %0, fpul\n\t" "lds %1, fpscr\n\t" @@ -160,15 +165,125 @@ void fpu_init(void) : "r" (0), "r" (FPSCR_INIT)); } +/** + * denormal_to_double - Given denormalized float number, + * store double float + * + * @fpu: Pointer to sh_fpu_hard structure + * @n: Index to FP register + */ +static void +denormal_to_double (struct sh_fpu_hard_struct *fpu, int n) +{ + unsigned long du, dl; + unsigned long x = fpu->fpul; + int exp = 1023 - 126; + + if (x != 0 && (x & 0x7f800000) == 0) { + du = (x & 0x80000000); + while ((x & 0x00800000) == 0) { + x <<= 1; + exp--; + } + x &= 0x007fffff; + du |= (exp << 20) | (x >> 3); + dl = x << 29; + + fpu->fp_regs[n] = du; + fpu->fp_regs[n+1] = dl; + } +} + +/** + * ieee_fpe_handler - Handle denormalized number exception + * + * @regs: Pointer to register structure + * + * Returns 1 when it's handled (should not cause exception). + */ +static int +ieee_fpe_handler (struct pt_regs *regs) +{ + unsigned short insn = *(unsigned short *) regs->pc; + unsigned short finsn; + unsigned long nextpc; + int nib[4] = { + (insn >> 12) & 0xf, + (insn >> 8) & 0xf, + (insn >> 4) & 0xf, + insn & 0xf}; + + if (nib[0] == 0xb || + (nib[0] == 0x4 && nib[2] == 0x0 && nib[3] == 0xb)) /* bsr & jsr */ + regs->pr = regs->pc + 4; + + if (nib[0] == 0xa || nib[0] == 0xb) { /* bra & bsr */ + nextpc = regs->pc + 4 + ((short) ((insn & 0xfff) << 4) >> 3); + finsn = *(unsigned short *) (regs->pc + 2); + } else if (nib[0] == 0x8 && nib[1] == 0xd) { /* bt/s */ + if (regs->sr & 1) + nextpc = regs->pc + 4 + ((char) (insn & 0xff) << 1); + else + nextpc = regs->pc + 4; + finsn = *(unsigned short *) (regs->pc + 2); + } else if (nib[0] == 0x8 && nib[1] == 0xf) { /* bf/s */ + if (regs->sr & 1) + nextpc = regs->pc + 4; + else + nextpc = regs->pc + 4 + ((char) (insn & 0xff) << 1); + finsn = *(unsigned short *) (regs->pc + 2); + } else if (nib[0] == 0x4 && nib[3] == 0xb && + (nib[2] == 0x0 || nib[2] == 0x2)) { /* jmp & jsr */ + nextpc = regs->regs[nib[1]]; + finsn = *(unsigned short *) (regs->pc + 2); + } else if (nib[0] == 0x0 && nib[3] == 0x3 && + (nib[2] == 0x0 || nib[2] == 0x2)) { /* braf & bsrf */ + nextpc = regs->pc + 4 + regs->regs[nib[1]]; + finsn = *(unsigned short *) (regs->pc + 2); + } else if (insn == 0x000b) { /* rts */ + nextpc = regs->pr; + finsn = *(unsigned short *) (regs->pc + 2); + } else { + nextpc = regs->pc + 2; + finsn = insn; + } + + if ((finsn & 0xf1ff) == 0xf0ad) { /* fcnvsd */ + struct task_struct *tsk = current; + + save_fpu(tsk); + if ((tsk->thread.fpu.hard.fpscr & (1 << 17))) { + /* FPU error */ + denormal_to_double (&tsk->thread.fpu.hard, + (finsn >> 8) & 0xf); + tsk->thread.fpu.hard.fpscr &= + ~(FPSCR_CAUSE_MASK | FPSCR_FLAG_MASK); + grab_fpu(); + restore_fpu(tsk); + tsk->flags |= PF_USEDFPU; + } else { + tsk->thread.trap_no = 11; + tsk->thread.error_code = 0; + force_sig(SIGFPE, tsk); + } + + regs->pc = nextpc; + return 1; + } + + return 0; +} + asmlinkage void do_fpu_error(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs regs) { struct task_struct *tsk = current; - regs.pc += 2; + if (ieee_fpe_handler (®s)) + return; - grab_fpu(); + regs.pc += 2; save_fpu(tsk); tsk->thread.trap_no = 11; tsk->thread.error_code = 0; @@ -181,102 +296,12 @@ do_fpu_state_restore(unsigned long r4, u { struct task_struct *tsk = current; - if (!user_mode(®s)) { - if (tsk != &init_task) { - unlazy_fpu(tsk); - } - tsk = &init_task; - if (tsk->flags & PF_USEDFPU) { - /* - * This weird situation can be occurred. - * - * There's race condition in __cli: - * - * (1) SR --> register - * (2) Set IMASK of register - * (3) SR <-- register - * - * Between (1) and (2), or (2) and (3) getting - * interrupt, and interrupt handler (or - * softirq) may use FPU. - * - * Then, SR.FD is overwritten by (3). - * - * This results init_task.PF_USEDFPU is on, - * with SR.FD == 1. - * - */ - release_fpu(); - return; - } - } - grab_fpu(); - if (tsk->used_math) { - /* Using the FPU again. */ - restore_fpu(tsk); - } else { - /* First time FPU user. */ - fpu_init(); - tsk->used_math = 1; - } - tsk->flags |= PF_USEDFPU; - release_fpu(); -} - -/* - * Change current FD flag to set FD flag back to exception - */ -asmlinkage void -fpu_prepare_fd(unsigned long sr, unsigned long r5, unsigned long r6, - unsigned long r7, struct pt_regs regs) -{ - __cli(); if (!user_mode(®s)) { - if (init_task.flags & PF_USEDFPU) - grab_fpu(); - else { - if (!(sr & SR_FD)) { - BUG(); - release_fpu(); - } - } + printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); return; } - if (sr & SR_FD) { /* Kernel doesn't grab FPU */ - if (current->flags & PF_USEDFPU) - grab_fpu(); - else { - if (init_task.flags & PF_USEDFPU) { - /* - * This weird situation can be occurred. - * See the comment in do_fpu_state_restore. - */ - grab_fpu(); - save_fpu(&init_task); - } - } - } else { - if (init_task.flags & PF_USEDFPU) - save_fpu(&init_task); - else { - BUG(); - release_fpu(); - } - } -} - -/* Short cut for the FPU exception */ -asmlinkage void -enable_fpu_in_danger(void) -{ - struct task_struct *tsk = current; - - if (tsk != &init_task) - unlazy_fpu(tsk); - - tsk = &init_task; if (tsk->used_math) { /* Using the FPU again. */ restore_fpu(tsk); Index: arch/sh/kernel/head.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/head.S,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 head.S --- arch/sh/kernel/head.S 2001/10/15 20:44:48 1.1.1.1 +++ arch/sh/kernel/head.S 2001/12/28 02:48:09 @@ -50,12 +50,6 @@ ENTRY(_stext) sub r1, r0 ! ldc r0, r7_bank ! ... and init_task ! -#if defined(__SH4__) - ! Initialize fpu - mov.l 7f, r0 - jsr @r0 - nop -#endif ! Enable cache mov.l 6f, r0 jsr @r0 @@ -74,12 +68,9 @@ ENTRY(_stext) nop .balign 4 -1: .long 0x400000F0 ! MD=1, RB=0, BL=0, FD=0, IMASK=0xF +1: .long 0x400080F0 ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF 2: .long SYMBOL_NAME(stack) 3: .long SYMBOL_NAME(__bss_start) 4: .long SYMBOL_NAME(_end) 5: .long SYMBOL_NAME(start_kernel) 6: .long SYMBOL_NAME(cache_init) -#if defined(__SH4__) -7: .long SYMBOL_NAME(fpu_init) -#endif Index: include/asm-sh/processor.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/processor.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 processor.h --- include/asm-sh/processor.h 2001/10/15 20:45:10 1.1.1.1 +++ include/asm-sh/processor.h 2001/12/28 02:48:09 @@ -184,18 +184,22 @@ extern void save_fpu(struct task_struct #define unlazy_fpu(tsk) do { \ if ((tsk)->flags & PF_USEDFPU) { \ - grab_fpu(); \ save_fpu(tsk); \ } \ } while (0) #define clear_fpu(tsk) do { \ - if ((tsk)->flags & PF_USEDFPU) \ + if ((tsk)->flags & PF_USEDFPU) { \ (tsk)->flags &= ~PF_USEDFPU; \ + release_fpu(); \ + } \ } while (0) /* Double presision, NANS as NANS, rounding to nearest, no exceptions */ #define FPSCR_INIT 0x00080000 + +#define FPSCR_CAUSE_MASK 0x0001f000 /* Cause bits */ +#define FPSCR_FLAG_MASK 0x0000007c /* Flag bits */ /* * Return saved PC of a blocked thread. -- |
From: NIIBE Y. <gn...@m1...> - 2001-12-28 02:54:54
|
Adrian McMenamin wrote: > costab[k] = 1.0 / (2.0 * cos( 3.14159265358979323846 * ((double) k * 2.0 + > 1.0) / (double) divv)); [...] > So: the questions are - is this a known problem, has it been fixed in later > kernels or have I just got it wrong? I don't know if this is related, we have a FPU bug wrt floating point to double conversion. For example, compiling runtime of Java, GCC fails because of exception. I have experimental fix for this issue, I'll send this to linuxsh-dev soon. -- |
From: M. R. B. <mr...@0x...> - 2001-12-27 21:22:12
|
* Adrian McMenamin <ad...@mc...> on Thu, Dec 27, 2001: > I have been working to make/port a decent mp3 player for the Dreamcast no= w=20 > that there is a sound driver. >=20 > I have built mpg123 with these options: >=20 > dream: > $(MAKE) CC=3Dsh4-linux-gcc LDFLAGS=3D \ > OBJECTS=3D'decode.o dct64.o audio_oss.o' \ > CFLAGS=3D'-DREAL_IS_FLOAT -DLINUX -Wall -O2 \ > -DOSS \ > -fomit-frame-pointer -funroll-all-loops \ > -finline-functions -ffast-math' \ > mpg123-make > Update: Using the above line in mpg123/Makefile (with dream changed to linux-sh for consistency), I built mpg123 and executed it on the Dreamcast = ... no problems whatsoever. You must have a snag in your toolchain somewhere. I'm using (all patched with the latest patchset from ftp.m17n.org/pub/super-h/testing/) binutils 2.11.2, GCC 3.0.3, and glibc 2.2.4. This was executed under the busybox shell (the sh-like one) under kernel 2.4.16. M. R. |
From: M. R. B. <mr...@0x...> - 2001-12-27 18:00:35
|
* Adrian McMenamin <ad...@mc...> on Thu, Dec 27, 2001: > I have been working to make/port a decent mp3 player for the Dreamcast no= w=20 > that there is a sound driver. >=20 > I have built mpg123 with these options: >=20 > dream: > $(MAKE) CC=3Dsh4-linux-gcc LDFLAGS=3D \ > OBJECTS=3D'decode.o dct64.o audio_oss.o' \ > CFLAGS=3D'-DREAL_IS_FLOAT -DLINUX -Wall -O2 \ > -DOSS \ > -fomit-frame-pointer -funroll-all-loops \ > -finline-functions -ffast-math' \ > mpg123-make >=20 > but this always generates a floating point exception at run time. >=20 I'm not to keen on how the flags function for the SH backend of GCC (maybe NIIBE-san knows?) but I always thought -ffast-math was a i386-based (not necessarily specific) optimization. I don't think it's wise to use it here =2E.. although it may be a no-op. Only a read through GCC's source will confirm that. >=20 > Incuidentally with -DREAL_IS_FLOAT switched off then there is no fp excep= tion=20 > but the program outputs static. >=20 Have you tried with -m4-single-only? It generates FP code conforming to what its name implies. > So: the questions are - is this a known problem, has it been fixed in lat= er=20 > kernels or have I just got it wrong? >=20 I don't see how it could be a kernel issue. M. R. |
From: Adrian M. <ad...@mc...> - 2001-12-27 12:35:28
|
Additional point: I am using gcc 3.0.1 as the cross compiler |
From: Adrian M. <ad...@mc...> - 2001-12-27 12:08:51
|
I have been working to make/port a decent mp3 player for the Dreamcast now that there is a sound driver. I have built mpg123 with these options: dream: $(MAKE) CC=sh4-linux-gcc LDFLAGS= \ OBJECTS='decode.o dct64.o audio_oss.o' \ CFLAGS='-DREAL_IS_FLOAT -DLINUX -Wall -O2 \ -DOSS \ -fomit-frame-pointer -funroll-all-loops \ -finline-functions -ffast-math' \ mpg123-make but this always generates a floating point exception at run time. I have been able to isolate this to the following function: costab[k] = 1.0 / (2.0 * cos( 3.14159265358979323846 * ((double) k * 2.0 + 1.0) / (double) divv)); This is looped 0 < k < kr With k as 0 it costab[k] is returned as NaN and with k = 1 the floating point exception is generated. kr is 16 and divv is 64. My maths indicates costab[0] should be roughly 0.5. Incuidentally with -DREAL_IS_FLOAT switched off then there is no fp exception but the program outputs static. So: the questions are - is this a known problem, has it been fixed in later kernels or have I just got it wrong? Adrian |
From: Jeremy S. <js...@mv...> - 2001-12-26 18:33:13
|
NIIBE Yutaka wrote: > Something like following (with comment) looks better: > > /* Use type coersion to get sign extention */ > #define SH4_PC_OFFSET_WORD(X) ((((signed short)((X)<<4))>>3) + 4) > ... > regs->pc += SH4_PC_OFFSET_WORD(instruction); > > It would be good we could avoid type coersion, but I dont' have good > alternative... Ok, I'll check it in that way (macros and comments). |
From: NIIBE Y. <gn...@m1...> - 2001-12-25 07:27:47
|
NIIBE Yutaka wrote: > ... is available at: > ftp://ftp.m17n.org/pub/linux-sh/testing/gcc-sh-linux_3.0.3-1.diff.gz an update for testsuite (No change for the source code): ftp://ftp.m17n.org/pub/linux-sh/testing/gcc-sh-linux_3.0.3-2.diff.gz Bootstrapped and tested on sh4-linux. === gcc Summary === # of expected passes 15289 # of unexpected failures 6 # of expected failures 76 # of unsupported tests 52 /home/debian/gn/gcc-sh-linux-3.0.3/build-sh-self/gcc/xgcc version 3.0.3 FAIL: gcc.c-torture/compile/20001226-1.c, -O0 FAIL: gcc.c-torture/compile/20001226-1.c, -O1 FAIL: gcc.c-torture/compile/20001226-1.c, -O2 FAIL: gcc.c-torture/compile/20001226-1.c, -O3 -fomit-frame-pointer FAIL: gcc.c-torture/compile/20001226-1.c, -O3 -g FAIL: gcc.c-torture/compile/20001226-1.c, -Os -- |
From: Adrian M. <ad...@mc...> - 2001-12-24 01:54:15
|
Pre-release version of sound (/dev/dsp) driver for Dreamcast Linux Those of you who feel confident (and have a console) with the idea of compiling a new module for the kernel may wish to try the /dev/dsp sound driver I have written for Linux on the Sega Dreamcast. The two source files you need are at: http://www.mcmen.demon.co.uk/linuxdc/aica/aica.c and http://www.mcmen.demon.co.uk/linuxdc/aica/arm7.h What you need to know etc... The driver acts as an extended wrap around to what essentially is Dan Potter's KOS code - ie it loads and runs some basic ARM7 code that drives the DC's sound processor and controls that through polling. The driver is written to comply with the OSS/Free standard and to get it to run you need to compile the OSS soundcore.o module - this is available from the linuxsh CVS as well as many other places. Be careful about compiling the rest of the OSS stuff - on my kernel (2.4.10-pre6) the DMA code appears to cause real problems. You may also need to export a couple of additional variable from the kerenel (I did, but can't speak for other versions of the kernel). Performance.... Seems fine with 8 and 16 bit mono, but is a little bit jerky with stereo and complex code (eg MP3s). I have been able to compile SoX and MAD and play sounds with both (though only one MP3 so far with MAD). Sound from PRBOOM (but not MIDI music) seems also to work. What next... Marcus Brown is working on DMA which should greatly improve performance. So no one should regard this as an opportunity to do anything other than to test a pre-release version of the code. Please feel free to let me know what problems or comments you have. Adrian McMenamin ad...@mc... ------------------------------------------------------- |
From: NIIBE Y. <gn...@m1...> - 2001-12-22 10:31:39
|
Here is update. You need new GCC for this (-mno-implicit-fpu). I won't commit this soon, as it's big change. 2001-12-22 NIIBE Yutaka <gn...@m1...> * arch/sh/kernel/head.S (_stext): Don't initialize FPU, as FPU is not used by kernel. (SR): Initial value with FD=1 (no FPU use). * include/asm-sh/processor.h (unlazy_fpu): Don't need to grab_fpu. (clear_fpu): Call release_fpu. * arch/sh/kernel/entry.S (PF_USEDFPU, __PF_USEDFPU): Removed. (restore_all, handle_exception): Simplified. (__fpu_prepare_fd, __init_task_flags): Removed * arch/sh/kernel/fpu.c (enable_fpu_in_danger): Removed. (fpu_prepare_fd): Removed. Index: arch/sh/kernel/entry.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/entry.S,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 entry.S --- arch/sh/kernel/entry.S 2001/10/15 20:44:47 1.1.1.1 +++ arch/sh/kernel/entry.S 2001/12/22 10:27:47 @@ -66,7 +66,6 @@ need_resched = 20 tsk_ptrace = 24 PT_TRACESYS = 0x00000002 -PF_USEDFPU = 0x00100000 ENOSYS = 38 EINVAL = 22 @@ -567,12 +566,6 @@ __irq_stat: .align 2 restore_all: -#if defined(__SH4__) - mov.l __fpu_prepare_fd, r0 - jsr @r0 - stc sr, r4 -#endif - ! mov.l @r15+, r0 mov.l @r15+, r1 mov.l @r15+, r2 @@ -585,7 +578,7 @@ restore_all: stc sr, r8 mov.l __blrb_flags, r9 ! BL =1, RB=1 or r9, r8 - ldc r8, sr ! here, change the register bank + ldc r8, sr ! here, change the register bank ! mov.l @r15+, r8 mov.l @r15+, r9 @@ -594,25 +587,25 @@ restore_all: mov.l @r15+, r12 mov.l @r15+, r13 mov.l @r15+, r14 - mov.l @r15+, k4 ! original stack pointer + mov.l @r15+, k4 ! original stack pointer ldc.l @r15+, spc lds.l @r15+, pr - mov.l @r15+, k3 ! original SR + mov.l @r15+, k3 ! original SR ldc.l @r15+, gbr lds.l @r15+, mach lds.l @r15+, macl - add #4, r15 ! Skip syscall number + add #4, r15 ! Skip syscall number ! ! Calculate new SR value - mov k3, k2 ! original SR value + mov k3, k2 ! original SR value mov.l 1f, k1 stc sr, k0 - and k1, k0 ! Get current FD-bit + and k1, k0 ! Get current FD-bit mov.l 2f, k1 - and k1, k2 ! Mask orignal SR value - or k0, k2 ! Inherit current FD-bit + and k1, k2 ! Mask orignal SR value + or k0, k2 ! Inherit current FD-bit ! - mov k3, k0 ! Calculate IMASK-bits + mov k3, k0 ! Calculate IMASK-bits shlr2 k0 and #0x3c, k0 cmp/eq #0x3c, k0 @@ -620,69 +613,15 @@ restore_all: shll2 k0 mov g_imask, k0 ! -7: or k0, k2 ! Set the IMASK-bits +7: or k0, k2 ! Set the IMASK-bits ldc k2, ssr ! -#if defined(__SH4__) - shll k2 - shll k2 - bf 9f ! user mode - /* Kernel to kernel transition */ - mov.l 1f, k1 - tst k1, k3 - bf 9f ! it hadn't FPU - ! Kernel to kernel and FPU was used - ! There's the case we don't get FPU now - stc sr, k2 - tst k1, k2 - bt 8f - ! We need to grab FPU here - xor k1, k2 - ldc k2, sr ! Grab FPU - mov.l __init_task_flags, k1 - mov.l @k1, k2 - mov.l __PF_USEDFPU, k0 - or k0, k2 - mov.l k2, @k1 ! Set init_task.flags |= PF_USEDFPU - ! - ! Restoring FPU... - ! -8: mov.l 3f, k1 - lds k1, fpscr - fmov.s @r15+, fr0 - fmov.s @r15+, fr1 - fmov.s @r15+, fr2 - fmov.s @r15+, fr3 - fmov.s @r15+, fr4 - fmov.s @r15+, fr5 - fmov.s @r15+, fr6 - fmov.s @r15+, fr7 - fmov.s @r15+, fr8 - fmov.s @r15+, fr9 - fmov.s @r15+, fr10 - fmov.s @r15+, fr11 - fmov.s @r15+, fr12 - fmov.s @r15+, fr13 - fmov.s @r15+, fr14 - fmov.s @r15+, fr15 - lds.l @r15+, fpscr - lds.l @r15+, fpul -9: -#endif mov k4, r15 rte nop .align 2 __blrb_flags: .long 0x30000000 -#if defined(__SH4__) -__fpu_prepare_fd: - .long SYMBOL_NAME(fpu_prepare_fd) -__init_task_flags: - .long SYMBOL_NAME(init_task_union)+4 -__PF_USEDFPU: - .long PF_USEDFPU -#endif 1: .long 0x00008000 ! FD 2: .long 0xffff7f0f ! ~(IMASK+FD) 3: .long 0x00080000 ! SZ=0, PR=1 @@ -732,61 +671,21 @@ handle_exception: ! Using k0, k1 for scratch registers (r0_bank1, r1_bank), ! save all registers onto stack. ! - stc ssr, k0 ! from kernel space? - shll k0 ! Check MD bit (bit30) by shifting it into the T bit - shll k0 -#if defined(__SH4__) - bf/s 8f ! it's from user to kernel transition - mov r15, k0 ! save original stack to k0 - /* It's a kernel to kernel transition. */ - /* Is the FPU disabled? */ - mov.l 2f, k1 - stc ssr, k0 - tst k1, k0 - mov.l 4f, k1 - bf/s 9f ! FPU is not enabled, no need to save it - mov r15, k0 ! save original stack to k0 - ! FPU is enabled, save it - ! /* XXX: Need to save another bank of FPU if all FPU feature is used */ - ! /* Currently it's not the case for GCC (only udivsi3_i4, divsi3_i4) */ - sts.l fpul, @-r15 - sts.l fpscr, @-r15 - mov.l 6f, k1 - lds k1, fpscr - mov.l 3f, k1 - fmov.s fr15, @-r15 - fmov.s fr14, @-r15 - fmov.s fr13, @-r15 - fmov.s fr12, @-r15 - fmov.s fr11, @-r15 - fmov.s fr10, @-r15 - fmov.s fr9, @-r15 - fmov.s fr8, @-r15 - fmov.s fr7, @-r15 - fmov.s fr6, @-r15 - fmov.s fr5, @-r15 - fmov.s fr4, @-r15 - fmov.s fr3, @-r15 - fmov.s fr2, @-r15 - fmov.s fr1, @-r15 - bra 9f - fmov.s fr0, @-r15 -#else - mov.l 3f, k1 - bt/s 9f ! it's a kernel to kernel transition, and skip the FPU save. - mov r15, k0 ! save original stack to k0 anyway -#endif -8: /* User space to kernel */ + stc ssr, k0 ! Is it from kernel space? + shll k0 ! Check MD bit (bit30) by shifting it into... + shll k0 ! ...the T bit + bt/s 9f ! It's a kernel to kernel transition. + mov r15, k0 ! save original stack to k0 + /* User space to kernel */ mov #0x20, k1 - shll8 k1 ! k1 <= 8192 == THREAD_SIZE + shll8 k1 ! k1 <= 8192 == THREAD_SIZE add current, k1 mov k1, r15 ! change to kernel stack ! - mov.l 4f, k1 ! let kernel release FPU -9: ! Save the user registers on the stack. - ! At this point, k1 should have been set to the new SR value - mov #-1, k4 - mov.l k4, @-r15 ! syscall_nr (default: -1) +9: mov #-1, k4 + mov.l 3f, k1 + ! Save the user registers on the stack. + mov.l k4, @-r15 ! syscall_nr (default: -1) ! sts.l macl, @-r15 sts.l mach, @-r15 @@ -806,11 +705,11 @@ handle_exception: mov.l r9, @-r15 mov.l r8, @-r15 ! - stc sr, r8 ! Back to normal register bank, and - or k1, r8 ! Block all interrupts, may release FPU + stc sr, r8 ! Back to normal register bank, and + or k1, r8 ! Block all interrupts mov.l 5f, k1 - and k1, r8 ! ... - ldc r8, sr ! ...changed here. + and k1, r8 ! ... + ldc r8, sr ! ...changed here. ! mov.l r7, @-r15 mov.l r6, @-r15 @@ -831,9 +730,7 @@ handle_exception: nop .align 2 1: .long SYMBOL_NAME(exception_handling_table) -2: .long 0x00008000 ! FD=1 3: .long 0x000000f0 ! FD=0, IMASK=15 -4: .long 0x000080f0 ! FD=1, IMASK=15 5: .long 0xcfffffff ! RB=0, BL=0 6: .long 0x00080000 ! SZ=0, PR=1 Index: arch/sh/kernel/fpu.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/fpu.c,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 fpu.c --- arch/sh/kernel/fpu.c 2001/10/15 20:44:48 1.1.1.1 +++ arch/sh/kernel/fpu.c 2001/12/22 10:27:47 @@ -18,6 +18,10 @@ #include <asm/processor.h> #include <asm/io.h> +/* + * Save FPU registers onto task structure. + * Assume called with FPU enabled (SR.FD=0). + */ void save_fpu(struct task_struct *tsk) { @@ -118,7 +122,8 @@ restore_fpu(struct task_struct *tsk) * double precission represents signaling NANS. */ -void fpu_init(void) +static void +fpu_init(void) { asm volatile("lds %0, fpul\n\t" "lds %1, fpscr\n\t" @@ -181,102 +186,12 @@ do_fpu_state_restore(unsigned long r4, u { struct task_struct *tsk = current; - if (!user_mode(®s)) { - if (tsk != &init_task) { - unlazy_fpu(tsk); - } - tsk = &init_task; - if (tsk->flags & PF_USEDFPU) { - /* - * This weird situation can be occurred. - * - * There's race condition in __cli: - * - * (1) SR --> register - * (2) Set IMASK of register - * (3) SR <-- register - * - * Between (1) and (2), or (2) and (3) getting - * interrupt, and interrupt handler (or - * softirq) may use FPU. - * - * Then, SR.FD is overwritten by (3). - * - * This results init_task.PF_USEDFPU is on, - * with SR.FD == 1. - * - */ - release_fpu(); - return; - } - } - grab_fpu(); - if (tsk->used_math) { - /* Using the FPU again. */ - restore_fpu(tsk); - } else { - /* First time FPU user. */ - fpu_init(); - tsk->used_math = 1; - } - tsk->flags |= PF_USEDFPU; - release_fpu(); -} - -/* - * Change current FD flag to set FD flag back to exception - */ -asmlinkage void -fpu_prepare_fd(unsigned long sr, unsigned long r5, unsigned long r6, - unsigned long r7, struct pt_regs regs) -{ - __cli(); if (!user_mode(®s)) { - if (init_task.flags & PF_USEDFPU) - grab_fpu(); - else { - if (!(sr & SR_FD)) { - BUG(); - release_fpu(); - } - } + printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); return; } - if (sr & SR_FD) { /* Kernel doesn't grab FPU */ - if (current->flags & PF_USEDFPU) - grab_fpu(); - else { - if (init_task.flags & PF_USEDFPU) { - /* - * This weird situation can be occurred. - * See the comment in do_fpu_state_restore. - */ - grab_fpu(); - save_fpu(&init_task); - } - } - } else { - if (init_task.flags & PF_USEDFPU) - save_fpu(&init_task); - else { - BUG(); - release_fpu(); - } - } -} - -/* Short cut for the FPU exception */ -asmlinkage void -enable_fpu_in_danger(void) -{ - struct task_struct *tsk = current; - - if (tsk != &init_task) - unlazy_fpu(tsk); - - tsk = &init_task; if (tsk->used_math) { /* Using the FPU again. */ restore_fpu(tsk); Index: arch/sh/kernel/head.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/head.S,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 head.S --- arch/sh/kernel/head.S 2001/10/15 20:44:48 1.1.1.1 +++ arch/sh/kernel/head.S 2001/12/22 10:27:47 @@ -50,12 +50,6 @@ ENTRY(_stext) sub r1, r0 ! ldc r0, r7_bank ! ... and init_task ! -#if defined(__SH4__) - ! Initialize fpu - mov.l 7f, r0 - jsr @r0 - nop -#endif ! Enable cache mov.l 6f, r0 jsr @r0 @@ -74,12 +68,9 @@ ENTRY(_stext) nop .balign 4 -1: .long 0x400000F0 ! MD=1, RB=0, BL=0, FD=0, IMASK=0xF +1: .long 0x400080F0 ! MD=1, RB=0, BL=0, FD=1, IMASK=0xF 2: .long SYMBOL_NAME(stack) 3: .long SYMBOL_NAME(__bss_start) 4: .long SYMBOL_NAME(_end) 5: .long SYMBOL_NAME(start_kernel) 6: .long SYMBOL_NAME(cache_init) -#if defined(__SH4__) -7: .long SYMBOL_NAME(fpu_init) -#endif Index: include/asm-sh/processor.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/processor.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 processor.h --- include/asm-sh/processor.h 2001/10/15 20:45:10 1.1.1.1 +++ include/asm-sh/processor.h 2001/12/22 10:27:47 @@ -184,14 +184,15 @@ extern void save_fpu(struct task_struct #define unlazy_fpu(tsk) do { \ if ((tsk)->flags & PF_USEDFPU) { \ - grab_fpu(); \ save_fpu(tsk); \ } \ } while (0) #define clear_fpu(tsk) do { \ - if ((tsk)->flags & PF_USEDFPU) \ + if ((tsk)->flags & PF_USEDFPU) { \ (tsk)->flags &= ~PF_USEDFPU; \ + release_fpu(); \ + } \ } while (0) /* Double presision, NANS as NANS, rounding to nearest, no exceptions */ -- |
From: NIIBE Y. <gn...@m1...> - 2001-12-22 10:17:37
|
... is available at: ftp://ftp.m17n.org/pub/linux-sh/testing/gcc-sh-linux_3.0.3-1.diff.gz This is update to 3.0.3 release. Also include varargs handling for -mno-implicit-fp. I'm not sure if this is good thing or not. I test it for compiling of GNU C library and kernel. Not tested well. -- |
From: NIIBE Y. <gn...@m1...> - 2001-12-22 09:15:10
|
Jeremy Siegel wrote: > > We want something like "ext.b" or "ext.w" (of SuperH assembler) here. > > In general, it's not good practice using type coercion to do the > > calculation. > > Not sure I understand... would you prefer explicit asm statements rather > than forcing the ext type using casts? My words were poor. Sorry about the confusion. For the caluculation of sign extention, I think that using type coercion is not looks good, because it is implicit and hard to read. I don't think using asm statement is good, either. (At that time, the term "sign extention" was not in my brain but the instruction "ext.b" and "ext.w" were there.) Something like following (with comment) looks better: /* Use type coersion to get sign extention */ #define SH4_PC_OFFSET_WORD(X) ((((signed short)((X)<<4))>>3) + 4) ... regs->pc += SH4_PC_OFFSET_WORD(instruction); It would be good we could avoid type coersion, but I dont' have good alternative... -- |
From: Jeremy S. <js...@mv...> - 2001-12-20 17:49:21
|
NIIBE Yutaka wrote: > I have a comment on the expressions calculating PC. It's OK, but > it would be good if we can improve the implementation. > > > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; > [...] > > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; > [...] > > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; > [...] > > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; > > We want something like "ext.b" or "ext.w" (of SuperH assembler) here. > In general, it's not good practice using type coercion to do the > calculation. Not sure I understand... would you prefer explicit asm statements rather than forcing the ext type using casts? --Jeremy |
From: NIIBE Y. <gn...@m1...> - 2001-12-20 02:56:58
|
Here's a patch to remove FPU usage support in kernel, which I talked summer or spring. It took so long, because I needed to be conservative to sync. 2001-12-20 NIIBE Yutaka <gn...@m1...> * include/asm-sh/processor.h (unlazy_fpu): Don't need to grab_fpu. * arch/sh/kernel/entry.S (PF_USEDFPU, __PF_USEDFPU): Removed. (restore_all, handle_exception): Simplified. (__fpu_prepare_fd, __init_task_flags): Removed * arch/sh/kernel/fpu.c (enable_fpu_in_danger): Removed. (fpu_prepare_fd): Removed. Index: arch/sh/kernel/entry.S =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/entry.S,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 entry.S --- arch/sh/kernel/entry.S 2001/10/15 20:44:47 1.1.1.1 +++ arch/sh/kernel/entry.S 2001/12/20 02:51:09 @@ -66,7 +66,6 @@ need_resched = 20 tsk_ptrace = 24 PT_TRACESYS = 0x00000002 -PF_USEDFPU = 0x00100000 ENOSYS = 38 EINVAL = 22 @@ -567,12 +566,6 @@ __irq_stat: .align 2 restore_all: -#if defined(__SH4__) - mov.l __fpu_prepare_fd, r0 - jsr @r0 - stc sr, r4 -#endif - ! mov.l @r15+, r0 mov.l @r15+, r1 mov.l @r15+, r2 @@ -585,7 +578,7 @@ restore_all: stc sr, r8 mov.l __blrb_flags, r9 ! BL =1, RB=1 or r9, r8 - ldc r8, sr ! here, change the register bank + ldc r8, sr ! here, change the register bank ! mov.l @r15+, r8 mov.l @r15+, r9 @@ -594,25 +587,25 @@ restore_all: mov.l @r15+, r12 mov.l @r15+, r13 mov.l @r15+, r14 - mov.l @r15+, k4 ! original stack pointer + mov.l @r15+, k4 ! original stack pointer ldc.l @r15+, spc lds.l @r15+, pr - mov.l @r15+, k3 ! original SR + mov.l @r15+, k3 ! original SR ldc.l @r15+, gbr lds.l @r15+, mach lds.l @r15+, macl - add #4, r15 ! Skip syscall number + add #4, r15 ! Skip syscall number ! ! Calculate new SR value - mov k3, k2 ! original SR value + mov k3, k2 ! original SR value mov.l 1f, k1 stc sr, k0 - and k1, k0 ! Get current FD-bit + and k1, k0 ! Get current FD-bit mov.l 2f, k1 - and k1, k2 ! Mask orignal SR value - or k0, k2 ! Inherit current FD-bit + and k1, k2 ! Mask orignal SR value + or k0, k2 ! Inherit current FD-bit ! - mov k3, k0 ! Calculate IMASK-bits + mov k3, k0 ! Calculate IMASK-bits shlr2 k0 and #0x3c, k0 cmp/eq #0x3c, k0 @@ -620,69 +613,15 @@ restore_all: shll2 k0 mov g_imask, k0 ! -7: or k0, k2 ! Set the IMASK-bits +7: or k0, k2 ! Set the IMASK-bits ldc k2, ssr ! -#if defined(__SH4__) - shll k2 - shll k2 - bf 9f ! user mode - /* Kernel to kernel transition */ - mov.l 1f, k1 - tst k1, k3 - bf 9f ! it hadn't FPU - ! Kernel to kernel and FPU was used - ! There's the case we don't get FPU now - stc sr, k2 - tst k1, k2 - bt 8f - ! We need to grab FPU here - xor k1, k2 - ldc k2, sr ! Grab FPU - mov.l __init_task_flags, k1 - mov.l @k1, k2 - mov.l __PF_USEDFPU, k0 - or k0, k2 - mov.l k2, @k1 ! Set init_task.flags |= PF_USEDFPU - ! - ! Restoring FPU... - ! -8: mov.l 3f, k1 - lds k1, fpscr - fmov.s @r15+, fr0 - fmov.s @r15+, fr1 - fmov.s @r15+, fr2 - fmov.s @r15+, fr3 - fmov.s @r15+, fr4 - fmov.s @r15+, fr5 - fmov.s @r15+, fr6 - fmov.s @r15+, fr7 - fmov.s @r15+, fr8 - fmov.s @r15+, fr9 - fmov.s @r15+, fr10 - fmov.s @r15+, fr11 - fmov.s @r15+, fr12 - fmov.s @r15+, fr13 - fmov.s @r15+, fr14 - fmov.s @r15+, fr15 - lds.l @r15+, fpscr - lds.l @r15+, fpul -9: -#endif mov k4, r15 rte nop .align 2 __blrb_flags: .long 0x30000000 -#if defined(__SH4__) -__fpu_prepare_fd: - .long SYMBOL_NAME(fpu_prepare_fd) -__init_task_flags: - .long SYMBOL_NAME(init_task_union)+4 -__PF_USEDFPU: - .long PF_USEDFPU -#endif 1: .long 0x00008000 ! FD 2: .long 0xffff7f0f ! ~(IMASK+FD) 3: .long 0x00080000 ! SZ=0, PR=1 @@ -732,61 +671,21 @@ handle_exception: ! Using k0, k1 for scratch registers (r0_bank1, r1_bank), ! save all registers onto stack. ! - stc ssr, k0 ! from kernel space? - shll k0 ! Check MD bit (bit30) by shifting it into the T bit - shll k0 -#if defined(__SH4__) - bf/s 8f ! it's from user to kernel transition - mov r15, k0 ! save original stack to k0 - /* It's a kernel to kernel transition. */ - /* Is the FPU disabled? */ - mov.l 2f, k1 - stc ssr, k0 - tst k1, k0 - mov.l 4f, k1 - bf/s 9f ! FPU is not enabled, no need to save it - mov r15, k0 ! save original stack to k0 - ! FPU is enabled, save it - ! /* XXX: Need to save another bank of FPU if all FPU feature is used */ - ! /* Currently it's not the case for GCC (only udivsi3_i4, divsi3_i4) */ - sts.l fpul, @-r15 - sts.l fpscr, @-r15 - mov.l 6f, k1 - lds k1, fpscr - mov.l 3f, k1 - fmov.s fr15, @-r15 - fmov.s fr14, @-r15 - fmov.s fr13, @-r15 - fmov.s fr12, @-r15 - fmov.s fr11, @-r15 - fmov.s fr10, @-r15 - fmov.s fr9, @-r15 - fmov.s fr8, @-r15 - fmov.s fr7, @-r15 - fmov.s fr6, @-r15 - fmov.s fr5, @-r15 - fmov.s fr4, @-r15 - fmov.s fr3, @-r15 - fmov.s fr2, @-r15 - fmov.s fr1, @-r15 - bra 9f - fmov.s fr0, @-r15 -#else - mov.l 3f, k1 - bt/s 9f ! it's a kernel to kernel transition, and skip the FPU save. - mov r15, k0 ! save original stack to k0 anyway -#endif -8: /* User space to kernel */ + stc ssr, k0 ! Is it from kernel space? + shll k0 ! Check MD bit (bit30) by shifting it into... + shll k0 ! ...the T bit + bt/s 9f ! It's a kernel to kernel transition. + mov r15, k0 ! save original stack to k0 + /* User space to kernel */ mov #0x20, k1 - shll8 k1 ! k1 <= 8192 == THREAD_SIZE + shll8 k1 ! k1 <= 8192 == THREAD_SIZE add current, k1 mov k1, r15 ! change to kernel stack ! - mov.l 4f, k1 ! let kernel release FPU -9: ! Save the user registers on the stack. - ! At this point, k1 should have been set to the new SR value - mov #-1, k4 - mov.l k4, @-r15 ! syscall_nr (default: -1) +9: mov #-1, k4 + mov.l 3f, k1 + ! Save the user registers on the stack. + mov.l k4, @-r15 ! syscall_nr (default: -1) ! sts.l macl, @-r15 sts.l mach, @-r15 @@ -806,11 +705,11 @@ handle_exception: mov.l r9, @-r15 mov.l r8, @-r15 ! - stc sr, r8 ! Back to normal register bank, and - or k1, r8 ! Block all interrupts, may release FPU + stc sr, r8 ! Back to normal register bank, and + or k1, r8 ! Block all interrupts mov.l 5f, k1 - and k1, r8 ! ... - ldc r8, sr ! ...changed here. + and k1, r8 ! ... + ldc r8, sr ! ...changed here. ! mov.l r7, @-r15 mov.l r6, @-r15 @@ -831,9 +730,7 @@ handle_exception: nop .align 2 1: .long SYMBOL_NAME(exception_handling_table) -2: .long 0x00008000 ! FD=1 3: .long 0x000000f0 ! FD=0, IMASK=15 -4: .long 0x000080f0 ! FD=1, IMASK=15 5: .long 0xcfffffff ! RB=0, BL=0 6: .long 0x00080000 ! SZ=0, PR=1 Index: arch/sh/kernel/fpu.c =================================================================== RCS file: /cvsroot/linuxsh/linux/arch/sh/kernel/fpu.c,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 fpu.c --- arch/sh/kernel/fpu.c 2001/10/15 20:44:48 1.1.1.1 +++ arch/sh/kernel/fpu.c 2001/12/20 02:51:09 @@ -181,102 +181,12 @@ do_fpu_state_restore(unsigned long r4, u { struct task_struct *tsk = current; - if (!user_mode(®s)) { - if (tsk != &init_task) { - unlazy_fpu(tsk); - } - tsk = &init_task; - if (tsk->flags & PF_USEDFPU) { - /* - * This weird situation can be occurred. - * - * There's race condition in __cli: - * - * (1) SR --> register - * (2) Set IMASK of register - * (3) SR <-- register - * - * Between (1) and (2), or (2) and (3) getting - * interrupt, and interrupt handler (or - * softirq) may use FPU. - * - * Then, SR.FD is overwritten by (3). - * - * This results init_task.PF_USEDFPU is on, - * with SR.FD == 1. - * - */ - release_fpu(); - return; - } - } - grab_fpu(); - if (tsk->used_math) { - /* Using the FPU again. */ - restore_fpu(tsk); - } else { - /* First time FPU user. */ - fpu_init(); - tsk->used_math = 1; - } - tsk->flags |= PF_USEDFPU; - release_fpu(); -} - -/* - * Change current FD flag to set FD flag back to exception - */ -asmlinkage void -fpu_prepare_fd(unsigned long sr, unsigned long r5, unsigned long r6, - unsigned long r7, struct pt_regs regs) -{ - __cli(); if (!user_mode(®s)) { - if (init_task.flags & PF_USEDFPU) - grab_fpu(); - else { - if (!(sr & SR_FD)) { - BUG(); - release_fpu(); - } - } + printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); return; } - if (sr & SR_FD) { /* Kernel doesn't grab FPU */ - if (current->flags & PF_USEDFPU) - grab_fpu(); - else { - if (init_task.flags & PF_USEDFPU) { - /* - * This weird situation can be occurred. - * See the comment in do_fpu_state_restore. - */ - grab_fpu(); - save_fpu(&init_task); - } - } - } else { - if (init_task.flags & PF_USEDFPU) - save_fpu(&init_task); - else { - BUG(); - release_fpu(); - } - } -} - -/* Short cut for the FPU exception */ -asmlinkage void -enable_fpu_in_danger(void) -{ - struct task_struct *tsk = current; - - if (tsk != &init_task) - unlazy_fpu(tsk); - - tsk = &init_task; if (tsk->used_math) { /* Using the FPU again. */ restore_fpu(tsk); Index: include/asm-sh/processor.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/processor.h,v retrieving revision 1.1.1.1 diff -u -3 -p -r1.1.1.1 processor.h --- include/asm-sh/processor.h 2001/10/15 20:45:10 1.1.1.1 +++ include/asm-sh/processor.h 2001/12/20 02:51:09 @@ -184,7 +184,6 @@ extern void save_fpu(struct task_struct #define unlazy_fpu(tsk) do { \ if ((tsk)->flags & PF_USEDFPU) { \ - grab_fpu(); \ save_fpu(tsk); \ } \ } while (0) -- |
From: NIIBE Y. <gn...@m1...> - 2001-12-20 02:55:13
|
Here's a patch to implement non-cached mmap. 2001-12-20 Takashi Yoshii <yos...@hi...> * include/asm-sh/pgtable.h (pgprot_noncached): Defined and implemented. Index: include/asm-sh/pgtable.h =================================================================== RCS file: /cvsroot/linuxsh/linux/include/asm-sh/pgtable.h,v retrieving revision 1.2 diff -u -3 -p -r1.2 pgtable.h --- include/asm-sh/pgtable.h 2001/12/03 22:15:35 1.2 +++ include/asm-sh/pgtable.h 2001/12/20 02:51:09 @@ -237,6 +237,19 @@ static inline pte_t pte_mkyoung(pte_t pt static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } /* + * Macro and implementation to make a page protection as uncachable. + */ +#define pgprot_noncached pgprot_noncached + +static inline pgprot_t pgprot_noncached(pgprot_t _prot) +{ + unsigned long prot = pgprot_val(_prot); + + prot &= ~_PAGE_CACHABLE; + return __pgprot(prot); +} + +/* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. * -- |
From: NIIBE Y. <gn...@m1...> - 2001-12-20 01:29:17
|
Jeremy Siegel wrote: > Is there a reason not to apply the following patches for these? Not at all. Please do commit. > /* > * handle an instruction that does an unaligned memory access > * - have to be careful of branch delay-slot instructions that fault > + * SH3: > * - if the branch would be taken PC points to the branch > * - if the branch would not be taken, PC points to delay-slot > + * SH4: > + * - PC always points to delayed branch > * - return 0 if handled, -EFAULT if failed (may not return if in kernel) > */ I think that SH-4 was not on the focus at that time. I have a comment on the expressions calculating PC. It's OK, but it would be good if we can improve the implementation. > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; [...] > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; [...] > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; [...] > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; We want something like "ext.b" or "ext.w" (of SuperH assembler) here. In general, it's not good practice using type coercion to do the calculation. -- |
From: Mitch D. <mj...@al...> - 2001-12-19 13:46:19
|
Please see "pre10": http://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.1 Nice going Niibe-san! |
From: Jeremy S. <js...@mv...> - 2001-12-19 01:59:47
|
Hi folks, I'm copying the gdb stub from sh-ipl+g into the kernel to allow kernel debugging w/o depending on the bootloader; in the process I came across what seem to be some problems handling bad pointers in the kernel code, and in handling unaligned accesses in delay slots. Is there a reason not to apply the following patches for these? (I don't have the whole KGDB thing ready yet, but I've tested these patches at least.) --Jeremy Siegel |
From: Jesper S. <js...@re...> - 2001-12-18 08:03:34
|
On Mon, 2001-12-17 at 23:50, sibusiso xolo wrote: > Greetings, > > This is my first posting. My question may be a bit newbie-ish, > indeed the answer is probably quite old., (but how is one to learn?). > > Here goes:- > Can ppp be implemented using the onbard serial port on the 7750 and > if it has been, could someone offer a link? It has and it can. All you need to do is get pppd working. I'm sure there's HOWTOs for that. Jesper |