- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Chapter 9TRAP Routines andSubroutines.ppt
Chapter 9TRAP Routines andSubroutines System Calls Certain operations require specialized knowledgeand protection: specific knowledge of I/O device registersand the sequence of operations needed to use them I/O resources shared among multiple users/programs;a mistake could affect lots of other users! Not every programmer knows (or wants to know)this level of detail Provide service routines or system calls(part of operating system) to safely and convenientlyperform low-level, privileged operations System Call 1. User program invokes system call. 2. Operating system code performs operation. 3. Returns control to user program. LC-3 TRAP Mechanism 1. A set of service routines. part of operating system -- routines start at arbitrary addresses(convention is that system code is below x3000) up to 256 routines 2. Table of starting addresses. stored at x0000 through x00FF in memory called System Control Block in some architectures 3. TRAP instruction. used by program to transfer control to operating system 8-bit trap vector names one of the 256 service routines 4. A linkage back to the user program. want execution to resume immediately after the TRAP instruction TRAP Instruction Trap vector identifies which system call to invoke 8-bit index into table of service routine addresses in LC-3, this table is stored in memory at 0x0000 – 0x00FF 8-bit trap vector is zero-extended into 16-bit memory address Where to go lookup starting address from table; place in PC How to get back save address of next instruction (current PC) in R7 TRAP RET (JMP R7) How do we transfer control back toinstruction following the TRAP? We saved old PC in R7. JMP R7 gets us back to the user program at the right spot. LC-3 assembly language lets us use RET (return)in place of “JMP R7”. Must make sure that service routine does not change R7, or we won’t know where to return. TRAP Mechanism Operation Example: Using the TRAP Instruction .ORIG x3000 LD R2, TERM ; Load negative ASCII ‘7’
您可能关注的文档
- A Dialogue in the Hospital.ppt
- a doctor.ppt
- A Proposal for NAEFS 8-14-day Forecasts.ppt
- A+标准制定的背景.ppt
- A.B.L.M.C.C HISTORY PORJECT.ppt
- a.归纳本文的情节发展步骤。.ppt
- A={4,5,6,8}B={3,5,7,8}C={5,8}.ppt
- AAA EVAR手术病例.ppt
- AAS and FES(Ch 9, 7th e, WMDS).PPT
- ABAQUS非线性用户单元的开发.ppt
- Chapter Extension 7.ppt
- Chapter Four.ppt
- Chapter FourteenThe sixties and seventies.ppt
- Chapter Nine Checking Out.ppt
- Chapter Seven.Overview of Chapter 7.PPT
- Chapter10Operational Amplifier Applications.ppt
- Chapter15 精确模型.ppt
- Chapters 8Network Security.ppt
- Chapters 9 - 10.Check out and Accounts Settlement.ppt
- Chapters 9 - 10.ppt
最近下载
- Korn-Ferry-方案-构建成功者画像.pdf VIP
- 铭记抗战历史,弘扬爱国精神——纪念抗日战争胜利八十周年主题班会.pptx VIP
- 扣押决定书文书范本.doc VIP
- 人民大2024现代大学美育 教学课件认识美——万物皆美(第一章 美是什么)(1).pptx VIP
- 人民大2024现代大学美育 教学课件认识美——万物皆美(第二章 何为美育)(1).pptx VIP
- 项目策划培训课件.ppt VIP
- 人民大2024现代大学美育 教学课件艺术美——美美与共(第十一章造型艺术美)(陈琳、刘晓晓).pptx VIP
- 大学美育课件:中国艺术美-音乐美.pptx VIP
- 文化旅游项目策划报告.pptx VIP
- 大学美育课件:中国艺术美-绘画美.pptx VIP
文档评论(0)