A question about the source code organization - Minix

This is a discussion on A question about the source code organization - Minix ; I am studying the minix source code, the version I used was the "current" which can be downloaded from http://www.minix3.org/download/minix-src-current.tar.gz I got a question when I am studying: According to the directory organization, I guess all C files in $(MINIX)/kernel/ ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: A question about the source code organization

  1. A question about the source code organization

    I am studying the minix source code, the version I used was the
    "current" which can be downloaded from
    http://www.minix3.org/download/minix-src-current.tar.gz

    I got a question when I am studying:
    According to the directory organization, I guess
    all C files in $(MINIX)/kernel/ were architecture-indepent and
    others in $(MINIX)/kernel/arch/i386 were arch-depent.

    However, there was a piece of code from line 146 of
    $(MINIX)/kernel/main.c (which was expected to be arch-indepent)

    rp->p_reg.pc = (reg_t) ip->initial_pc;
    rp->p_reg.psw = (iskernelp(rp)) ? INIT_TASK_PSW : INIT_PSW;

    I thought it was arch-depent. Would it do harm to portability?
    After all different arch had different register-groups.
    Thanks.


  2. Re: A question about the source code organization

    RobinShi@viatech.com.cn wrote:
    > I am studying the minix source code, the version I used was the
    > "current" which can be downloaded from
    > http://www.minix3.org/download/minix-src-current.tar.gz


    > I got a question when I am studying:
    > According to the directory organization, I guess
    > all C files in $(MINIX)/kernel/ were architecture-indepent and
    > others in $(MINIX)/kernel/arch/i386 were arch-depent.


    > However, there was a piece of code from line 146 of
    > $(MINIX)/kernel/main.c (which was expected to be arch-indepent)


    > rp->p_reg.pc = (reg_t) ip->initial_pc;
    > rp->p_reg.psw = (iskernelp(rp)) ? INIT_TASK_PSW : INIT_PSW;


    > I thought it was arch-depent. Would it do harm to portability?
    > After all different arch had different register-groups.


    Hi,

    First, it is perfectly possible that not all architecture-dependent code
    has been found and ported yet. However, I think it more likely that the
    author of this code guessed that any conventional CPU should at least have
    a program counter and a processor status word, and thus concluded that
    this code is generic enough to put in the architecture-independent part of
    MINIX. Actually accessing these registers is something else of course,
    that would be part of the arch-independent code.

    Regards,

    Jens


    --
    Jens de Smit
    Student Computer Science | Vrije Universiteit Amsterdam
    jfdsmit@few.vu.nl | http://www.few.vu.nl/~jfdsmit
    "[In the end, people] get furious at IT that the goddamn magic isn't working"
    -- Stewart Dean

+ Reply to Thread