Clarification in Lecture 18 alltraps definition

21 views
Skip to first unread message

Santosh K P

unread,
Mar 15, 2021, 3:46:58 PM3/15/21
to Discussion forum for Operating System
Hello,

In trapasm.s, in definition of alltraps , there're 2 consecutive instructions
pushl %esp
call trap

In Lecture 18(46:41), it's mentioned that the esp is being pushed because pushal doesn't push esp register.
But following document says that pushal also pushes esp register.

It seems the purpose of the statement pushl %esp is to provide argument (in accordance with gcc function calling conventions) to trap()(in file trap.c), which takes trapframe pointer as an argument

Can you please confirm if this is correct?

Sincerely,
Santosh K P

Parth Dhar

unread,
Mar 24, 2021, 7:43:32 PM3/24/21
to Discussion forum for Operating System, santos...@gmail.com
Yes, that is indeed correct. A comment from the same line from the latest version of the code listing (https://iitd.github.io/os/nptel21/xv6.pdf):

# Call trap(tf), where tf=%esp
pushl %esp
call trap
Reply all
Reply to author
Forward
0 new messages