Re: [PATCH] Cyrix setup

Paul Gortmaker (linux@rasty.ph.unimelb.edu.au)
Tue, 10 Mar 1998 18:46:25 +1100 (EST)


> > If set6x86 really optimizes something, you'll need to recalculate
> > bogomips - which is something that can not be done from userland.
>
> Thats a good point, and maybe we should support a recalc_bogomips
> in the linux magic ioctl collection
>
> Alan

I think I brought this up several years back when I wrote the 1st user space
cyrix enable program (for the i386 DLC/SLC pin compatible chips). However
back then udelay() wasn't used that much and so I guess nobody thought it
was too important (myself included).

Anyway, assemble/link the following "recal.s" and also apply the
following diff (2.1.89) if there is a demand for such a syscall.

Paul.

(build with "as -o recal.o recal.s ; ld -s recal.o -o recal")

---------- recal.s -----------
.globl _start
_start:
movl $183,%eax # sys_recalibrate_delay
int $0x80
movl %eax,%ebx # return value
movl $1,%eax # exit(%ebx)
int $0x80
-------------------------------

--- linux/kernel/sys.c.orig Sun Nov 30 20:34:44 1997
+++ linux/kernel/sys.c Tue Mar 10 14:00:50 1998
@@ -85,6 +85,30 @@
return 0;
}

+/*
+ * Some user space programs twiddle CPU specific registers to get
+ * better performance. However this means that the loops_per_sec may
+ * no longer be correct, and thus udelay(x) will no longer delay for
+ * the correct amount of time. (Added 03/98, Paul Gortmaker)
+ */
+
+extern void calibrate_delay(void);
+
+asmlinkage int sys_recalibrate_delay(void)
+{
+ unsigned long old_policy = current->policy;
+ unsigned long old_priority = current->rt_priority;
+
+ if (!suser())
+ return -EPERM;
+ current->policy = SCHED_FIFO;
+ current->rt_priority = 99;
+ calibrate_delay();
+ current->rt_priority = old_priority;
+ current->policy = old_policy;
+ return 0;
+}
+
asmlinkage int sys_setpriority(int which, int who, int niceval)
{
struct task_struct *p;
--- linux/arch/i386/kernel/entry.S.orig Wed Feb 25 06:24:35 1998
+++ linux/arch/i386/kernel/entry.S Tue Mar 10 13:56:59 1998
@@ -533,7 +533,8 @@
.long SYMBOL_NAME(sys_pread) /* 180 */
.long SYMBOL_NAME(sys_pwrite)
.long SYMBOL_NAME(sys_chown)
+ .long SYMBOL_NAME(sys_recalibrate_delay)

- .rept NR_syscalls-182
+ .rept NR_syscalls-183
.long SYMBOL_NAME(sys_ni_syscall)
.endr
--- linux/init/main.c.orig Wed Feb 25 17:26:05 1998
+++ linux/init/main.c Tue Mar 10 14:13:10 1998
@@ -819,7 +819,7 @@
better than 1% */
#define LPS_PREC 8

-__initfunc(void calibrate_delay(void))
+void calibrate_delay(void)
{
unsigned long ticks, loopbit;
int lps_precision = LPS_PREC;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu