Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Aug 1999 22:20:13 +0800
From:      Peter Wemm <peter@netplex.com.au>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        alpha@FreeBSD.ORG
Subject:   Re: cpu_switch() help needed.. 
Message-ID:  <19990818142013.9A5181CA1@overcee.netplex.com.au>
In-Reply-To: Your message of "Wed, 18 Aug 1999 09:37:30 -0400." <14266.46516.691196.39030@grasshopper.cs.duke.edu> 

next in thread | previous in thread | raw e-mail | index | archive | help
Andrew Gallatin wrote:
> 
> Peter Wemm writes:
>  > I need some help to hook some routines into alpha/swtch.s, but I don't kno
    w
>  > alpha assembler well enough.  I can guess and try and figure it out myself
    ,
>  > but I'd rather enlist the help of an expert. :-)  I can supply
>  > corresponding patches for the x86 (basically delete large chunks of code
>  > and replace it with calls to a C routine), but I don't know the calling
>  > conventions and implications of side effects for the Alpha. On the x86, th
    e
>  > side effects of the registers clobbered by the C code were harmless.
>  > 
>  > I believe Doug is still in transit to/from SIGGRAPH or something.  Can any
>  > of the other lurkers help?  (Andrew? :-).
>  > 
>  > Cheers,
>  > -Peter
> 
> What exactly are you trying to do?  I might be able to help, but I
> must admit that I haven't used alpha assembler much myself & am
> probably at about your skill level with alpha assembler.

I've implemented this on the x86 - moving the next-process selection out
of assembler and into a simple C routine, leaving cpu_switch() to just do
context saving and restoring.

It basically boils down to changing about 150 or so lines of assembler to
this:

sw1:
        cli

sw1a:   
!       call    _chooseproc                     /* trash ecx, edx, ret eax*/ 
!       testl   %eax,%eax
        CROSSJUMP(je, _idle, jne)               /* if no proc, idle */
        movl    %eax,%ecx

Then we can do things like per-cpu run queues, affinity, various policy
hacks etc without the nightmare of having to implement the bottom end
in assembler for each arch.

This, incidently, would mean we got idle and realtime scheduling for free
on the alpha without having to implement that in assembler.  Presently if
you start an idle or rtprio process on the alpha, the system comes to a
screeching halt as they never run and you end up with deadlocks.

I just need to know how to call a C function and how to make sure it's
not going to clobber what we're using.

Cheers,
-Peter



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990818142013.9A5181CA1>