Hi,

I am stumped by the bss declaration on page 82.
 .section .bss
.equ BUFFER_SIZE, 500
.lcomm BUFFER_DATA, BUFFER_SIZE

My question is:
 How can BUFFER_SIZE be both a label and a constant? How is it possible for the 
assembler (and programmers) to tell them apart?
I have not assembled this code to test-run it yet. Or is the author economical 
and he should have written it like so:
...
.lcomm BUFFER_DATA
.lcomm BUFFER_SIZE, 500

And I think the text has a concept bug, too. On page 82, we have this line of 
code:
#Check for end of file marker
cmpl $END_OF_FILE, %eax

which he explains in the last line of page 92: The system call returns the 
number of bytes actually read, or end -of-file (the number 0).
For beginners like me, this is utter nonsense. I tore my hair over this 
explanation for quite a while wondering how Linux could return the end of file 
(\0) number to eax while all it does is return the number of bytes read from 
the 
input file. I think this line of text should read like this: The system call 
returns the number of bytes actually read, and when there are not any bytes 
left 
to read, Linux returns the number zero to eax, which signals end-of-file is 
reached. (I am sorry English is not my mother tounge. But the line should read 
close to this effect)

Thank you.


      
_______________________________________________
Pgubook-readers mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/pgubook-readers

Reply via email to