how does retu() switch new process's ppda? - Unix

This is a discussion on how does retu() switch new process's ppda? - Unix ; All, I've reading "Unix operating system source code level six". How does retu achieve switching to new process's ppda? The source code is below: 1. Line 743: move parameter to r0, but line 744 use 140000 to overwrite r0. Why?(I ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: how does retu() switch new process's ppda?

  1. how does retu() switch new process's ppda?

    All,

    I've reading "Unix operating system source code level six". How does retu
    achieve switching to new process's ppda? The source code is below:

    1. Line 743: move parameter to r0, but line 744 use 140000 to overwrite r0.
    Why?(I know KISA6 is point to this page).

    Then how do line 746 and 747 know current ppda is for new process?

    2. The only difference between aretu and retu is line 744. What does this line mean?

    Thanks,
    Hunter
    =====


    734 _aretu:
    0735 bis $340,PS
    0736 mov (sp)+,r1
    0737 mov (sp),r0
    0738 br 1f
    0739
    0740 _retu:
    0741 bis $340,PS
    0742 mov (sp)+,r1
    0743 mov (sp),r0
    0744 mov $_u,r0
    0745 1:
    0746 mov (r0)+,sp
    0747 mov (r0)+,r5
    0748 bic $340,PS
    0749 jmp (r1)
    */


  2. Re: how does retu() switch new process's ppda?

    According to


    There's error at line 743. Should be
    mov (sp),KISA6.

    If so, then I understand how to switch new process; if not, where to set r0 to
    be KISA6?


    On 5/29/2008 9:47 AM, Hunter Hou wrote:
    > All,
    >
    > I've reading "Unix operating system source code level six". How does retu
    > achieve switching to new process's ppda? The source code is below:
    >
    > 1. Line 743: move parameter to r0, but line 744 use 140000 to overwrite r0.
    > Why?(I know KISA6 is point to this page).
    >
    > Then how do line 746 and 747 know current ppda is for new process?
    >
    > 2. The only difference between aretu and retu is line 744. What does this line mean?
    >
    > Thanks,
    > Hunter
    > =====
    >
    >
    > 734 _aretu:
    > 0735 bis $340,PS
    > 0736 mov (sp)+,r1
    > 0737 mov (sp),r0
    > 0738 br 1f
    > 0739
    > 0740 _retu:
    > 0741 bis $340,PS
    > 0742 mov (sp)+,r1
    > 0743 mov (sp),r0
    > 0744 mov $_u,r0
    > 0745 1:
    > 0746 mov (r0)+,sp
    > 0747 mov (r0)+,r5
    > 0748 bic $340,PS
    > 0749 jmp (r1)
    > */
    >



  3. Re: how does retu() switch new process's ppda?

    Hunter Hou wrote:
    > According to
    >
    >
    > There's error at line 743. Should be
    > mov (sp),KISA6.


    My hard copy of the Lion's book has
    0743 mov (sp),KISA6

    > If so, then I understand how to switch new process; if not, where to set r0 to
    > be KISA6?
    >
    >
    > On 5/29/2008 9:47 AM, Hunter Hou wrote:
    >>
    >> 734 _aretu:
    >> 0735 bis $340,PS
    >> 0736 mov (sp)+,r1
    >> 0737 mov (sp),r0
    >> 0738 br 1f
    >> 0739
    >> 0740 _retu:
    >> 0741 bis $340,PS
    >> 0742 mov (sp)+,r1
    >> 0743 mov (sp),r0
    >> 0744 mov $_u,r0
    >> 0745 1:
    >> 0746 mov (r0)+,sp
    >> 0747 mov (r0)+,r5
    >> 0748 bic $340,PS
    >> 0749 jmp (r1)
    >> */
    >>

    >


+ Reply to Thread