Variable "machine" in start.c - Minix

This is a discussion on Variable "machine" in start.c - Minix ; Hi All, Where is "machine" defined that is being referenced start.c? I see a couple of definitions in tty.c and memory.c but I think there should not be any direct linkages between kernel and memory driver/tty driver. Regards, Kashyap...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Variable "machine" in start.c

  1. Variable "machine" in start.c

    Hi All,
    Where is "machine" defined that is being referenced start.c?
    I see a couple of definitions in tty.c and memory.c but I think there
    should not be any direct linkages between kernel and memory driver/tty
    driver.
    Regards,
    Kashyap

  2. Re: Variable "machine" in start.c

    "kashyap" wrote ...
    > Where is "machine" defined that is being referenced by "start.c"?
    > I see a couple of definitions in "tty.c" and "memory.c", but I think there
    > should not be any direct linkages between kernel and memory-driver/tty-
    > driver.


    It is declared by "/usr/src/kernel/glo.h",
    and defined by "/usr/include/minix/type.h".


  3. Re: Variable "machine" in start.c

    On Aug 27, 9:14 am, "Greg King" wrote:
    > "kashyap" wrote ...
    >
    > > Where is "machine" defined that is being referenced by "start.c"?
    > > I see a couple of definitions in "tty.c" and "memory.c", but I think there
    > > should not be any direct linkages between kernel and memory-driver/tty-
    > > driver.

    >
    > It is declared by "/usr/src/kernel/glo.h",
    > and defined by "/usr/include/minix/type.h".


    Thank you for the quick response.
    Well, in glo.h, we have
    EXTERN struct machine machine;
    and in
    type.h, the structure is defined
    struct machine {
    int pc_at;
    int ps_mca;
    int processor;
    int protected;
    int vdu_ega;
    int vdu_vga;
    };

    What I am really looking for is the definition of the variable machine
    of type struct machine! Where is that defined? type.h contains the
    definition of the structure itself and not an "instance" variable
    machine.


  4. Re: Variable "machine" in start.c

    kashyap wrote:

    > What I am really looking for is the definition of the variable machine
    > of type struct machine! Where is that defined? type.h contains the
    > definition of the structure itself and not an "instance" variable
    > machine.


    It _is_ defined in glo.h: glo.h lists all global variables, prefixed with
    the EXTERN macro. All C files needing to reference global variables
    include glo.h with the EXTERN macro being defined as "extern". The
    exception is table.c, which will define the EXTERN macro as "" (empty
    string). This way, the compiler will allocate all those variables when it
    compiles table.c into table.o and the linker will resolve all references
    when the object fiels are linked together into the executable.

    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

  5. Re: Variable "machine" in start.c

    > It _is_ defined in glo.h: glo.h lists all global variables, prefixed with
    > the EXTERN macro. All C files needing to reference global variables
    > include glo.h with the EXTERN macro being defined as "extern". The
    > exception is table.c, which will define the EXTERN macro as "" (empty
    > string). This way, the compiler will allocate all those variables when it
    > compiles table.c into table.o and the linker will resolve all references
    > when the object fiels are linked together into the executable.


    OH!!!!!!!!!! ... I get it, Thank you very much.

    Regards,
    Kashyap

  6. Re: Variable "machine" in start.c

    "J.F. de Smit" wrote ...
    >
    > It _is_ defined in glo.h: glo.h lists all global variables, prefixed with
    > the EXTERN macro. All C files needing to reference global variables
    > include glo.h, with the EXTERN macro being defined as "extern". The
    > exception is table.c, which will define the EXTERN macro as "" (empty
    > string). That way, the compiler will allocate all those variables when it
    > compiles table.c into table.o, and the linker will resolve all references
    > when the object fields are linked together into the executable.


    When you need to be reminded about what Jens described, read the comments at
    the beginning of "glo.h" and "table.c".


  7. Re: Variable "machine" in start.c

    On Aug 27, 9:01 pm, "Greg King" wrote:
    > "J.F. de Smit" wrote ...
    >
    >
    >
    > > It _is_ defined in glo.h: glo.h lists all global variables, prefixed with
    > > the EXTERN macro. All C files needing to reference global variables
    > > include glo.h, with the EXTERN macro being defined as "extern". The
    > > exception is table.c, which will define the EXTERN macro as "" (empty
    > > string). That way, the compiler will allocate all those variables when it
    > > compiles table.c into table.o, and the linker will resolve all references
    > > when the object fields are linked together into the executable.

    >
    > When you need to be reminded about what Jens described, read the comments at
    > the beginning of "glo.h" and "table.c".


    Will do

+ Reply to Thread