Variable "machine" in start.c

This is a discussion on Variable "machine" in start.c within the Minix forums, part of the Other OS category; 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 ...

Go Back   Unix Linux Forum > Unix > Other OS > Minix

FixUnix.com - Unix Linux Forums

Unix Content Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-26-2008, 01:59 PM
Default 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
Reply With Quote
  #2  
Old 08-27-2008, 12:14 AM
Default 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".

Reply With Quote
  #3  
Old 08-27-2008, 02:49 AM
Default 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.

Reply With Quote
  #4  
Old 08-27-2008, 03:45 AM
Default 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
Reply With Quote
  #5  
Old 08-27-2008, 04:09 AM
Default 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
Reply With Quote
  #6  
Old 08-27-2008, 12:01 PM
Default 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".

Reply With Quote
  #7  
Old 09-01-2008, 06:11 AM
Default 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 With Quote
Reply

Thread Tools


All times are GMT -5. The time now is 01:40 AM.

In an effort to better serve ads to our visitors, cookies are used on Fixunix.com. For more information, check out our Privacy Policy.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Ad Management by RedTyger