What's the purpose of 上 in "王教授给那儿的学生上英国文学课, 他课上得非常好"? What's the purpose of 上 in the following sentence?

王教授给那儿的学生上英国文学课, 他课上得非常好, 学生都很喜欢她的课

Although I understand 上 can mean &quot;to attend (class)&quot;, I don't see how that fits in the above example.
In the first part of the sentence (王教授给那儿的学生上英国文学课), the only other verb is 给. There is no verb meaning &quot;to teach&quot;. Thus, in this case can 上 mean &quot;to teach&quot;?
In the middle part of the sentence (他课上得非常好), what is the meaning of 上? Does it just mean &quot;to go&quot; as in &quot;The class went very well&quot;?
So I checked Cihai and it specifically says 上課 goes both ways:

教師講課或學生聽課 
To teach a class, or to attend a class

The subject is 'Professor Wang' (王教授). The verb is 'to teach' (上, note: only makes sense when seeing 上課 together), the direct object is 'a lesson' (課), and the indirect object is 'those students' (那兒的學生), which in Chinese is marked by a second verb literally meaning 'to give' (給).
The second 上 still means 'to teach', with the direct object understood and omitted.