1

I stumbled upon on the following instructions found in src/lib/i386/rts/_sendrec.s

At the very beginning, the following statements are written out.

SEND = 1

RECEIVE = 2

BOTH = 3

SYSVEC = 33

SRCDEST = 8
MESSAGE = 12

How do I interpret the above statments? For example, SRCDEST = 8, should I read it as SRCDEST has a value of 8. If it does, the following statement do not make any sense to me. If not, what are SRCDEST, MESSAGE, BOTH? are they built-in functions? If yes, where are they defined in the .s file?

Based on the comments, eax = dest-src. What are the values of dest and src? ebx = message pointer. Does that mean ebx is a reference to the base pointer? As for mov ecx, BOTH ! _sendrec(srcdest, ptr), what exactly is going on here? appreciate if anyone can shed some light on the following statements or point me a link or two. have been looking up the web for days and has no luck finding the info. thank you for your time.

__sendrec:

mov eax, SRCDEST(ebp)   ! eax = dest-src

mov ebx, MESSAGE(ebp)   ! ebx = message pointer

mov ecx, BOTH       ! _sendrec(srcdest, ptr)
Gabe
  • 84,912
  • 12
  • 139
  • 238
comp101
  • 21
  • 2

1 Answers1

2

SEND, RECEIVE, and BOTH are constants having values 1, 2, and 3 respectively. They represent the operation you are performing (1 means "send", 2 means "receive", and 3 means both "send and receive").

The SRCDEST and MESSAGE constants are offsets on the stack where the values representing the source/destination and message are stored.

SYSVEC is the interrupt number.

Gabe
  • 84,912
  • 12
  • 139
  • 238
  • thank you for your quick response. SEND, RECEIVE, and BOTH are constants having values 1, 2, and 3 respectively and 3 means both send and receive. "move ecx, BOTH" means the counter register has a value of 3 or an operation that both send and receive. have a hard time to make sense out of it when putting the pieces together. – comp101 Jul 10 '12 at 05:38
  • Yes, `mov ecx, BOTH` puts the value 3 in ECX. Don't think of it as "the counter register", as it's not always used for counting. In this case it's just used to tell the kernel if it should send or receive. – Gabe Jul 10 '12 at 05:50
  • thank you for solving this part for me. have not read into the kernel coding yet. So I assume when mov ecx, BOTH is exceuted, the kernel will check the value held in the ecx. If the value is 3, the kernel will perform the send and receive operation. So SRCDEST(ebp) or MESSAGE(ebp) is a syntax that indicates the offsets from the base pointer, not the frame pointer on the stack where the values representing the source/destination and message are stored. – comp101 Jul 10 '12 at 06:20