| Unix Content | Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
|
| 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
|
| "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
|
| On Aug 27, 9:14 am, "Greg King" > "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
|
| kashyap > 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
|
| > 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
|
| "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
|
| On Aug 27, 9:01 pm, "Greg King" > "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 |