max_stars_repo_path
stringlengths 4
261
| max_stars_repo_name
stringlengths 6
106
| max_stars_count
int64 0
38.8k
| id
stringlengths 1
6
| text
stringlengths 7
1.05M
|
---|---|---|---|---|
_server/blockly/MotaAction.g4 | onekb/mota-js | 0 | 2876 | grammar MotaAction;
//===============parser===============
//===blockly语句===
//事件 事件编辑器入口之一
event_m
: '事件' BGNL? Newline '覆盖触发器' Bool '启用' Bool '通行状态' B_0_List '动画' Bool '显伤' Bool BGNL? Newline action+ BEND
/* event_m
tooltip : 编辑魔塔的事件
helpUrl : https://h5mota.com/games/template/docs/#/event
default : [false,null,null,null,null]
B_0_List_0=eval(B_0_List_0);
var code = {
'trigger': Bool_0?'action':null,
'enable': Bool_1,
'noPass': B_0_List_0,
'animate': Bool_2,
'displayDamage': Bool_3,
'data': 'data_asdfefw'
}
if (!Bool_0 && Bool_1 && (B_0_List_0===null) && Bool_2 && Bool_3) code = 'data_asdfefw';
code=JSON.stringify(code,null,2).split('"data_asdfefw"').join('[\n'+action_0+']\n');
return code;
*/;
//升级 事件编辑器入口之一
level_m
: '等级提升' BGNL? Newline levelCase+ BEND
/* level_m
tooltip : 升级事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%bb%8f%e9%aa%8c%e5%8d%87%e7%ba%a7%ef%bc%88%e8%bf%9b%e9%98%b6%2f%e5%a2%83%e7%95%8c%e5%a1%94%ef%bc%89
var code = '[\n'+levelCase_0+']\n';
return code;
*/;
levelCase
: '需求' expression '称号' EvalString? '是否扣除经验' Bool BGNL? Newline action+
/* levelCase
tooltip : 升级设定
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%bb%8f%e9%aa%8c%e5%8d%87%e7%ba%a7%ef%bc%88%e8%bf%9b%e9%98%b6%2f%e5%a2%83%e7%95%8c%e5%a1%94%ef%bc%89
default : [0,"",false,null]
colour : this.subColor
Bool_0 = Bool_0?', "clear": true':'';
var code = '{"need": "'+expression_0+'", "title": "'+EvalString_0+'"'+Bool_0+', "action": [\n'+action_0+']},\n';
return code;
*/;
//商店 事件编辑器入口之一
shop_m
: '全局商店列表' BGNL? Newline shoplist+
/* shop_m
tooltip : 全局商店列表
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
var code = '['+shoplist_0+']\n';
return code;
*/;
shoplist
: shopsub
| emptyshop
;
emptyshop
: Newline
/* emptyshop
var code = ' \n';
return code;
*/;
shopsub
: '商店 id' IdString '标题' EvalString '图标' IdString BGNL? Newline '快捷商店栏中名称' EvalString '共用times' Bool BGNL? Newline '未开启状态则不显示在列表中' Bool BGNL? NewLine '使用' ShopUse_List '消耗' EvalString BGNL? Newline '显示文字' EvalString BGNL? Newline shopChoices+ BEND
/* shopsub
tooltip : 全局商店,消耗填-1表示每个选项的消耗不同,正数表示消耗数值
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
default : ["shop1","贪婪之神","blueShop","1F金币商店",false,false,null,"20+10*times*(times+1)","勇敢的武士啊, 给我${need}金币就可以:"]
var code = {
'id': IdString_0,
'name': EvalString_0,
'icon': IdString_1,
'textInList': EvalString_1,
'commonTimes': Bool_0,
'mustEnable': Bool_1,
'use': ShopUse_List_0,
'need': EvalString_2,
'text': EvalString_3,
'choices': 'choices_asdfefw'
}
code=JSON.stringify(code,null,2).split('"choices_asdfefw"').join('[\n'+shopChoices_0+']\n')+',\n';
return code;
*/;
shopChoices
: '商店选项' EvalString '消耗' EvalString? BGNL? Newline shopEffect+
/* shopChoices
tooltip : 商店选项,商店消耗是-1时,这里的消耗对应各自选项的消耗,商店消耗不是-1时这里的消耗不填
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e5%85%a8%e5%b1%80%e5%95%86%e5%ba%97
default : ["攻击+1",""]
colour : this.subColor
EvalString_1 = EvalString_1 && (', "need": "'+EvalString_1+'"');
var code = '{"text": "'+EvalString_0+'"'+EvalString_1+', "effect": "'+shopEffect_0.slice(2,-1)+'"},\n';
return code;
*/;
shopEffect
: idString_e '+=' expression
/* shopEffect
colour : this.subColor
var code = idString_e_0+'+='+expression_0+';'
return code;
*/;
//afterBattle 事件编辑器入口之一
afterBattle_m
: '战斗结束后' BGNL? Newline action+ BEND
/* afterBattle_m
tooltip : 系统引发的自定义事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n';
return code;
*/;
//afterGetItem 事件编辑器入口之一
afterGetItem_m
: '获取道具后' BGNL? Newline action+ BEND
/* afterGetItem_m
tooltip : 系统引发的自定义事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n';
return code;
*/;
//afterOpenDoor 事件编辑器入口之一
afterOpenDoor_m
: '打开门后' BGNL? Newline action+ BEND
/* afterOpenDoor_m
tooltip : 系统引发的自定义事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n';
return code;
*/;
//firstArrive 事件编辑器入口之一
firstArrive_m
: '首次到达楼层' BGNL? Newline action+ BEND
/* firstArrive_m
tooltip : 首次到达楼层
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n';
return code;
*/;
//eachArrive 事件编辑器入口之一
eachArrive_m
: '每次到达楼层' BGNL? Newline action+ BEND
/* eachArrive_m
tooltip : 每次到达楼层
helpUrl : https://h5mota.com/games/template/docs/#/event?id=%e7%b3%bb%e7%bb%9f%e5%bc%95%e5%8f%91%e7%9a%84%e8%87%aa%e5%ae%9a%e4%b9%89%e4%ba%8b%e4%bb%b6
var code = '[\n'+action_0+']\n';
return code;
*/;
//changeFloor 事件编辑器入口之一
changeFloor_m
: '楼梯, 传送门' BGNL? Newline Floor_List IdString? Stair_List 'x' Number ',' 'y' Number '朝向' DirectionEx_List '动画时间' Int? '允许穿透' Bool BEND
/* changeFloor_m
tooltip : 楼梯, 传送门, 如果目标楼层有多个楼梯, 写upFloor或downFloor可能会导致到达的楼梯不确定, 这时候请使用loc方式来指定具体的点位置
helpUrl : https://h5mota.com/games/template/docs/#/element?id=%e8%b7%af%e9%9a%9c%ef%bc%8c%e6%a5%bc%e6%a2%af%ef%bc%8c%e4%bc%a0%e9%80%81%e9%97%a8
default : [null,"MT1",null,0,0,null,500,null]
var toFloorId = IdString_0;
if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
Int_0 = (Int_0!=='') ?(', "time": '+Int_0):'';
Bool_0 = Bool_0 ?'':(', "portalWithoutTrigger": false');
var code = '{"floorId": "'+toFloorId+'"'+loc+DirectionEx_List_0+Int_0+Bool_0+' }\n';
return code;
*/;
//commonEvent 事件编辑器入口之一
commonEvent_m
: '公共事件' BGNL? Newline action+ BEND
/* commonEvent_m
tooltip : 公共事件
helpUrl : https://h5mota.com/games/template/docs/#/event
var code = '[\n'+action_0+']\n';
return code;
*/;
//为了避免关键字冲突,全部加了_s
//动作
action
: text_0_s
| text_1_s
| comment_s
| autoText_s
| scrollText_s
| setText_s
| tip_s
| setValue_s
| setFloor_s
| setGlobalAttribute_s
| setGlobalValue_s
| setGlobalFlag_s
| show_s
| hide_s
| trigger_s
| insert_1_s
| insert_2_s
| revisit_s
| exit_s
| setBlock_s
| showFloorImg_s
| hideFloorImg_s
| showBgFgMap_s
| hideBgFgMap_s
| setBgFgBlock_s
| setHeroIcon_s
| update_s
| showStatusBar_s
| hideStatusBar_s
| updateEnemys_s
| sleep_s
| wait_s
| waitAsync_s
| battle_s
| openDoor_s
| changeFloor_s
| changePos_0_s
| changePos_1_s
| useItem_s
| openShop_s
| disableShop_s
| follow_s
| unfollow_s
| animate_s
| vibrate_s
| showImage_s
| hideImage_s
| showTextImage_s
| moveImage_s
| showGif_0_s
| showGif_1_s
| setFg_0_s
| setFg_1_s
| screenFlash_s
| setWeather_s
| move_s
| moveHero_s
| jump_s
| jumpHero_s
| playBgm_s
| pauseBgm_s
| resumeBgm_s
| loadBgm_s
| freeBgm_s
| playSound_s
| stopSound_s
| setVolume_s
| win_s
| lose_s
| if_s
| switch_s
| while_s
| break_s
| continue_s
| input_s
| input2_s
| choices_s
| callBook_s
| callSave_s
| callLoad_s
| function_s
| pass_s
;
text_0_s
: '显示文章' ':' EvalString Newline
/* text_0_s
tooltip : text:显示一段文字(剧情)
helpUrl : https://h5mota.com/games/template/docs/#/event?id=text%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%96%87%E5%AD%97%EF%BC%88%E5%89%A7%E6%83%85%EF%BC%89
default : ["欢迎使用事件编辑器(双击方块进入多行编辑)"]
var code = '"'+EvalString_0+'",\n';
return code;
*/;
text_1_s
: '标题' EvalString? '图像' IdString? '对话框效果' EvalString? ':' EvalString Newline
/* text_1_s
tooltip : text:显示一段文字(剧情),选项较多请右键点击帮助
helpUrl : https://h5mota.com/games/template/docs/#/event?id=text%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%96%87%E5%AD%97%EF%BC%88%E5%89%A7%E6%83%85%EF%BC%89
default : ["小妖精","fairy","","欢迎使用事件编辑器(双击方块进入多行编辑)"]
var title='';
if (EvalString_0==''){
if (IdString_0=='')title='';
else title='\\t['+IdString_0+']';
} else {
if (IdString_0=='')title='\\t['+EvalString_0+']';
else title='\\t['+EvalString_0+','+IdString_0+']';
}
if(EvalString_1 && !(/^(up|down)(,hero)?(,([+-]?\d+),([+-]?\d+))?$/.test(EvalString_1))) {
throw new Error('对话框效果的用法请右键点击帮助');
}
EvalString_1 = EvalString_1 && ('\\b['+EvalString_1+']');
var code = '"'+title+EvalString_1+EvalString_2+'",\n';
return code;
*/;
comment_s
: '添加注释' ':' EvalString Newline
/* comment_s
tooltip : comment:添加一段会被游戏跳过的注释内容
helpUrl : https://h5mota.com/games/template/docs/#/event?id=comment%ef%bc%9a%e6%b7%bb%e5%8a%a0%e6%b3%a8%e9%87%8a
default : ["可以在这里写添加任何注释内容"]
colour : this.commentColor
var code = '{"type": "comment", "text": "'+EvalString_0+'"},\n';
return code;
*/;
autoText_s
: '自动剧情文本: 标题' EvalString? '图像' IdString? '对话框效果' EvalString? '时间' Int BGNL? EvalString Newline
/* autoText_s
tooltip : autoText:自动剧情文本,用户无法跳过自动剧情文本,大段剧情文本请添加“是否跳过剧情”的提示
helpUrl : https://h5mota.com/games/template/docs/#/event?id=autotext%EF%BC%9A%E8%87%AA%E5%8A%A8%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC
default : ["小妖精","fairy","",3000,"用户无法跳过自动剧情文本,大段剧情文本请添加“是否跳过剧情”的提示"]
var title='';
if (EvalString_0==''){
if (IdString_0=='')title='';
else title='\\t['+IdString_0+']';
} else {
if (IdString_0=='')title='\\t['+EvalString_0+']';
else title='\\t['+EvalString_0+','+IdString_0+']';
}
if(EvalString_1 && !(/^(up|down)(,hero)?(,([+-]?\d+),([+-]?\d+))?$/.test(EvalString_1))) {
throw new Error('对话框效果的用法请右键点击帮助');
}
EvalString_1 = EvalString_1 && ('\\b['+EvalString_1+']');
var code = '{"type": "autoText", "text": "'+title+EvalString_1+EvalString_2+'", "time" :'+Int_0+'},\n';
return code;
*/;
scrollText_s
: '滚动剧情文本:' '时间' Int '不等待执行完毕' Bool? BGNL? EvalString Newline
/* scrollText_s
tooltip : scrollText:滚动剧情文本,将从下到上进行滚动显示。
helpUrl : https://h5mota.com/games/template/docs/#/event?id=scrollText%ef%bc%9a%e6%bb%9a%e5%8a%a8%e5%89%a7%e6%83%85%e6%96%87%e6%9c%ac
default : [5000,false,"时间是总时间,可以使用setText事件来控制字体、颜色、大小、偏移量等"]
Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "scrollText", "text": "'+EvalString_0+'"'+Bool_0+', "time" :'+Int_0+'},\n';
return code;
*/;
setText_s
: '设置剧情文本的属性' '位置' SetTextPosition_List '偏移像素' EvalString? BGNL? '标题颜色' EvalString? Colour '正文颜色' EvalString? Colour '背景色' EvalString? Colour BGNL? '粗体' B_1_List '标题字体大小' EvalString? '正文字体大小' EvalString? '打字间隔' EvalString? Newline
/* setText_s
tooltip : setText:设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
helpUrl : https://h5mota.com/games/template/docs/#/event?id=settext%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC%E7%9A%84%E5%B1%9E%E6%80%A7
default : [null,"","",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',"",'rgba(255,255,255,1)',null,"","",""]
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
if (EvalString_0) {
if (!/^\d+$/.test(EvalString_0))throw new Error('像素偏移量必须是整数或不填');
EvalString_0 = ', "offset": '+EvalString_0;
}
if (EvalString_1) {
if (!colorRe.test(EvalString_1))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
EvalString_1 = ', "title": ['+EvalString_1+']';
}
if (EvalString_2) {
if (!colorRe.test(EvalString_2))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
EvalString_2 = ', "text": ['+EvalString_2+']';
}
if (EvalString_3) {
if (colorRe.test(EvalString_3)) {
EvalString_3 = ', "background": ['+EvalString_3+']';
}
else if (/^\w+\.png$/.test(EvalString_3)) {
EvalString_3 = ', "background": "'+EvalString_3+'"';
}
else {
throw new Error('背景格式错误,必须是形如0~255,0~255,0~255,0~1的颜色,或一个WindowSkin的png图片名称');
}
}
if (EvalString_4) {
if (!/^\d+$/.test(EvalString_4))throw new Error('字体大小必须是整数或不填');
EvalString_4 = ', "titlefont": '+EvalString_4;
}
if (EvalString_5) {
if (!/^\d+$/.test(EvalString_5))throw new Error('字体大小必须是整数或不填');
EvalString_5 = ', "textfont": '+EvalString_5;
}
if (EvalString_6) {
if (!/^\d+$/.test(EvalString_6))throw new Error('打字时间间隔必须是整数或不填');
EvalString_6 = ', "time": '+EvalString_6;
}
B_1_List_0 = B_1_List_0==='null'?'':', "bold": '+B_1_List_0;
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+EvalString_4+EvalString_5+EvalString_6+'},\n';
return code;
*/;
tip_s
: '显示提示' ':' EvalString Newline
/* tip_s
tooltip : tip:显示一段提示文字
helpUrl : https://h5mota.com/games/template/docs/#/event?id=tip%EF%BC%9A%E6%98%BE%E7%A4%BA%E4%B8%80%E6%AE%B5%E6%8F%90%E7%A4%BA%E6%96%87%E5%AD%97
default : ["这段话将在左上角以气泡形式显示"]
var code = '{"type": "tip", "text": "'+EvalString_0+'"},\n';
return code;
*/;
setValue_s
: '数值操作' ':' '名称' idString_e '值' expression Newline
/* setValue_s
tooltip : setValue:设置勇士的某个属性、道具个数, 或某个变量/Flag的值
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setvalue%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%8B%87%E5%A3%AB%E7%9A%84%E6%9F%90%E4%B8%AA%E5%B1%9E%E6%80%A7%E3%80%81%E9%81%93%E5%85%B7%E4%B8%AA%E6%95%B0%EF%BC%8C%E6%88%96%E6%9F%90%E4%B8%AA%E5%8F%98%E9%87%8Fflag%E7%9A%84%E5%80%BC
colour : this.dataColor
var code = '{"type": "setValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"},\n';
return code;
*/;
setFloor_s
: '设置楼层属性' ':' Floor_Meta_List '楼层名' IdString? '值' EvalString Newline
/* setFloor_s
tooltip : setFloor:设置楼层属性;该楼层属性和编辑器中的楼层属性一一对应
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setFloor%ef%bc%9a%e8%ae%be%e7%bd%ae%e6%a5%bc%e5%b1%82%e5%b1%9e%e6%80%a7
default : ["title","","'字符串类型的值要加引号,其他类型则不用'"]
colour : this.dataColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "setFloor", "name": "'+Floor_Meta_List_0+'"'+IdString_0+', "value": "'+EvalString_0+'"},\n';
return code;
*/;
setGlobalAttribute_s
: '设置全局属性' ':' Global_Attribute_List '值' EvalString Newline
/* setGlobalAttribute_s
tooltip : setGlobalAttribute:设置全局属性
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setGlobalAttribute%ef%bc%9a%e8%ae%be%e7%bd%ae%e4%b8%80%e4%b8%aa%e5%85%a8%e5%b1%80%e5%b1%9e%e6%80%a7
default : ["font","Verdana"]
colour : this.dataColor
var code = '{"type": "setGlobalAttribute", "name": "'+Global_Attribute_List_0+'", "value": "'+EvalString_0+'"},\n';
return code;
*/;
setGlobalValue_s
: '设置全局数值' ':' Global_Value_List '值' EvalString Newline
/* setGlobalValue_s
tooltip : setGlobalValue:设置全局属性
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setGlobalValue%ef%bc%9a%e8%ae%be%e7%bd%ae%e4%b8%80%e4%b8%aa%e5%85%a8%e5%b1%80%e6%95%b0%e5%80%bc
default : ["lavaDamage","100"]
colour : this.dataColor
var code = '{"type": "setGlobalValue", "name": "'+Global_Value_List_0+'", "value": '+EvalString_0+'},\n';
return code;
*/;
setGlobalFlag_s
: '设置系统开关' ':' Global_Flag_List Bool Newline
/* setGlobalFlag_s
tooltip : setGlobalFlag:设置系统开关
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setGlobalFlag%ef%bc%9a%e8%ae%be%e7%bd%ae%e4%b8%80%e4%b8%aa%e7%b3%bb%e7%bb%9f%e5%bc%80%e5%85%b3
default : ["enableFloor","true"]
colour : this.dataColor
var code = '{"type": "setGlobalFlag", "name": "'+Global_Flag_List_0+'", "value": '+Bool_0+'},\n';
return code;
*/;
show_s
: '显示事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' Int? '不等待执行完毕' Bool? Newline
/* show_s
tooltip : show: 将禁用事件启用,楼层和动画时间可不填,xy可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=show%EF%BC%9A%E5%B0%86%E4%B8%80%E4%B8%AA%E7%A6%81%E7%94%A8%E4%BA%8B%E4%BB%B6%E5%90%AF%E7%94%A8
default : ["","","",500,false]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
}
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
Bool_0 = Bool_0 ?', "async": true':'';
var code = '{"type": "show"'+floorstr+IdString_0+''+Int_0+Bool_0+'},\n';
return code;
*/;
hide_s
: '隐藏事件' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? '动画时间' Int? '不等待执行完毕' Bool? Newline
/* hide_s
tooltip : hide: 将一个启用事件禁用,所有参数均可不填,代表禁用事件自身,xy可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hide%EF%BC%9A%E5%B0%86%E4%B8%80%E4%B8%AA%E5%90%AF%E7%94%A8%E4%BA%8B%E4%BB%B6%E7%A6%81%E7%94%A8
default : ["","","",500,false]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
}
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
Bool_0 = Bool_0 ?', "async": true':'';
var code = '{"type": "hide"'+floorstr+IdString_0+''+Int_0+Bool_0+'},\n';
return code;
*/;
trigger_s
: '触发事件' 'x' PosString ',' 'y' PosString Newline
/* trigger_s
tooltip : trigger: 立即触发另一个地点的事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=trigger%EF%BC%9A%E7%AB%8B%E5%8D%B3%E8%A7%A6%E5%8F%91%E5%8F%A6%E4%B8%80%E4%B8%AA%E5%9C%B0%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6
default : ["0","0"]
colour : this.eventColor
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code;
*/;
insert_1_s
: '插入公共事件' EvalString Newline
/* insert_1_s
tooltip : insert: 插入公共事件并执行
helpUrl : https://h5mota.com/games/template/docs/#/event?id=insert%ef%bc%9a%e6%8f%92%e5%85%a5%e5%85%ac%e5%85%b1%e4%ba%8b%e4%bb%b6%e6%88%96%e5%8f%a6%e4%b8%80%e4%b8%aa%e5%9c%b0%e7%82%b9%e7%9a%84%e4%ba%8b%e4%bb%b6%e5%b9%b6%e6%89%a7%e8%a1%8c
default : ["加点事件"]
colour : this.eventColor
var code = '{"type": "insert", "name": "'+EvalString_0+'"},\n';
return code;
*/;
insert_2_s
: '插入事件' 'x' PosString ',' 'y' PosString '楼层' IdString? Newline
/* insert_2_s
tooltip : insert: 立即插入另一个地点的事件执行,当前事件不会中断,事件坐标不会改变
helpUrl : https://h5mota.com/games/template/docs/#/event?id=insert%ef%bc%9a%e6%8f%92%e5%85%a5%e5%85%ac%e5%85%b1%e4%ba%8b%e4%bb%b6%e6%88%96%e5%8f%a6%e4%b8%80%e4%b8%aa%e5%9c%b0%e7%82%b9%e7%9a%84%e4%ba%8b%e4%bb%b6%e5%b9%b6%e6%89%a7%e8%a1%8c
default : ["0","0",""]
colour : this.eventColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "insert", "loc": ['+PosString_0+','+PosString_1+']'+IdString_0+'},\n';
return code;
*/;
revisit_s
: '重启当前事件' Newline
/* revisit_s
tooltip : revisit: 立即重启当前事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=revisit%EF%BC%9A%E7%AB%8B%E5%8D%B3%E9%87%8D%E5%90%AF%E5%BD%93%E5%89%8D%E4%BA%8B%E4%BB%B6
colour : this.eventColor
var code = '{"type": "revisit"},\n';
return code;
*/;
exit_s
: '立刻结束当前事件' Newline
/* exit_s
tooltip : exit: 立刻结束当前事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=exit%EF%BC%9A%E7%AB%8B%E5%88%BB%E7%BB%93%E6%9D%9F%E5%BD%93%E5%89%8D%E4%BA%8B%E4%BB%B6
colour : this.eventColor
var code = '{"type": "exit"},\n';
return code;
*/;
setBlock_s
: '转变图块为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline
/* setBlock_s
tooltip : setBlock:设置某个图块,忽略坐标楼层则为当前事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97
colour : this.dataColor
default : [0,"","",""]
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "setBlock", "number":'+Int_0+floorstr+IdString_0+'},\n';
return code;
*/;
showFloorImg_s
: '显示贴图' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
/* showFloorImg_s
tooltip : showFloorImg: 显示一个贴图,xy为左上角坐标,可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showFloorImg%ef%bc%9a%e6%98%be%e7%a4%ba%e8%b4%b4%e5%9b%be
default : ["","",""]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
}
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "showFloorImg"'+floorstr+IdString_0+'},\n';
return code;
*/;
hideFloorImg_s
: '隐藏贴图' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
/* hideFloorImg_s
tooltip : hideFloorImg: 隐藏一个贴图,xy为左上角坐标,可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideFloorImg%ef%bc%9a%e9%9a%90%e8%97%8f%e8%b4%b4%e5%9b%be
default : ["","",""]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
}
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "hideFloorImg"'+floorstr+IdString_0+'},\n';
return code;
*/;
showBgFgMap_s
: '显示图层块' Bg_Fg_List 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
/* showBgFgMap_s
tooltip : showBgFgMap: 显示图层块,即背景图层/前景图层的某些图块,xy为左上角坐标,可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showFloorImg%ef%bc%9a%e6%98%be%e7%a4%ba%e8%b4%b4%e5%9b%be
default : ["bg","","",""]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
}
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "showBgFgMap", "name": "' + Bg_Fg_List_0 + '"' +floorstr+IdString_0+'},\n';
return code;
*/;
hideBgFgMap_s
: '隐藏图层块' Bg_Fg_List 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline
/* hideBgFgMap_s
tooltip : hideBgFgMap: 隐藏图层块,即背景图层/前景图层的某些图块,xy为左上角坐标,可用逗号分隔表示多个点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideFloorImg%ef%bc%9a%e9%9a%90%e8%97%8f%e8%b4%b4%e5%9b%be
default : ["bg","","",""]
colour : this.eventColor
var floorstr = '';
if (EvalString_0 && EvalString_1) {
var pattern1 = /^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/;
if(pattern1.test(EvalString_0) || pattern1.test(EvalString_1)){
EvalString_0=MotaActionFunctions.PosString_pre(EvalString_0);
EvalString_1=MotaActionFunctions.PosString_pre(EvalString_1);
EvalString_0=[EvalString_0,EvalString_1]
} else {
var pattern2 = /^([+-]?\d+)(,[+-]?\d+)*$/;
if(!pattern2.test(EvalString_0) || !pattern2.test(EvalString_1))throw new Error('坐标格式错误,请右键点击帮助查看格式');
EvalString_0=EvalString_0.split(',');
EvalString_1=EvalString_1.split(',');
if(EvalString_0.length!==EvalString_1.length)throw new Error('坐标格式错误,请右键点击帮助查看格式');
for(var ii=0;ii<EvalString_0.length;ii++)EvalString_0[ii]='['+EvalString_0[ii]+','+EvalString_1[ii]+']';
}
floorstr = ', "loc": ['+EvalString_0.join(',')+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "hideBgFgMap", "name": "' + Bg_Fg_List_0 + '"' +floorstr+IdString_0+'},\n';
return code;
*/;
setBgFgBlock_s
: '转变图层块' Bg_Fg_List '为' Int 'x' PosString? ',' 'y' PosString? '楼层' IdString? Newline
/* setBgFgBlock_s
tooltip : setBgFgBlock:设置某个图层块,忽略坐标楼层则为当前点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setblock%EF%BC%9A%E8%AE%BE%E7%BD%AE%E6%9F%90%E4%B8%AA%E5%9B%BE%E5%9D%97
colour : this.dataColor
default : ["bg",0,"","",""]
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var code = '{"type": "setBgFgBlock", "name": "' + Bg_Fg_List_0 + '", "number":'+Int_0+floorstr+IdString_0+'},\n';
return code;
*/;
setHeroIcon_s
: '更改角色行走图' EvalString? Newline
/* setHeroIcon_s
tooltip : setHeroIcon:更改角色行走图
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setheroicon%EF%BC%9A%E6%9B%B4%E6%94%B9%E8%A7%92%E8%89%B2%E8%A1%8C%E8%B5%B0%E5%9B%BE
colour : this.dataColor
default : ["hero.png"]
EvalString_0 = EvalString_0 && (', "name": "'+EvalString_0+'"');
var code = '{"type": "setHeroIcon"'+EvalString_0+'},\n';
return code;
*/;
update_s
: '更新状态栏和地图显伤' Newline
/* update_s
tooltip : update: 立刻更新状态栏和地图显伤
helpUrl : https://h5mota.com/games/template/docs/#/event?id=update%EF%BC%9A%E7%AB%8B%E5%88%BB%E6%9B%B4%E6%96%B0%E7%8A%B6%E6%80%81%E6%A0%8F%E5%92%8C%E5%9C%B0%E5%9B%BE%E6%98%BE%E4%BC%A4
colour : this.dataColor
var code = '{"type": "update"},\n';
return code;
*/;
showStatusBar_s
: '显示状态栏' Newline
/* showStatusBar_s
tooltip : showStatusBar: 显示状态栏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showStatusBar%ef%bc%9a%e6%98%be%e7%a4%ba%e7%8a%b6%e6%80%81%e6%a0%8f
colour : this.soundColor
var code = '{"type": "showStatusBar"},\n';
return code;
*/;
hideStatusBar_s
: '隐藏状态栏' '不隐藏竖屏工具栏' Bool Newline
/* hideStatusBar_s
tooltip : hideStatusBar: 隐藏状态栏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideStatusBar%ef%bc%9a%e9%9a%90%e8%97%8f%e7%8a%b6%e6%80%81%e6%a0%8f
colour : this.soundColor
default : [false]
Bool_0 = Bool_0?', "toolbox": true':'';
var code = '{"type": "hideStatusBar"'+Bool_0+'},\n';
return code;
*/;
updateEnemys_s
: '更新怪物数据' Newline
/* updateEnemys_s
tooltip : updateEnemys: 立刻更新怪物数据
helpUrl : https://h5mota.com/games/template/docs/#/event?id=updateEnemys%ef%bc%9a%e6%9b%b4%e6%96%b0%e6%80%aa%e7%89%a9%e6%95%b0%e6%8d%ae
colour : this.dataColor
var code = '{"type": "updateEnemys"},\n';
return code;
*/;
sleep_s
: '等待' Int '毫秒' '不可被Ctrl跳过' Bool Newline
/* sleep_s
tooltip : sleep: 等待多少毫秒
helpUrl : https://h5mota.com/games/template/docs/#/event?id=sleep%EF%BC%9A%E7%AD%89%E5%BE%85%E5%A4%9A%E5%B0%91%E6%AF%AB%E7%A7%92
default : [500, false]
colour : this.soundColor
Bool_0 = Bool_0?', "noSkip": true':'';
var code = '{"type": "sleep", "time": '+Int_0+Bool_0+'},\n';
return code;
*/;
battle_s
: '强制战斗' IdString Newline
/* battle_s
tooltip : battle: 强制战斗
helpUrl : https://h5mota.com/games/template/docs/#/event?id=battle%EF%BC%9A%E5%BC%BA%E5%88%B6%E6%88%98%E6%96%97
default : ["greenSlime"]
colour : this.dataColor
var code = '{"type": "battle", "id": "'+IdString_0+'"},\n';
return code;
*/;
openDoor_s
: '开门' 'x' PosString? ',' 'y' PosString? '楼层' IdString? '需要钥匙' Bool? Newline
/* openDoor_s
tooltip : openDoor: 开门,楼层可不填表示当前层
helpUrl : https://h5mota.com/games/template/docs/#/event?id=opendoor%EF%BC%9A%E5%BC%80%E9%97%A8
default : ["","","",false]
colour : this.dataColor
IdString_0 = IdString_0 && (', "floorId": "'+IdString_0+'"');
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
Bool_0 = Bool_0 ? ', "needKey": true' : '';
var code = '{"type": "openDoor"'+floorstr+IdString_0+Bool_0+'},\n';
return code;
*/;
changeFloor_s
: '楼层切换' IdString? 'x' PosString? ',' 'y' PosString? '朝向' DirectionEx_List '动画时间' Int? Newline
/* changeFloor_s
tooltip : changeFloor: 楼层切换,动画时间可不填
helpUrl : https://h5mota.com/games/template/docs/#/event?id=changefloor%EF%BC%9A%E6%A5%BC%E5%B1%82%E5%88%87%E6%8D%A2
default : ["MT1","0","0",null,500]
colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
Int_0 = (Int_0!=='') ?(', "time": '+Int_0):'';
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
var code = '{"type": "changeFloor", "floorId": "'+IdString_0+'"'+floorstr+DirectionEx_List_0+Int_0+' },\n';
return code;
*/;
changePos_0_s
: '位置切换' 'x' PosString ',' 'y' PosString '朝向' DirectionEx_List Newline
/* changePos_0_s
tooltip : changePos: 当前位置切换
helpUrl : https://h5mota.com/games/template/docs/#/event?id=changepos%EF%BC%9A%E5%BD%93%E5%89%8D%E4%BD%8D%E7%BD%AE%E5%88%87%E6%8D%A2%E5%8B%87%E5%A3%AB%E8%BD%AC%E5%90%91
default : ["","",null]
colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
var code = '{"type": "changePos", "loc": ['+PosString_0+','+PosString_1+']'+DirectionEx_List_0+'},\n';
return code;
*/;
changePos_1_s
: '勇士转向' Direction_List Newline
/* changePos_1_s
tooltip : changePos: 勇士转向
helpUrl : https://h5mota.com/games/template/docs/#/event?id=changepos%EF%BC%9A%E5%BD%93%E5%89%8D%E4%BD%8D%E7%BD%AE%E5%88%87%E6%8D%A2%E5%8B%87%E5%A3%AB%E8%BD%AC%E5%90%91
colour : this.dataColor
default : [null]
var code = '{"type": "changePos", "direction": "'+Direction_List_0+'"},\n';
return code;
*/;
useItem_s
: '使用道具' IdString Newline
/* useItem_s
tooltip : useItem: 使用道具
helpUrl : https://h5mota.com/games/template/docs/#/event?id=useItem%ef%bc%9a%e4%bd%bf%e7%94%a8%e9%81%93%e5%85%b7
colour : this.dataColor
default : ["pickaxe"]
var code = '{"type": "useItem", "id": "'+IdString_0+'"},\n';
return code;
*/;
openShop_s
: '打开全局商店' IdString Newline
/* openShop_s
tooltip : 全局商店
helpUrl : https://h5mota.com/games/template/docs/#/event?id=openshop%EF%BC%9A%E6%89%93%E5%BC%80%E4%B8%80%E4%B8%AA%E5%85%A8%E5%B1%80%E5%95%86%E5%BA%97
colour : this.dataColor
default : ["shop1"]
var code = '{"type": "openShop", "id": "'+IdString_0+'"},\n';
return code;
*/;
disableShop_s
: '禁用全局商店' IdString Newline
/* disableShop_s
tooltip : 全局商店
helpUrl : https://h5mota.com/games/template/docs/#/event?id=disableshop%EF%BC%9A%E7%A6%81%E7%94%A8%E4%B8%80%E4%B8%AA%E5%85%A8%E5%B1%80%E5%95%86%E5%BA%97
default : ["shop1"]
colour : this.eventColor
var code = '{"type": "disableShop", "id": "'+IdString_0+'"},\n';
return code;
*/;
follow_s
: '跟随勇士' '行走图' EvalString Newline
/* follow_s
tooltip : follow: 跟随勇士
helpUrl : https://h5mota.com/games/template/docs/#/event?id=follow%ef%bc%9a%e8%b7%9f%e9%9a%8f%e5%8b%87%e5%a3%ab
default : ["npc.png"]
colour : this.dataColor
var code = '{"type": "follow", "name": "'+EvalString_0+'"},\n';
return code;
*/;
unfollow_s
: '取消跟随' '行走图' EvalString? Newline
/* unfollow_s
tooltip : unfollow: 取消跟随
helpUrl : https://h5mota.com/games/template/docs/#/event?id=unfollow%ef%bc%9a%e5%8f%96%e6%b6%88%e8%b7%9f%e9%9a%8f
default : [""]
colour : this.dataColor
EvalString_0 = EvalString_0 ? (', "name": "' + EvalString_0 + '"') : "";
var code = '{"type": "unfollow"' + EvalString_0 + '},\n';
return code;
*/;
vibrate_s
: '画面震动' '时间' Int '不等待执行完毕' Bool Newline
/* vibrate_s
tooltip : vibrate: 画面震动
helpUrl : https://h5mota.com/games/template/docs/#/event?id=vibrate%ef%bc%9a%e7%94%bb%e9%9d%a2%e9%9c%87%e5%8a%a8
default : [2000,false]
colour : this.soundColor
Int_0 = Int_0 ?(', "time": '+Int_0):'';
var async = Bool_0?', "async": true':''
var code = '{"type": "vibrate"' + Int_0 + async + '},\n';
return code;
*/;
animate_s
: '显示动画' IdString '位置' EvalString? '不等待执行完毕' Bool Newline
/* animate_s
tooltip : animate:显示动画,位置填hero或者1,2形式的位置,或者不填代表当前事件点
helpUrl : https://h5mota.com/games/template/docs/#/event?id=animate%EF%BC%9A%E6%98%BE%E7%A4%BA%E5%8A%A8%E7%94%BB
default : ["zone","hero",false]
colour : this.soundColor
if (EvalString_0) {
if(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*,flag:[0-9a-zA-Z_][0-9a-zA-Z_\-]*$/.test(EvalString_0)) {
EvalString_0=', "loc": ["'+EvalString_0.split(',').join('","')+'"]';
} else if (/hero|([+-]?\d+),([+-]?\d+)/.test(EvalString_0)) {
if(EvalString_0.indexOf(',')!==-1)EvalString_0='['+EvalString_0+']';
else EvalString_0='"'+EvalString_0+'"';
EvalString_0 = ', "loc": '+EvalString_0;
} else {
throw new Error('此处只能填hero或者1,2形式的位置,或者不填代表当前事件点');
}
}
var async = Bool_0?', "async": true':'';
var code = '{"type": "animate", "name": "'+IdString_0+'"'+EvalString_0+async+'},\n';
return code;
*/;
showImage_s
: '显示图片' '图片编号' Int '图片' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL?
'放大率 : x' Int '% y' Int '% 不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showImage_s
tooltip : showImage:显示图片
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showImage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : [1,"bg.jpg","0","0",100,100,1,0,false]
colour : this.printColor
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':'';
var code = '{"type": "showImage", "code": '+Int_0+', "image": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "dw": '+Int_1+', "dh": '+Int_2+', "opacity": '+Number_0+', "time": '+Int_3+async+'},\n';
return code;
*/;
showTextImage_s
: '显示图片化文本' '文本内容' EvalString BGNL?
'图片编号' Int '起点像素位置' 'x' PosString 'y' PosString '不透明度' Number '时间' Int '不等待执行完毕' Bool Newline
/* showTextImage_s
tooltip : showTextImage:显示图片化文本
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showTextImage%ef%bc%9a%e6%98%be%e7%a4%ba%e6%96%87%e6%9c%ac%e5%8c%96%e5%9b%be%e7%89%87
colour : this.printColor
default : ["可以使用setText事件来控制字体、颜色、大小、偏移量等",1,"0","0",1,0,false]
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':'';
var code = '{"type": "showTextImage", "code": '+Int_0+', "text": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+'], "opacity": '+Number_0+', "time": '+Int_1+async+'},\n';
return code;
*/;
hideImage_s
: '清除图片' '图片编号' Int '时间' Int '不等待执行完毕' Bool Newline
/* hideImage_s
tooltip : hideImage:清除图片
helpUrl : https://h5mota.com/games/template/docs/#/event?id=hideImage%ef%bc%9a%e6%b8%85%e9%99%a4%e5%9b%be%e7%89%87
colour : this.printColor
default : [1,0,false]
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var async = Bool_0?', "async": true':'';
var code = '{"type": "hideImage", "code": '+Int_0+', "time": '+Int_1+async+'},\n';
return code;
*/;
showGif_0_s
: '显示动图' EvalString '起点像素位置' 'x' PosString 'y' PosString Newline
/* showGif_0_s
tooltip : showGif:显示动图
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showgif%EF%BC%9A%E6%98%BE%E7%A4%BA%E5%8A%A8%E5%9B%BE
default : ["bg.gif","0","0"]
colour : this.printColor
var code = '{"type": "showGif", "name": "'+EvalString_0+'", "loc": ['+PosString_0+','+PosString_1+']},\n';
return code;
*/;
showGif_1_s
: '清除所有动图' Newline
/* showGif_1_s
tooltip : showGif:清除所有显示的动图
helpUrl : https://h5mota.com/games/template/docs/#/event?id=showgif%EF%BC%9A%E6%98%BE%E7%A4%BA%E5%8A%A8%E5%9B%BE
colour : this.printColor
var code = '{"type": "showGif"},\n';
return code;
*/;
moveImage_s
: '图片移动' '图片编号' Int '终点像素位置' 'x' PosString? 'y' PosString? BGNL?
'不透明度' EvalString? '移动时间' Int '不等待执行完毕' Bool Newline
/* moveImage_s
tooltip : moveImage:图片移动
helpUrl : https://h5mota.com/games/template/docs/#/event?id=moveImage%ef%bc%9a%e5%9b%be%e7%89%87%e7%a7%bb%e5%8a%a8
default : [1,'','','',500,false]
colour : this.printColor
if(Int_0<=0 || Int_0>50) throw new Error('图片编号在1~50之间');
var toloc = '';
if (PosString_0 && PosString_1)
toloc = ', "to": ['+PosString_0+','+PosString_1+']';
EvalString_0 = (EvalString_0!=='') ? (', "opacity": '+EvalString_0):'';
var async = Bool_0?', "async": true':'';
var code = '{"type": "moveImage", "code": '+Int_0+toloc+EvalString_0+',"time": '+Int_1+async+'},\n';
return code;
*/;
setFg_0_s
: '更改画面色调' EvalString Colour '动画时间' Int? '不等待执行完毕' Bool Newline
/* setFg_0_s
tooltip : setFg: 更改画面色调,动画时间可不填
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setfg%EF%BC%9A%E6%9B%B4%E6%94%B9%E7%94%BB%E9%9D%A2%E8%89%B2%E8%B0%83
default : ["255,255,255,1",'rgba(255,255,255,1)',500,false]
colour : this.soundColor
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
var async = Bool_0?', "async": true':'';
var code = '{"type": "setFg", "color": ['+EvalString_0+']'+Int_0 +async+'},\n';
return code;
*/;
setFg_1_s
: '恢复画面色调' '动画时间' Int? '不等待执行完毕' Bool Newline
/* setFg_1_s
tooltip : setFg: 恢复画面色调,动画时间可不填
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setfg%EF%BC%9A%E6%9B%B4%E6%94%B9%E7%94%BB%E9%9D%A2%E8%89%B2%E8%B0%83
default : [500,false]
colour : this.soundColor
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
var async = Bool_0?', "async": true':'';
var code = '{"type": "setFg"'+Int_0 +async+'},\n';
return code;
*/;
screenFlash_s
: '画面闪烁' EvalString Colour '单次时间' Int '执行次数' Int? '不等待执行完毕' Bool Newline
/* screenFlash_s
tooltip : screenFlash: 画面闪烁,动画时间可不填
helpUrl : https://h5mota.com/games/template/docs/#/event?id=screenFlash%EF%BC%9A%E7%94%BB%E9%9D%A2%E9%97%AA%E7%83%81
default : ["255,255,255,1",'rgba(255,255,255,1)',500,1,false]
colour : this.soundColor
var colorRe = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/;
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
Int_1 = Int_1!=='' ?(', "times": '+Int_1):'';
var async = Bool_0?', "async": true':'';
var code = '{"type": "screenFlash", "color": ['+EvalString_0+'], "time": '+Int_0 +Int_1+async+'},\n';
return code;
*/;
setWeather_s
: '更改天气' Weather_List '强度' Int Newline
/* setWeather_s
tooltip : setWeather:更改天气
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setweather%EF%BC%9A%E6%9B%B4%E6%94%B9%E5%A4%A9%E6%B0%94
default : [null,1]
colour : this.soundColor
if(Int_0<1 || Int_0>10) throw new Error('天气的强度等级, 在1-10之间');
var code = '{"type": "setWeather", "name": "'+Weather_List_0+'", "level": '+Int_0+'},\n';
if(Weather_List_0===''||Weather_List_0==='null'||Weather_List_0==null)code = '{"type": "setWeather"},\n';
return code;
*/;
move_s
: '移动事件' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '不消失' Bool '不等待执行完毕' Bool BGNL? StepString Newline
/* move_s
tooltip : move: 让某个NPC/怪物移动,位置可不填代表当前事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
default : ["","",500,false,false,"上右3下2左上左2"]
colour : this.eventColor
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
Bool_0 = Bool_0?', "keep": true':'';
Bool_1 = Bool_1?', "async": true':'';
var code = '{"type": "move"'+floorstr+Int_0+Bool_0+Bool_1+', "steps": '+JSON.stringify(StepString_0)+'},\n';
return code;
*/;
moveHero_s
: '移动勇士' '动画时间' Int? '不等待执行完毕' Bool BGNL? StepString Newline
/* moveHero_s
tooltip : moveHero:移动勇士,用这种方式移动勇士的过程中将无视一切地形, 无视一切事件, 中毒状态也不会扣血
helpUrl : https://h5mota.com/games/template/docs/#/event?id=movehero%EF%BC%9A%E7%A7%BB%E5%8A%A8%E5%8B%87%E5%A3%AB
default : [500,false,"上右3下2左上左2"]
colour : this.dataColor
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "moveHero"'+Int_0+Bool_0+', "steps": '+JSON.stringify(StepString_0)+'},\n';
return code;
*/;
jump_s
: '跳跃事件' '起始 x' PosString? ',' 'y' PosString? '终止 x' PosString? ',' 'y' PosString? '动画时间' Int? '不消失' Bool '不等待执行完毕' Bool Newline
/* jump_s
tooltip : jump: 让某个NPC/怪物跳跃
helpUrl : https://h5mota.com/games/template/docs/#/event?id=jump%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AANPC%2F%E6%80%AA%E7%89%A9%E8%B7%B3%E8%B7%83
default : ["","","","",500,true,false]
colour : this.eventColor
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr += ', "from": ['+PosString_0+','+PosString_1+']';
}
if (PosString_2 && PosString_3) {
floorstr += ', "to": ['+PosString_2+','+PosString_3+']';
}
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
Bool_0 = Bool_0?', "keep": true':'';
Bool_1 = Bool_1?', "async": true':'';
var code = '{"type": "jump"'+floorstr+''+Int_0+Bool_0+Bool_1+'},\n';
return code;
*/;
jumpHero_s
: '跳跃勇士' 'x' PosString? ',' 'y' PosString? '动画时间' Int? '不等待执行完毕' Bool Newline
/* jumpHero_s
tooltip : jumpHero: 跳跃勇士
helpUrl : https://h5mota.com/games/template/docs/#/event?id=jumpHero%EF%BC%9A%E8%B7%B3%E8%B7%83%E5%8B%87%E5%A3%AB
default : ["","",500,false]
colour : this.dataColor
var floorstr = '';
if (PosString_0 && PosString_1) {
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
}
Int_0 = Int_0!=='' ?(', "time": '+Int_0):'';
Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "jumpHero"'+floorstr+Int_0+Bool_0+'},\n';
return code;
*/;
playBgm_s
: '播放背景音乐' EvalString Newline
/* playBgm_s
tooltip : playBgm: 播放背景音乐
helpUrl : https://h5mota.com/games/template/docs/#/event?id=playbgm%EF%BC%9A%E6%92%AD%E6%94%BE%E8%83%8C%E6%99%AF%E9%9F%B3%E4%B9%90
default : ["bgm.mp3"]
colour : this.soundColor
var code = '{"type": "playBgm", "name": "'+EvalString_0+'"},\n';
return code;
*/;
pauseBgm_s
: '暂停背景音乐' Newline
/* pauseBgm_s
tooltip : pauseBgm: 暂停背景音乐
helpUrl : https://h5mota.com/games/template/docs/#/event?id=pausebgm%EF%BC%9A%E6%9A%82%E5%81%9C%E8%83%8C%E6%99%AF%E9%9F%B3%E4%B9%90
colour : this.soundColor
var code = '{"type": "pauseBgm"},\n';
return code;
*/;
resumeBgm_s
: '恢复背景音乐' Newline
/* resumeBgm_s
tooltip : resumeBgm: 恢复背景音乐
helpUrl : https://h5mota.com/games/template/docs/#/event?id=resumebgm%EF%BC%9A%E6%81%A2%E5%A4%8D%E8%83%8C%E6%99%AF%E9%9F%B3%E4%B9%90
colour : this.soundColor
var code = '{"type": "resumeBgm"},\n';
return code;
*/;
loadBgm_s
: '预加载背景音乐' EvalString Newline
/* loadBgm_s
tooltip : loadBgm: 预加载某个背景音乐,之后可以直接播放
helpUrl : https://h5mota.com/games/template/docs/#/event?id=loadBgm%ef%bc%9a%e9%a2%84%e5%8a%a0%e8%bd%bd%e4%b8%80%e4%b8%aa%e8%83%8c%e6%99%af%e9%9f%b3%e4%b9%90
default : ["bgm.mp3"]
colour : this.soundColor
var code = '{"type": "loadBgm", "name": "'+EvalString_0+'"},\n';
return code;
*/;
freeBgm_s
: '释放背景音乐的缓存' EvalString Newline
/* freeBgm_s
tooltip : freeBgm: 释放背景音乐的缓存
helpUrl : https://h5mota.com/games/template/docs/#/event?id=freeBgm%ef%bc%9a%e9%87%8a%e6%94%be%e4%b8%80%e4%b8%aa%e8%83%8c%e6%99%af%e9%9f%b3%e4%b9%90%e7%9a%84%e7%bc%93%e5%ad%98
default : ["bgm.mp3"]
colour : this.soundColor
var code = '{"type": "freeBgm", "name": "'+EvalString_0+'"},\n';
return code;
*/;
playSound_s
: '播放音效' EvalString Newline
/* playSound_s
tooltip : playSound: 播放音效
helpUrl : https://h5mota.com/games/template/docs/#/event?id=playsound%EF%BC%9A%E6%92%AD%E6%94%BE%E9%9F%B3%E6%95%88
default : ["item.mp3"]
colour : this.soundColor
var code = '{"type": "playSound", "name": "'+EvalString_0+'"},\n';
return code;
*/;
stopSound_s
: '停止所有音效' Newline
/* stopSound_s
tooltip : stopSound: 停止所有音效
helpUrl : https://h5mota.com/games/template/docs/#/event?id=stopSound%ef%bc%9a%e5%81%9c%e6%ad%a2%e6%89%80%e6%9c%89%e9%9f%b3%e6%95%88
colour : this.soundColor
var code = '{"type": "stopSound"},\n';
return code;
*/;
setVolume_s
: '设置音量' Int '渐变时间' Int? '不等待执行完毕' Bool Newline
/* setVolume_s
tooltip : setVolume: 设置音量
helpUrl : https://h5mota.com/games/template/docs/#/event?id=setvolume%EF%BC%9A%E8%AE%BE%E7%BD%AE%E9%9F%B3%E9%87%8F
default : [90, 500, false]
colour : this.soundColor
Int_1 = Int_1!==''?(', "time": '+Int_1):""
var async = Bool_0?', "async": true':'';
var code = '{"type": "setVolume", "value": '+Int_0+Int_1+async+'},\n';
return code;
*/;
win_s
: '游戏胜利,结局' ':' EvalString? '不计入榜单' Bool Newline
/* win_s
tooltip : win: 获得胜利, 该事件会显示获胜页面, 并重新游戏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=win%EF%BC%9A%E8%8E%B7%E5%BE%97%E8%83%9C%E5%88%A9
default : ["",false]
Bool_0 = Bool_0?', "norank": 1':'';
var code = '{"type": "win", "reason": "'+EvalString_0+'"'+Bool_0+'},\n';
return code;
*/;
lose_s
: '游戏失败,结局' ':' EvalString? Newline
/* lose_s
tooltip : lose: 游戏失败, 该事件会显示失败页面, 并重新开始游戏
helpUrl : https://h5mota.com/games/template/docs/#/event?id=lose%EF%BC%9A%E6%B8%B8%E6%88%8F%E5%A4%B1%E8%B4%A5
default : [""]
var code = '{"type": "lose", "reason": "'+EvalString_0+'"},\n';
return code;
*/;
input_s
: '接受用户输入数字,提示' ':' EvalString Newline
/* input_s
tooltip : input:接受用户输入数字, 事件只能接受非负整数输入, 所有非法的输入将全部变成0
helpUrl : https://h5mota.com/games/template/docs/#/event?id=input%ef%bc%9a%e6%8e%a5%e5%8f%97%e7%94%a8%e6%88%b7%e8%be%93%e5%85%a5%e6%95%b0%e5%ad%97
default : ["请输入一个数"]
colour : this.dataColor
var code = '{"type": "input", "text": "'+EvalString_0+'"},\n';
return code;
*/;
input2_s
: '接受用户输入文本,提示' ':' EvalString Newline
/* input2_s
tooltip : input2:接受用户输入文本, 允许用户输入任何形式的文本
helpUrl : https://h5mota.com/games/template/docs/#/event?id=input2%ef%bc%9a%e6%8e%a5%e5%8f%97%e7%94%a8%e6%88%b7%e8%be%93%e5%85%a5%e6%96%87%e6%9c%ac
default : ["请输入文本"]
colour : this.dataColor
var code = '{"type": "input2", "text": "'+EvalString_0+'"},\n';
return code;
*/;
if_s
: '如果' ':' expression BGNL? Newline action+ '否则' ':' BGNL? Newline action+ BEND Newline
/* if_s
tooltip : if: 条件判断
helpUrl : https://h5mota.com/games/template/docs/#/event?id=if%EF%BC%9A%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD
colour : this.eventColor
var code = ['{"type": "if", "condition": "',expression_0,'",\n',
'"true": [\n',action_0,'],\n',
'"false": [\n',action_1,']\n',
'},\n'].join('');
return code;
*/;
switch_s
: '多重分歧 条件判定' ':' expression BGNL? Newline switchCase+ BEND Newline
/* switch_s
tooltip : switch: 多重条件分歧
helpUrl : https://h5mota.com/games/template/docs/#/event?id=switch%EF%BC%9A%E5%A4%9A%E9%87%8D%E6%9D%A1%E4%BB%B6%E5%88%86%E6%AD%A7
default : ["判别值"]
colour : this.eventColor
var code = ['{"type": "switch", "condition": "',expression_0,'", "caseList": [\n',
switchCase_0,
'], },\n'].join('');
return code;
*/;
switchCase
: '如果是' expression '的场合' BGNL? Newline action+
/* switchCase
tooltip : 选项的选择
helpUrl : https://h5mota.com/games/template/docs/#/event?id=switch%EF%BC%9A%E5%A4%9A%E9%87%8D%E6%9D%A1%E4%BB%B6%E5%88%86%E6%AD%A7
colour : this.subColor
var code = '{"case": "'+expression_0+'", "action": [\n'+action_0+']},\n';
return code;
*/;
choices_s
: '选项' ':' EvalString? BGNL? '标题' EvalString? '图像' IdString? BGNL? Newline choicesContext+ BEND Newline
/* choices_s
tooltip : choices: 给用户提供选项
helpUrl : https://h5mota.com/games/template/docs/#/event?id=choices%EF%BC%9A%E7%BB%99%E7%94%A8%E6%88%B7%E6%8F%90%E4%BE%9B%E9%80%89%E9%A1%B9
default : ["","流浪者","woman"]
var title='';
if (EvalString_1==''){
if (IdString_0=='')title='';
else title='\\t['+IdString_0+']';
} else {
if (IdString_0=='')title='\\t['+EvalString_1+']';
else title='\\t['+EvalString_1+','+IdString_0+']';
}
EvalString_0 = title+EvalString_0;
EvalString_0 = EvalString_0 ?(', "text": "'+EvalString_0+'"'):'';
var code = ['{"type": "choices"',EvalString_0,', "choices": [\n',
choicesContext_0,
']},\n'].join('');
return code;
*/;
choicesContext
: '子选项' EvalString BGNL? Newline action+
/* choicesContext
tooltip : 选项的选择
helpUrl : https://h5mota.com/games/template/docs/#/event?id=choices%EF%BC%9A%E7%BB%99%E7%94%A8%E6%88%B7%E6%8F%90%E4%BE%9B%E9%80%89%E9%A1%B9
default : ["提示文字:红钥匙"]
colour : this.subColor
var code = '{"text": "'+EvalString_0+'", "action": [\n'+action_0+']},\n';
return code;
*/;
while_s
: '循环处理' ':' '当' expression '时' BGNL? Newline action+ BEND Newline
/* while_s
tooltip : while:循环处理
helpUrl : https://h5mota.com/games/template/docs/#/event?id=while%EF%BC%9A%E5%BE%AA%E7%8E%AF%E5%A4%84%E7%90%86
colour : this.eventColor
var code = ['{"type": "while", "condition": "',expression_0,'",\n',
'"data": [\n',action_0,'],\n',
'},\n'].join('');
return code;
*/;
break_s
: '跳出循环' Newline
/* break_s
tooltip : break:跳出循环, 如果break事件不在任何循环中被执行,则和exit等价,即会立刻结束当前事件!
helpUrl : https://h5mota.com/games/template/docs/#/event?id=break%EF%BC%9A%E8%B7%B3%E5%87%BA%E5%BE%AA%E7%8E%AF
colour : this.eventColor
var code = '{"type": "break"},\n';
return code;
*/;
continue_s
: '继续当前循环' Newline
/* continue_s
tooltip : continue:继续执行当前循环的下一轮, 如果continue事件不在任何循环中被执行,则和exit等价,即会立刻结束当前事件!
helpUrl : https://h5mota.com/games/template/docs/#/event?id=continue%EF%BC%9A%E7%BB%A7%E7%BB%AD%E6%89%A7%E8%A1%8C%E5%BD%93%E5%89%8D%E5%BE%AA%E7%8E%AF
colour : this.eventColor
var code = '{"type": "continue"},\n';
return code;
*/;
wait_s
: '等待用户操作并获得按键或点击信息'
/* wait_s
tooltip : wait: 等待用户操作并获得按键或点击信息(具体用法看文档)
helpUrl : https://h5mota.com/games/template/docs/#/event?id=wait%EF%BC%9A%E7%AD%89%E5%BE%85%E7%94%A8%E6%88%B7%E6%93%8D%E4%BD%9C
colour : this.soundColor
var code = '{"type": "wait"},\n';
return code;
*/;
waitAsync_s
: '等待所有异步事件执行完毕'
/* waitAsync_s
tooltip : waitAsync: 等待所有异步事件执行完毕
helpUrl : https://h5mota.com/games/template/docs/#/event?id=waitAsync%ef%bc%9a%e7%ad%89%e5%be%85%e6%89%80%e6%9c%89%e5%bc%82%e6%ad%a5%e4%ba%8b%e4%bb%b6%e6%89%a7%e8%a1%8c%e5%ae%8c%e6%af%95
colour : this.soundColor
var code = '{"type": "waitAsync"},\n';
return code;
*/;
callBook_s
: '呼出怪物手册'
/* callBook_s
tooltip : callBook: 呼出怪物手册;返回游戏后将继续执行后面的事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=callBook%ef%bc%9a%e5%91%bc%e5%87%ba%e6%80%aa%e7%89%a9%e6%89%8b%e5%86%8c
colour : this.soundColor
var code = '{"type": "callBook"},\n';
return code;
*/;
callSave_s
: '呼出存档页面'
/* callSave_s
tooltip : callSave: 呼出存档页面;之后读此档将执行eachArrive
helpUrl : https://h5mota.com/games/template/docs/#/event?id=callSave%ef%bc%9a%e5%91%bc%e5%87%ba%e5%ad%98%e6%a1%a3%e7%95%8c%e9%9d%a2
colour : this.soundColor
var code = '{"type": "callSave"},\n';
return code;
*/;
callLoad_s
: '呼出读档页面'
/* callLoad_s
tooltip : callLoad: 呼出存档页面;返回游戏后将继续执行后面的事件
helpUrl : https://h5mota.com/games/template/docs/#/event?id=callLoad%ef%bc%9a%e5%91%bc%e5%87%ba%e8%af%bb%e6%a1%a3%e7%95%8c%e9%9d%a2
colour : this.soundColor
var code = '{"type": "callLoad"},\n';
return code;
*/;
function_s
: '自定义JS脚本' '不自动执行下一个事件' Bool BGNL? Newline RawEvalString Newline BEND Newline
/* function_s
tooltip : 可双击多行编辑,请勿使用异步代码。常见API参见文档附录。
helpUrl : https://h5mota.com/games/template/docs/#/event?id=function%EF%BC%9A%E8%87%AA%E5%AE%9A%E4%B9%89js%E8%84%9A%E6%9C%AC
default : [false,"alert(core.getStatus(\"atk\"));"]
colour : this.dataColor
Bool_0 = Bool_0?', "async": true':'';
var code = '{"type": "function"'+Bool_0+', "function": "function(){\\n'+JSON.stringify(RawEvalString_0).slice(1,-1).split('\\\\n').join('\\n')+'\\n}"},\n';
return code;
*/;
pass_s
: Newline
/* pass_s
var code = ' \n';
return code;
*/;
statExprSplit : '=== statement ^ === expression v ===' ;
//===blockly表达式===
expression
: expression Arithmetic_List expression
| negate_e
| bool_e
| idString_e
| evFlag_e
| evalString_e
/* expression_arithmetic_0
//todo 修改recieveOrder,根据Arithmetic_List_0不同的值设定不同的recieveOrder
var code = expression_0 + Arithmetic_List_0 + expression_1;
var ops = {
'^': 'Math.pow('+expression_0+','+expression_1+')',
'和': expression_0+' && '+expression_1,
'或': expression_0+' || '+expression_1,
}
if (ops[Arithmetic_List_0])code = ops[Arithmetic_List_0];
var orders = {
'+': Blockly.JavaScript.ORDER_ADDITION,
'-': Blockly.JavaScript.ORDER_SUBTRACTION,
'*': Blockly.JavaScript.ORDER_MULTIPLICATION,
'/': Blockly.JavaScript.ORDER_DIVISION,
'^': Blockly.JavaScript.ORDER_MEMBER, //recieveOrder : ORDER_COMMA
'==': Blockly.JavaScript.ORDER_EQUALITY,
'!=': Blockly.JavaScript.ORDER_EQUALITY,
'>': Blockly.JavaScript.ORDER_RELATIONAL,
'<': Blockly.JavaScript.ORDER_RELATIONAL,
'>=': Blockly.JavaScript.ORDER_RELATIONAL,
'<=': Blockly.JavaScript.ORDER_RELATIONAL,
'和': Blockly.JavaScript.ORDER_LOGICAL_AND,
'或': Blockly.JavaScript.ORDER_LOGICAL_OR
}
return [code, orders[Arithmetic_List_0]];
*/;
negate_e
: '非' expression
/* negate_e
//todo 修改recieveOrder : ORDER_LOGICAL_NOT 修改 inputsInline
var code = '!'+expression_0;
return [code, Blockly.JavaScript.ORDER_LOGICAL_NOT];
*/;
bool_e
: Bool
/* bool_e
var code = Bool_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
idString_e
: IdString
/* idString_e
colour : this.idstring_eColor
default : ["status:hp"]
var code = IdString_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
//这一条不会被antlr识别,总是会被归到idString_e
idString_1_e
: Id_List ':' IdText
/* idString_1_e
colour : this.idstring_eColor
default : [null,"自定义flag"]
//todo 将其output改成'idString_e'
var code = Id_List_0+':'+IdText_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
//这一条不会被antlr识别,总是会被归到idString_e
idString_2_e
: FixedId_List
/* idString_2_e
colour : this.idstring_eColor
//todo 将其output改成'idString_e'
var code = FixedId_List_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
evFlag_e
: '独立开关' Letter_List
/* evFlag_e
colour : this.idstring_eColor
default : ["A"]
var code = "switch:"+Letter_List_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
evalString_e
: EvalString
/* evalString_e
default : ["值"]
var code = EvalString_0;
return [code, Blockly.JavaScript.ORDER_ATOMIC];
*/;
//===============lexer===============
IdText
: 'sdeirughvuiyasdeb'+ //为了被识别为复杂词法规则
;
RawEvalString
: 'sdeirughvuiyasdbe'+ //为了被识别为复杂词法规则
;
PosString
: 'sdeirughvuiyasbde'+ //为了被识别为复杂词法规则
;
Floor_List
: '楼层ID'|'前一楼'|'后一楼'
/*Floor_List ['floorId',':before',':next']*/;
Stair_List
: '坐标'|'上楼梯'|'下楼梯'
/*Stair_List ['loc','upFloor','downFloor']*/;
SetTextPosition_List
: '不改变'|'距离顶部'|'居中'|'距离底部'
/*SetTextPosition_List ['null','up','center','down']*/;
ShopUse_List
: '金币' | '经验'
/*ShopUse_List ['money','experience']*/;
Arithmetic_List
: '+'|'-'|'*'|'/'|'^'|'=='|'!='|'>'|'<'|'>='|'<='|'和'|'或'
;
Weather_List
: '无'|'雨'|'雪'|'雾'
/*Weather_List ['null','rain','snow','fog']*/;
B_0_List
: '不改变'|'不可通行'|'可以通行'
/*B_0_List ['null','true','false']*/;
B_1_List
: '不改变'|'设为粗体'|'取消粗体'
/*B_1_List ['null','true','false']*/;
Bg_Fg_List
: '背景层'|'前景层'
/*Bg_Fg_List ['bg','fg']*/;
Floor_Meta_List
: '楼层中文名'|'状态栏名称'|'能否使用楼传'|'能否打开快捷商店'|'是否不可浏览地图'|'是否不可瞬间移动'|'默认地面ID'|'楼层贴图'|'宝石血瓶效果'|'上楼点坐标'|'下楼点坐标'|'背景音乐'|'画面色调'|'天气和强度'|'是否地下层'
/*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'cannotMoveDirectly', 'defaultGround', 'images', 'item_ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/;
Global_Attribute_List
: '全局字体'|'横屏左侧状态栏背景'|'竖屏上方状态栏背景'|'竖屏下方道具栏背景'|'边框颜色'|'状态栏文字色'|'难度显示文字色'|'楼层转换背景'|'楼层转换文字色'|'装备列表'
/*Global_Attribute_List ['font','statusLeftBackground','statusTopBackground', 'toolsBackground', 'borderColor', 'statusBarColor', 'hardLabelColor', 'floorChangingBackground', 'floorChangingTextColor', 'equipName']*/;
Global_Value_List
: '血网伤害'|'中毒伤害'|'衰弱效果'|'红宝石效果'|'蓝宝石效果'|'绿宝石效果'|'红血瓶效果'|'蓝血瓶效果'|'黄血瓶效果'|'绿血瓶效果'|'破甲比例'|'反击比例'|'净化比例'|'仇恨增加值'|'行走速度'|'动画时间'|'楼层切换时间'
/*Global_Value_List ['lavaDamage','poisonDamage','weakValue', 'redJewel', 'blueJewel', 'greenJewel', 'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'breakArmor', 'counterAttack', 'purify', 'hatred', 'moveSpeed', 'animateSpeed', 'floorChangeTime']*/;
Global_Flag_List
: '显示当前楼层'|'显示勇士图标'|'显示当前等级'|'启用生命上限'|'显示魔力值'|'显示魔防值'|'显示金币值'|'显示经验值'|'允许等级提升'|'升级扣除模式'|'显示钥匙数量'|'显示破炸飞'|'显示毒衰咒'|'显示当前技能'|'楼梯边才能楼传'|'开启加点'|'开启负伤'|'循环计算临界'|'允许轻按'|'允许走到将死领域'|'允许瞬间移动'|'阻激夹域后禁用快捷商店'
/*Global_Flag_List ['enableFloor','enableName','enableLv', 'enableHPMax', 'enableMana', 'enableMDef', 'enableMoney', 'enableExperience', 'enableLevelUp', 'levelUpLeftMode', 'enableKeys', 'enablePZF', 'enableDebuff', 'enableSkill', 'flyNearStair', 'enableAddPoint', 'enableNegativeDamage', 'useLoop', 'enableGentleClick', 'canGoDeadZone', 'enableMoveDirectly', 'disableShopOnDamage']*/;
Colour
: 'sdeirughvuiyasdeb'+ //为了被识别为复杂词法规则
;
Angle
: 'sdeirughvuiyasdeb'+ //为了被识别为复杂词法规则
;
Bool: 'TRUE'
| 'FALSE'
;
Int : '0' | [1-9][0-9]* ; // no leading zeros
Letter_List
: 'A'|'B'|'C'|'D'|'E'|'F'
/*Letter_List ['A','B','C','D','E','F']*/;
Number
: '-'? Int '.' Int EXP? // 1.35, 1.35E-9, 0.3, -4.5
| '-'? Int EXP // 1e10 -3e4
| '-'? Int // -3, 45
;
fragment EXP : [Ee] [+\-]? Int ; // \- since - means "range" inside [...]
Direction_List
: '上'|'下'|'左'|'右'
/*Direction_List ['up','down','left','right']*/;
DirectionEx_List
: '不变'|'上'|'下'|'左'|'右'
/*DirectionEx_List ['','up','down','left','right']*/;
StepString
: (Direction_List Int?)+
;
IdString
: [0-9a-zA-Z_][0-9a-zA-Z_:]*
;
FixedId_List
: '生命'|'攻击'|'防御'|'魔防'|'黄钥匙'|'蓝钥匙'|'红钥匙'|'金币'|'经验'
/*FixedId_List ['status:hp','status:atk','status:def','status:mdef','item:yellowKey','item:blueKey','item:redKey','status:money','status:experience']*/;
Id_List
: '变量' | '状态' | '物品' | '独立开关'
/*Id_List ['flag','status','item', 'switch']*/;
//转blockly后不保留需要加"
EvalString
: Equote_double (ESC_double | ~["\\])* Equote_double
;
fragment ESC_double : '\\' (["\\/bfnrt] | UNICODE) ;
fragment UNICODE : 'u' HEX HEX HEX HEX ;
fragment HEX : [0-9a-fA-F] ;
BGNL
: 'BGNLaergayergfuybgv'
;
MeaningfulSplit : '=== meaningful ^ ===' ;
fragment Equote_double : '"' ;
BSTART
: '开始'
;
BEND: '结束'
;
Newline
: ('\r' '\n'?| '\n')// -> skip
;
WhiteSpace
: [ \t]+ -> skip
;
BlockComment
: '/*' .*? '*/' -> skip
;
LineComment
: '//' ~[\r\n]* -> skip
;
/* Function_0
//this.evisitor.recieveOrder='ORDER_NONE';
this.evisitor.valueColor=330;
this.evisitor.statementColor=70;
this.evisitor.entryColor=250;
this.evisitor.idstring_eColor=310;
this.evisitor.subColor=190;
this.evisitor.printColor=70;
this.evisitor.dataColor=130;
this.evisitor.eventColor=220;
this.evisitor.soundColor=20;
this.evisitor.commentColor=285;
*/
/* Function_1
delete(this.block('negate_e').inputsInline);
this.block('idString_1_e').output='idString_e';
this.block('idString_2_e').output='idString_e';
this.block('evFlag_e').output='idString_e';
*/
/* Functions
function ActionParser(){
}
ActionParser.prototype.parse = function (obj,type) {
switch (type) {
case 'event':
if(!obj)obj={};
if(typeof(obj)===typeof('')) obj={'data':[obj]};
if(obj instanceof Array) obj={'data':obj};
return MotaActionBlocks['event_m'].xmlText([
obj.trigger==='action',obj.enable,obj.noPass,obj.animate,obj.displayDamage,this.parseList(obj.data)
]);
case 'changeFloor':
if(!obj)obj={};
if(!this.isset(obj.loc))obj.loc=[0,0];
if (obj.floorId==':before'||obj.floorId==':next') {
obj.floorType=obj.floorId;
delete obj.floorId;
}
if (!this.isset(obj.time)) obj.time=500;
return MotaActionBlocks['changeFloor_m'].xmlText([
obj.floorType||'floorId',obj.floorId,obj.stair||'loc',obj.loc[0],obj.loc[1],obj.direction,
obj.time,!this.isset(obj.portalWithoutTrigger)
]);
case 'level':
if(!obj)obj={};
var text_choices = null;
for(var ii=obj.length-1,choice;choice=obj[ii];ii--) {
text_choices=MotaActionBlocks['levelCase'].xmlText([
MotaActionBlocks['evalString_e'].xmlText([choice.need]),choice.title,choice.clear||false,this.parseList(choice.action),text_choices]);
}
return MotaActionBlocks['level_m'].xmlText([text_choices]);
case 'shop':
var buildsub = function(obj,parser,next){
var text_choices = null;
for(var ii=obj.choices.length-1,choice;choice=obj.choices[ii];ii--) {
var text_effect = null;
var effectList = choice.effect.split(';');
for(var jj=effectList.length-1,effect;effect=effectList[jj];jj--) {
if(effect.split('+=').length!==2){
throw new Error('一个商店效果中必须包含恰好一个"+="');
}
text_effect=MotaActionBlocks['shopEffect'].xmlText([
MotaActionBlocks['idString_e'].xmlText([effect.split('+=')[0]]),
MotaActionBlocks['evalString_e'].xmlText([effect.split('+=')[1]]),
text_effect]);
}
text_choices=MotaActionBlocks['shopChoices'].xmlText([
choice.text,choice.need||'',text_effect,text_choices]);
}
return MotaActionBlocks['shopsub'].xmlText([
obj.id,obj.name,obj.icon,obj.textInList,obj.commonTimes,obj.mustEnable,obj.use,obj.need,parser.EvalString(obj.text),text_choices,next
]);
}
var next=null;
if(!obj)obj=[];
while(obj.length){
next=buildsub(obj.pop(),this,next);
}
return MotaActionBlocks['shop_m'].xmlText([next]);
default:
return MotaActionBlocks[type+'_m'].xmlText([this.parseList(obj)]);
}
}
////// 开始解析一系列自定义事件 //////
ActionParser.prototype.parseList = function (list) {
if (!this.isset(list)) return MotaActionBlocks['pass_s'].xmlText([],true);
if (!(list instanceof Array)) {
list = [list];
}
if (list.length===0) return MotaActionBlocks['pass_s'].xmlText([],true);
this.event = {'id': 'action', 'data': {
'list': list
}}
this.next = null;
this.result = null;
this.parseAction();
return this.result;
}
////// 解析当前自定义事件列表中的最后一个事件 //////
ActionParser.prototype.parseAction = function() {
// 事件处理完毕
if (this.event.data.list.length==0) {
this.result = this.next;
this.next = null;
return;
}
var data = this.event.data.list.pop();
this.event.data.current = data;
// 不同种类的事件
// 如果是文字:显示
if (typeof data == "string") {
data={"type": "text", "text": data}
}
this.event.data.type=data.type;
switch (data.type) {
case "_next":
this.result = this.next;
this.next = data.next;
return;
case "text": // 文字/对话
this.next = MotaActionBlocks['text_0_s'].xmlText([
this.EvalString(data.text),this.next]);
break;
case "autoText": // 自动剧情文本
this.next = MotaActionBlocks['autoText_s'].xmlText([
'','','',data.time,this.EvalString(data.text),this.next]);
break;
case "scrollText":
this.next = MotaActionBlocks['scrollText_s'].xmlText([
data.time, data.async||false, this.EvalString(data.text), this.next]);
break;
case "comment": // 注释
this.next = MotaActionBlocks['comment_s'].xmlText([this.EvalString(data.text),this.next],null,data.text);
break;
case "setText": // 设置剧情文本的属性
var setTextfunc = function(a){return a?JSON.stringify(a).slice(1,-1):null;}
data.title=setTextfunc(data.title);
data.text=setTextfunc(data.text);
if (!/^\w+\.png$/.test(data.background))
data.background=setTextfunc(data.background);
this.next = MotaActionBlocks['setText_s'].xmlText([
data.position,data.offset,data.title,`rgba(${data.title})`,data.text,`rgba(${data.text})`,data.background,`rgba(${data.background})`,data.bold,data.titlefont,data.textfont,data.time,this.next]);
break;
case "tip":
this.next = MotaActionBlocks['tip_s'].xmlText([
data.text,this.next]);
break;
case "show": // 显示
data.loc=data.loc||[];
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
x_str.push(t[0]);
y_str.push(t[1]);
})
this.next = MotaActionBlocks['show_s'].xmlText([
x_str.join(','),y_str.join(','),data.floorId||'',data.time||0,data.async||false,this.next]);
break;
case "hide": // 消失
data.loc=data.loc||[];
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
x_str.push(t[0]);
y_str.push(t[1]);
})
this.next = MotaActionBlocks['hide_s'].xmlText([
x_str.join(','),y_str.join(','),data.floorId||'',data.time||0,data.async||false,this.next]);
break;
case "setBlock": // 设置图块
data.loc=data.loc||['',''];
this.next = MotaActionBlocks['setBlock_s'].xmlText([
data.number||0,data.loc[0],data.loc[1],data.floorId||'',this.next]);
break;
case "showFloorImg": // 显示贴图
data.loc=data.loc||[];
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
x_str.push(t[0]);
y_str.push(t[1]);
})
this.next = MotaActionBlocks['showFloorImg_s'].xmlText([
x_str.join(','),y_str.join(','),data.floorId||'',this.next]);
break;
case "hideFloorImg": // 隐藏贴图
data.loc=data.loc||[];
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
x_str.push(t[0]);
y_str.push(t[1]);
})
this.next = MotaActionBlocks['hideFloorImg_s'].xmlText([
x_str.join(','),y_str.join(','),data.floorId||'',this.next]);
break;
case "showBgFgMap": // 显示图层块
data.loc=data.loc||[];
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
x_str.push(t[0]);
y_str.push(t[1]);
})
this.next = MotaActionBlocks['showBgFgMap_s'].xmlText([
data.name||'bg', x_str.join(','),y_str.join(','),data.floorId||'',this.next]);
break;
case "hideBgFgMap": // 隐藏图层块
data.loc=data.loc||[];
if (!(data.loc[0] instanceof Array))
data.loc = [data.loc];
var x_str=[],y_str=[];
data.loc.forEach(function (t) {
x_str.push(t[0]);
y_str.push(t[1]);
})
this.next = MotaActionBlocks['hideBgFgMap_s'].xmlText([
data.name||'bg', x_str.join(','),y_str.join(','),data.floorId||'',this.next]);
break;
case "setBgFgBlock": // 设置图块
data.loc=data.loc||['',''];
this.next = MotaActionBlocks['setBgFgBlock_s'].xmlText([
data.name||"bg", data.number||0,data.loc[0],data.loc[1],data.floorId||'',this.next]);
break;
case "setHeroIcon": // 改变勇士
this.next = MotaActionBlocks['setHeroIcon_s'].xmlText([
data.name||"",this.next]);
break;
case "move": // 移动事件
data.loc=data.loc||['',''];
this.next = MotaActionBlocks['move_s'].xmlText([
data.loc[0],data.loc[1],data.time||0,data.keep||false,data.async||false,this.StepString(data.steps),this.next]);
break;
case "moveHero":
this.next = MotaActionBlocks['moveHero_s'].xmlText([
data.time||0,data.async||false,this.StepString(data.steps),this.next]);
break;
case "jump": // 跳跃事件
data.from=data.from||['',''];
data.to=data.to||['',''];
this.next = MotaActionBlocks['jump_s'].xmlText([
data.from[0],data.from[1],data.to[0],data.to[1],data.time||0,data.keep||false,data.async||false,this.next]);
break;
case "jumpHero": // 跳跃勇士
data.loc=data.loc||['','']
this.next = MotaActionBlocks['jumpHero_s'].xmlText([
data.loc[0],data.loc[1],data.time||0,data.async||false,this.next]);
break;
case "changeFloor": // 楼层转换
data.loc=data.loc||['','']
this.next = MotaActionBlocks['changeFloor_s'].xmlText([
data.floorId,data.loc[0],data.loc[1],data.direction,data.time||0,this.next]);
break;
case "changePos": // 直接更换勇士位置, 不切换楼层
if(this.isset(data.loc)){
this.next = MotaActionBlocks['changePos_0_s'].xmlText([
data.loc[0],data.loc[1],data.direction,this.next]);
} else {
this.next = MotaActionBlocks['changePos_1_s'].xmlText([
data.direction,this.next]);
}
break;
case "follow": // 跟随勇士
this.next = MotaActionBlocks['follow_s'].xmlText([data.name||"", this.next]);
break;
case "unfollow": // 取消跟随
this.next = MotaActionBlocks['unfollow_s'].xmlText([data.name||"", this.next]);
break;
case "animate": // 显示动画
var animate_loc = data.loc||'';
if(animate_loc && animate_loc!=='hero')animate_loc = animate_loc[0]+','+animate_loc[1];
this.next = MotaActionBlocks['animate_s'].xmlText([
data.name,animate_loc,data.async||false,this.next]);
break;
case "vibrate": // 画面震动
this.next = MotaActionBlocks['vibrate_s'].xmlText([data.time||0, data.async||false, this.next]);
break;
case "showImage": // 显示图片
data.loc=data.loc||['','']
this.next = MotaActionBlocks['showImage_s'].xmlText([
data.code,data.image||data.name,data.loc[0],data.loc[1],data.dw,data.dh,data.opacity,data.time||0,data.async||false,this.next]);
break;
case "hideImage": // 清除图片
this.next = MotaActionBlocks['hideImage_s'].xmlText([
data.code,data.time||0,data.async||false,this.next]);
break;
case "showTextImage": // 显示图片化文本
data.loc=data.loc||['','']
this.next = MotaActionBlocks['showTextImage_s'].xmlText([
this.EvalString(data.text),data.code,data.loc[0],data.loc[1],data.opacity,data.time||0,data.async||false,this.next]);
break;
case "moveImage": // 移动图片
data.to=data.to||['','']
this.next = MotaActionBlocks['moveImage_s'].xmlText([
data.code, data.to[0], data.to[1], data.opacity, data.time||0, data.async||false, this.next]);
break;
case "showGif": // 显示动图
if(this.isset(data.name)){
this.next = MotaActionBlocks['showGif_0_s'].xmlText([
data.name,data.loc[0],data.loc[1],this.next]);
} else {
this.next = MotaActionBlocks['showGif_1_s'].xmlText([
this.next]);
}
break;
case "setFg": // 颜色渐变
if(this.isset(data.color)){
this.next = MotaActionBlocks['setFg_0_s'].xmlText([
data.color,`rgba(${data.color})`,data.time||0,data.async||false,this.next]);
} else {
this.next = MotaActionBlocks['setFg_1_s'].xmlText([
data.time||0,data.async||false,this.next]);
}
break;
case "screenFlash": // 画面闪烁
this.next = MotaActionBlocks['screenFlash_s'].xmlText([
data.color,`rgba(${data.color})`,data.time||500,data.times||1,data.async||false,this.next]);
break;
case "setWeather": // 更改天气
this.next = MotaActionBlocks['setWeather_s'].xmlText([
data.name,data.level||1,this.next]);
break;
case "openDoor": // 开一个门, 包括暗墙
data.loc=data.loc||['','']
this.next = MotaActionBlocks['openDoor_s'].xmlText([
data.loc[0],data.loc[1],data.floorId||'',data.needKey||false,this.next]);
break;
case "useItem": // 使用道具
this.next = MotaActionBlocks['useItem_s'].xmlText([
data.id,this.next]);
break;
case "openShop": // 打开一个全局商店
this.next = MotaActionBlocks['openShop_s'].xmlText([
data.id,this.next]);
break;
case "disableShop": // 禁用一个全局商店
this.next = MotaActionBlocks['disableShop_s'].xmlText([
data.id,this.next]);
break;
case "battle": // 强制战斗
this.next = MotaActionBlocks['battle_s'].xmlText([
data.id,this.next]);
break;
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
this.next = MotaActionBlocks['trigger_s'].xmlText([
data.loc[0],data.loc[1],this.next]);
break;
case "insert": // 强制插入另一个点的事件在当前事件列表执行,当前坐标和楼层不会改变
if (this.isset(data.name)) {
this.next = MotaActionBlocks['insert_1_s'].xmlText([
data.name, this.next]);
}
else {
this.next = MotaActionBlocks['insert_2_s'].xmlText([
data.loc[0],data.loc[1],data.floorId||'',this.next]);
}
break;
case "playSound":
this.next = MotaActionBlocks['playSound_s'].xmlText([
data.name,this.next]);
break;
case "playBgm":
this.next = MotaActionBlocks['playBgm_s'].xmlText([
data.name,this.next]);
break
case "pauseBgm":
this.next = MotaActionBlocks['pauseBgm_s'].xmlText([
this.next]);
break
case "resumeBgm":
this.next = MotaActionBlocks['resumeBgm_s'].xmlText([
this.next]);
break
case "loadBgm":
this.next = MotaActionBlocks['loadBgm_s'].xmlText([
data.name,this.next]);
break
case "freeBgm":
this.next = MotaActionBlocks['freeBgm_s'].xmlText([
data.name,this.next]);
break
case "stopSound":
this.next = MotaActionBlocks['stopSound_s'].xmlText([
this.next]);
break
case "setVolume":
this.next = MotaActionBlocks['setVolume_s'].xmlText([
data.value, data.time||0, data.async||false, this.next]);
break
case "setValue":
this.next = MotaActionBlocks['setValue_s'].xmlText([
// MotaActionBlocks['idString_e'].xmlText([data.name]),
this.tryToUseEvFlag_e('idString_e', [data.name]),
MotaActionBlocks['evalString_e'].xmlText([data.value]),
this.next]);
break;
case "setFloor":
this.next = MotaActionBlocks['setFloor_s'].xmlText([
data.name, data.floorId||null, data.value, this.next]);
break;
case "setGlobalAttribute":
this.next = MotaActionBlocks['setGlobalAttribute_s'].xmlText([
data.name, data.value, this.next]);
break;
case "setGlobalValue":
this.next = MotaActionBlocks['setGlobalValue_s'].xmlText([
data.name, data.value, this.next]);
break;
case "setGlobalFlag":
this.next = MotaActionBlocks['setGlobalFlag_s'].xmlText([
data.name, data.value, this.next]);
break;
case "input":
this.next = MotaActionBlocks['input_s'].xmlText([
data.text,this.next]);
break;
case "input2":
this.next = MotaActionBlocks['input2_s'].xmlText([
data.text,this.next]);
break;
case "if": // 条件判断
this.next = MotaActionBlocks['if_s'].xmlText([
// MotaActionBlocks['evalString_e'].xmlText([data.condition]),
this.tryToUseEvFlag_e('evalString_e', [data.condition]),
this.insertActionList(data["true"]),
this.insertActionList(data["false"]),
this.next]);
break;
case "switch": // 多重条件分歧
var case_caseList = null;
for(var ii=data.caseList.length-1,caseNow;caseNow=data.caseList[ii];ii--) {
case_caseList=MotaActionBlocks['switchCase'].xmlText([
this.isset(caseNow.case)?MotaActionBlocks['evalString_e'].xmlText([caseNow.case]):"值",this.insertActionList(caseNow.action),case_caseList]);
}
this.next = MotaActionBlocks['switch_s'].xmlText([
// MotaActionBlocks['evalString_e'].xmlText([data.condition]),
this.tryToUseEvFlag_e('evalString_e', [data.condition]),
case_caseList,this.next]);
break;
case "choices": // 提供选项
var text_choices = null;
for(var ii=data.choices.length-1,choice;choice=data.choices[ii];ii--) {
text_choices=MotaActionBlocks['choicesContext'].xmlText([
choice.text,this.insertActionList(choice.action),text_choices]);
}
this.next = MotaActionBlocks['choices_s'].xmlText([
this.isset(data.text)?this.EvalString(data.text):null,'','',text_choices,this.next]);
break;
case "while": // 循环处理
this.next = MotaActionBlocks['while_s'].xmlText([
// MotaActionBlocks['evalString_e'].xmlText([data.condition]),
this.tryToUseEvFlag_e('evalString_e', [data.condition]),
this.insertActionList(data["data"]),
this.next]);
break;
case "break": // 跳出循环
this.next = MotaActionBlocks['break_s'].xmlText([
this.next]);
break;
case "continue": // 继续执行当前循环
this.next = MotaActionBlocks['continue_s'].xmlText([
this.next]);
break;
case "win":
this.next = MotaActionBlocks['win_s'].xmlText([
data.reason,data.norank?true:false,this.next]);
break;
case "lose":
this.next = MotaActionBlocks['lose_s'].xmlText([
data.reason,this.next]);
break;
case "function":
var func = data["function"];
func=func.split('{').slice(1).join('{').split('}').slice(0,-1).join('}').trim().split('\n').join('\\n');
this.next = MotaActionBlocks['function_s'].xmlText([
data.async||false,func,this.next]);
break;
case "update":
this.next = MotaActionBlocks['update_s'].xmlText([
this.next]);
break;
case "showStatusBar":
this.next = MotaActionBlocks['showStatusBar_s'].xmlText([
this.next]);
break;
case "hideStatusBar":
this.next = MotaActionBlocks['hideStatusBar_s'].xmlText([
data.toolbox||false,this.next]);
break;
case "updateEnemys":
this.next = MotaActionBlocks['updateEnemys_s'].xmlText([
this.next]);
break;
case "sleep": // 等待多少毫秒
this.next = MotaActionBlocks['sleep_s'].xmlText([
data.time||0,data.noSkip||false,this.next]);
break;
case "wait": // 等待用户操作
this.next = MotaActionBlocks['wait_s'].xmlText([
this.next]);
break;
case "waitAsync": // 等待所有异步事件执行完毕
this.next = MotaActionBlocks['waitAsync_s'].xmlText([
this.next]);
break;
case "revisit": // 立刻重新执行该事件
this.next = MotaActionBlocks['revisit_s'].xmlText([
this.next]);
break;
case "callBook": // 呼出怪物手册
this.next = MotaActionBlocks['callBook_s'].xmlText([
this.next]);
break;
case "callSave": // 呼出存档界面
this.next = MotaActionBlocks['callSave_s'].xmlText([
this.next]);
break;
case "callLoad": // 呼出读档界面
this.next = MotaActionBlocks['callLoad_s'].xmlText([
this.next]);
break;
case "exit": // 立刻结束事件
this.next = MotaActionBlocks['exit_s'].xmlText([
this.next]);
break;
case "animateImage": // 兼容 animateImage
break;
default:
throw new Error("[警告]出错啦!\n"+data.type+" 事件不被支持...");
}
this.parseAction();
return;
}
////// 往当前事件列表之后添加一个事件组 //////
ActionParser.prototype.insertActionList = function (actionList) {
if (actionList.length===0) return null;
this.event.data.list.push({"type": "_next", "next": this.next});
this.event.data.list=this.event.data.list.concat(actionList);
this.next = null;
this.parseAction();
return this.result;
}
////// 判断某对象是否不为undefined也不会null //////
ActionParser.prototype.isset = function (val) {
if (val === undefined || val === null) {
return false;
}
return true
}
ActionParser.prototype.StepString = function(steplist) {
var stepchar = {
'up': '上',
'down': '下',
'left': '左',
'right': '右'
}
var StepString = [];
for(var ii=0,obj;obj=steplist[ii];ii++) {
if(typeof(obj)===typeof('')) {
StepString.push(stepchar[obj]);
} else {
StepString.push(stepchar[obj['direction']]);
StepString.push(obj['value']);
}
}
return StepString.join('');
}
ActionParser.prototype.EvalString = function(EvalString) {
return EvalString.split('\b').join('\\b').split('\t').join('\\t').split('\n').join('\\n');
}
ActionParser.prototype.tryToUseEvFlag_e = function(defaultType, args, isShadow, comment) {
var match=/^switch:([A-F])$/.exec(args[0])
if(match){
args[0]=match[1]
return MotaActionBlocks['evFlag_e'].xmlText(args, isShadow, comment);
}
return MotaActionBlocks[defaultType||'evalString_e'].xmlText(args, isShadow, comment);
}
MotaActionFunctions.actionParser = new ActionParser();
MotaActionFunctions.workspace = function(){return workspace}
MotaActionFunctions.parse = function(obj,type) {
MotaActionFunctions.workspace().clear();
xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event');
xml = Blockly.Xml.textToDom('<xml>'+xml_text+'</xml>');
Blockly.Xml.domToWorkspace(xml, MotaActionFunctions.workspace());
}
MotaActionFunctions.EvalString_pre = function(EvalString){
if (EvalString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__,如door1,door2,door3等依次向后。请勿存在两个门使用相同的开门变量。');
return EvalString.replace(/([^\\])"/g,'$1\\"').replace(/^"/g,'\\"').replace(/""/g,'"\\"');
}
MotaActionFunctions.IdString_pre = function(IdString){
if (IdString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__,如door1,door2,door3等依次向后。请勿存在两个门使用相同的开门变量。');
if (IdString && !(/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(IdString)))throw new Error('id: '+IdString+'中包含了0-9 a-z A-Z _ - :之外的字符');
return IdString;
}
MotaActionFunctions.PosString_pre = function(PosString){
if (!PosString || /^-?\d+$/.test(PosString)) return PosString;
if (!(/^flag:[0-9a-zA-Z_][0-9a-zA-Z_:]*$/.test(PosString)))throw new Error(PosString+'中包含了0-9 a-z A-Z _ :之外的字符,或者是没有以flag: 开头');
return '"'+PosString+'"';
}
MotaActionFunctions.StepString_pre = function(StepString){
//StepString='上右3下2左上左2'
var route = StepString.replace(/上/g,'U').replace(/下/g,'D').replace(/左/g,'L').replace(/右/g,'R');
//copyed from core.js
var ans=[], index=0;
var isset = function(a) {
if (a == undefined || a == null) {
return false;
}
return true;
}
var getNumber = function (noparse) {
var num="";
while (index<route.length && !isNaN(route.charAt(index))) {
num+=route.charAt(index++);
}
if (num.length==0) num="1";
return isset(noparse)?num:parseInt(num);
}
while (index<route.length) {
var c=route.charAt(index++);
var number=getNumber();
switch (c) {
case "U": for (var i=0;i<number;i++) ans.push("up"); break;
case "D": for (var i=0;i<number;i++) ans.push("down"); break;
case "L": for (var i=0;i<number;i++) ans.push("left"); break;
case "R": for (var i=0;i<number;i++) ans.push("right"); break;
}
}
return ans;
}
*/ |
src/AssocFree/STLambdaC/Exp.agda | agda/agda-assoc-free | 3 | 13204 | <gh_stars>1-10
open import Function using () renaming ( _∘′_ to _∘_ )
open import Relation.Binary.PropositionalEquality using
( _≡_ ; refl ; sym ; cong ; cong₂ ; subst )
open import AssocFree.Util using ( subst-natural )
import AssocFree.STLambdaC.Typ
open Relation.Binary.PropositionalEquality.≡-Reasoning using ( begin_ ; _≡⟨_⟩_ ; _∎ )
module AssocFree.STLambdaC.Exp
(TConst : Set)
(Const : AssocFree.STLambdaC.Typ.Typ TConst → Set) where
open module Typ = AssocFree.STLambdaC.Typ TConst using
( Typ ; Var ; Ctxt ; const ; _⇝_
; [] ; [_] ; _++_ ; _∷_ ; _∈_ ; _≪_ ; _≫_ ; _⋙_ ; uniq ; singleton
; Case ; case ; inj₁ ; inj₂ ; inj₃ ; case-≪ ; case-≫ ; case-⋙
; Case₃ ; case₃ ; caseˡ ; caseʳ ; caseˡ₃ ; caseʳ₃ ; case⁻¹ ; case-iso )
-- Syntax
data Exp (Γ : Ctxt) : Typ → Set where
const : ∀ {T} → Const T → Exp Γ T
abs : ∀ T {U} → Exp (T ∷ Γ) U → Exp Γ (T ⇝ U)
app : ∀ {T U} → Exp Γ (T ⇝ U) → Exp Γ T → Exp Γ U
var : ∀ {T} → (T ∈ Γ) → Exp Γ T
-- Shorthand
var₀ : ∀ {Γ T} → Exp (T ∷ Γ) T
var₀ {Γ} {T} = var (singleton T ≪ Γ)
var₁ : ∀ {Γ T U} → Exp (U ∷ (T ∷ Γ)) T
var₁ {Γ} {T} {U} = var ([ U ] ≫ singleton T ≪ Γ)
var₂ : ∀ {Γ T U V} → Exp (V ∷ (U ∷ (T ∷ Γ))) T
var₂ {Γ} {T} {U} {V} = var ([ V ] ≫ [ U ] ≫ singleton T ≪ Γ)
-- <NAME> suggested defining substitution and renaming together, citing:
--
-- <NAME>
-- Type Preserving Renaming and Substitution
--
-- <NAME> and <NAME>
-- Monadic Presentations of Lambda Terms Using Generalized Inductive Types
--
-- http://www2.tcs.ifi.lmu.de/~abel/ParallelSubstitution.agda
-- The idea is to define two kinds, for expressions and variables,
-- such that the kind of variables is contained in the kind of
-- expressions (so admits recursion).
mutual
data Kind : Set where
var : Kind
exp : ∀ {k} → IsVar k → Kind
data IsVar : Kind → Set where
var : IsVar var
Thing : Kind → Ctxt → Typ → Set
Thing var Γ T = (T ∈ Γ)
Thing (exp var) Γ T = Exp Γ T
Substn : Kind → Ctxt → Ctxt → Set
Substn k Γ Δ = ∀ {T} → (T ∈ Δ) → Thing k Γ T
-- Convert between variables, things and expressions
thing : ∀ {k Γ T} → (T ∈ Γ) → Thing k Γ T
thing {var} x = x
thing {exp var} x = var x
expr : ∀ {k Γ T} → Thing k Γ T → Exp Γ T
expr {var} x = var x
expr {exp var} M = M
-- Extensional equivalence on substitutions (note: not assuming extensionality)
_≈_ : ∀ {k Γ Δ} → Substn k Γ Δ → Substn k Γ Δ → Set
ρ ≈ σ = ∀ {T} x → ρ {T} x ≡ σ {T} x
-- Identity substitution
id : ∀ {k} Γ → Substn k Γ Γ
id {var} Γ x = x
id {exp var} Γ x = var x
-- Product structure of substitutions
fst : ∀ Γ Δ → Substn var (Γ ++ Δ) Γ
fst Γ Δ x = x ≪ Δ
snd : ∀ Γ Δ → Substn var (Γ ++ Δ) Δ
snd Γ Δ x = Γ ≫ x
choose : ∀ {k Γ Δ E T} → Substn k Γ Δ → Substn k Γ E → (Case T Δ E) → Thing k Γ T
choose ρ σ (inj₁ x) = ρ x
choose ρ σ (inj₂ x) = σ x
_&&&_ : ∀ {k Γ Δ E} → Substn k Γ Δ → Substn k Γ E → Substn k Γ (Δ ++ E)
(ρ &&& σ) = choose ρ σ ∘ case _ _
-- Singleton substitution
⟨_⟩ : ∀ {k Γ T} → Thing k Γ T → Substn k Γ [ T ]
⟨ M ⟩ x = subst (Thing _ _) (uniq x) M
-- Cons on substitutions
_◁_ : ∀ {k Γ Δ T} → Thing k Γ T → Substn k Γ Δ → Substn k Γ (T ∷ Δ)
M ◁ σ = ⟨ M ⟩ &&& σ
-- Applying a substitution
mutual
substn+ : ∀ {k} B Γ Δ → Substn k Γ Δ → ∀ {T} → Exp (B ++ Δ) T → Exp (B ++ Γ) T
substn+ B Γ Δ σ (const c) = const c
substn+ B Γ Δ σ (abs T M) = abs T (substn+ (T ∷ B) Γ Δ σ M)
substn+ B Γ Δ σ (app M N) = app (substn+ B Γ Δ σ M) (substn+ B Γ Δ σ N)
substn+ B Γ Δ σ (var x) = expr (xsubstn+ B Γ Δ σ (case B Δ x))
xsubstn+ : ∀ {k} B Γ Δ → Substn k Γ Δ → ∀ {T} → (Case T B Δ) → Thing k (B ++ Γ) T
xsubstn+ B Γ Δ σ (inj₁ x) = thing (x ≪ Γ)
xsubstn+ {var} B Γ Δ σ (inj₂ x) = B ≫ σ x
xsubstn+ {exp var} B Γ Δ σ (inj₂ x) = substn+ [] (B ++ Γ) Γ (snd B Γ) (σ x) -- weaken* B (σ x)
-- Shorthands
substn* : ∀ {k Γ Δ} → Substn k Γ Δ → ∀ {T} → Exp Δ T → Exp Γ T
substn* {k} {Γ} {Δ} = substn+ [] Γ Δ
substn : ∀ {Γ T U} → Exp Γ T → Exp (T ∷ Γ) U → Exp Γ U
substn {Γ} M = substn* (M ◁ id Γ)
xweaken+ : ∀ B Γ Δ {T} → (T ∈ (B ++ Δ)) → (T ∈ (B ++ Γ ++ Δ))
xweaken+ B Γ Δ x = xsubstn+ B (Γ ++ Δ) Δ (snd Γ Δ) (case B Δ x)
weaken+ : ∀ B Γ Δ {T} → Exp (B ++ Δ) T → Exp (B ++ Γ ++ Δ) T
weaken+ B Γ Δ = substn+ B (Γ ++ Δ) Δ (snd Γ Δ)
weaken* : ∀ Γ {Δ T} → Exp Δ T → Exp (Γ ++ Δ) T
weaken* Γ {Δ} = weaken+ [] Γ Δ
weakens* : ∀ {Γ Δ} E → Substn (exp var) Γ Δ → Substn (exp var) (E ++ Γ) Δ
weakens* E σ x = weaken* E (σ x)
weaken*ʳ : ∀ {Γ} Δ {T} → Exp Γ T → Exp (Γ ++ Δ) T
weaken*ʳ {Γ} Δ = weaken+ Γ Δ []
weaken : ∀ {Γ} T {U} → Exp Γ U → Exp (T ∷ Γ) U
weaken T = weaken* [ T ]
-- Composition of substitutions
_⊔_ : Kind → Kind → Kind
k ⊔ var = k
k ⊔ exp var = exp var
_∙_ : ∀ {k l Γ Δ E} → Substn k Γ Δ → Substn l Δ E → Substn (k ⊔ l) Γ E
_∙_ {k} {var} ρ σ = ρ ∘ σ
_∙_ {k} {exp var} ρ σ = substn* ρ ∘ σ
-- Functorial action of ++ on substitutions
par : ∀ {k Γ Δ Φ Ψ T} → Substn k Γ Φ → Substn k Δ Ψ → (Case T Φ Ψ) → Thing k (Γ ++ Δ) T
par {var} {Γ} {Δ} ρ σ (inj₁ x) = ρ x ≪ Δ
par {var} {Γ} {Δ} ρ σ (inj₂ x) = Γ ≫ σ x
par {exp var} {Γ} {Δ} ρ σ (inj₁ x) = weaken*ʳ Δ (ρ x)
par {exp var} {Γ} {Δ} ρ σ (inj₂ x) = weaken* Γ (σ x)
_+++_ : ∀ {k Γ Δ Φ Ψ} → Substn k Γ Δ → Substn k Φ Ψ → Substn k (Γ ++ Φ) (Δ ++ Ψ)
(ρ +++ σ) = par ρ σ ∘ case _ _
-- Weakening a variable is a variable
weaken*-var : ∀ Γ {Δ T} (x : T ∈ Δ) →
weaken* Γ (var x) ≡ var (Γ ≫ x)
weaken*-var Γ {Δ} x = cong (expr ∘ xsubstn+ [] (Γ ++ Δ) Δ (snd Γ Δ)) (case-≫ [] x)
weaken*ʳ-var : ∀ {Γ} Δ {T} (x : T ∈ Γ) →
weaken*ʳ Δ (var x) ≡ var (x ≪ Δ)
weaken*ʳ-var {Γ} Δ x = cong (expr ∘ xsubstn+ Γ Δ [] (snd Δ [])) (case-≪ x [])
weaken+-var₀ : ∀ B Γ Δ {T} →
weaken+ (T ∷ B) Γ Δ (var₀ {B ++ Δ}) ≡ var₀ {B ++ Γ ++ Δ}
weaken+-var₀ B Γ Δ {T} =
cong (var ∘ xsubstn+ (T ∷ B) (Γ ++ Δ) Δ (snd Γ Δ)) (case-≪ (singleton T ≪ B) Δ)
-- Substitution respects extensional equality
substn+-cong : ∀ {k} B Γ Δ {σ : Substn k Γ Δ} {ρ : Substn k Γ Δ} →
(σ ≈ ρ) → ∀ {T} M → substn+ B Γ Δ σ {T} M ≡ substn+ B Γ Δ ρ M
substn+-cong B Γ Δ σ≈ρ (const c) = refl
substn+-cong B Γ Δ σ≈ρ (abs T M) = cong (abs {B ++ Γ} T) (substn+-cong (T ∷ B) Γ Δ σ≈ρ M)
substn+-cong B Γ Δ σ≈ρ (app M N) = cong₂ app (substn+-cong B Γ Δ σ≈ρ M) (substn+-cong B Γ Δ σ≈ρ N)
substn+-cong B Γ Δ σ≈ρ (var x) = cong expr (xsubstn+-cong B Γ Δ σ≈ρ (case B Δ x)) where
xsubstn+-cong : ∀ {k} B Γ Δ {σ : Substn k Γ Δ} {ρ : Substn k Γ Δ} →
(σ ≈ ρ) → ∀ {T} x → xsubstn+ B Γ Δ σ {T} x ≡ xsubstn+ B Γ Δ ρ x
xsubstn+-cong {var} B Γ Δ σ≈ρ (inj₁ x) = refl
xsubstn+-cong {exp var} B Γ Δ σ≈ρ (inj₁ x) = refl
xsubstn+-cong {var} B Γ Δ σ≈ρ (inj₂ x) = cong (_≫_ B) (σ≈ρ x)
xsubstn+-cong {exp var} B Γ Δ σ≈ρ (inj₂ x) = cong (substn+ [] (B ++ Γ) Γ (snd B Γ)) (σ≈ρ x)
substn*-cong : ∀ {k Γ Δ} {σ : Substn k Γ Δ} {ρ : Substn k Γ Δ} →
(σ ≈ ρ) → ∀ {T} M → substn* σ {T} M ≡ substn* ρ M
substn*-cong {k} {Γ} {Δ} = substn+-cong [] Γ Δ
-- Identity of substitutions
xsubstn+-id : ∀ {k} B Γ {T} (x : Case T B Γ) →
expr (xsubstn+ B Γ Γ (id {k} Γ) x) ≡ var (case⁻¹ x)
xsubstn+-id {var} B Γ (inj₁ x) = refl
xsubstn+-id {exp var} B Γ (inj₁ x) = refl
xsubstn+-id {var} B Γ (inj₂ x) = refl
xsubstn+-id {exp var} B Γ (inj₂ x) = weaken*-var B x
substn+-id : ∀ {k} B Γ {T} (M : Exp (B ++ Γ) T) → substn+ B Γ Γ (id {k} Γ) M ≡ M
substn+-id B Γ (const c) = refl
substn+-id B Γ (abs T M) = cong (abs {B ++ Γ} T) (substn+-id (T ∷ B) Γ M)
substn+-id B Γ (app M N) = cong₂ app (substn+-id B Γ M) (substn+-id B Γ N)
substn+-id {k} B Γ (var x) =
begin
substn+ B Γ Γ (id {k} Γ) (var x)
≡⟨ xsubstn+-id {k} B Γ (case B Γ x) ⟩
var (case⁻¹ (case B Γ x))
≡⟨ cong var (case-iso B Γ x) ⟩
var x
∎
substn*-id : ∀ {k Γ T} (M : Exp Γ T) → substn* (id {k} Γ) M ≡ M
substn*-id {k} {Γ} = substn+-id [] Γ
weaken*-[] : ∀ {Γ T} (M : Exp Γ T) → weaken* [] M ≡ M
weaken*-[] M = substn*-id M
mutual
-- Composition of substitutions
substn+-∙ : ∀ {k l} B Γ Δ E (σ : Substn k Γ Δ) (ρ : Substn l Δ E) {T} (M : Exp (B ++ E) T) →
(substn+ B Γ Δ σ (substn+ B Δ E ρ M) ≡ substn+ B Γ E (σ ∙ ρ) M)
substn+-∙ B Γ Δ E ρ σ (const c) = refl
substn+-∙ B Γ Δ E ρ σ (abs T M) = cong (abs {B ++ Γ} T) (substn+-∙ (T ∷ B) Γ Δ E ρ σ M)
substn+-∙ B Γ Δ E ρ σ (app M N) = cong₂ app (substn+-∙ B Γ Δ E ρ σ M) (substn+-∙ B Γ Δ E ρ σ N)
substn+-∙ B Γ Δ E ρ σ (var x) = xsubstn+-∙ B Γ Δ E ρ σ (case B E x) where
xsubstn+-∙ : ∀ {k l} B Γ Δ E (σ : Substn k Γ Δ) (ρ : Substn l Δ E) {T} (x : Case T B E) →
(substn+ B Γ Δ σ (expr (xsubstn+ B Δ E ρ x)) ≡ expr (xsubstn+ B Γ E (σ ∙ ρ) x))
xsubstn+-∙ {k} {var} B Γ Δ E σ ρ (inj₁ x) =
cong (expr ∘ xsubstn+ B Γ Δ σ) (case-≪ x Δ)
xsubstn+-∙ {var} {exp var} B Γ Δ E σ ρ (inj₁ x) =
cong (expr ∘ xsubstn+ B Γ Δ σ) (case-≪ x Δ)
xsubstn+-∙ {exp var} {exp var} B Γ Δ E σ ρ (inj₁ x) =
cong (expr ∘ xsubstn+ B Γ Δ σ) (case-≪ x Δ)
xsubstn+-∙ {var} {var} B Γ Δ E σ ρ (inj₂ x) =
cong (expr ∘ xsubstn+ B Γ Δ σ) (case-≫ B (ρ x))
xsubstn+-∙ {exp var} {var} B Γ Δ E σ ρ (inj₂ x) =
cong (expr ∘ xsubstn+ B Γ Δ σ) (case-≫ B (ρ x))
xsubstn+-∙ {var} {exp var} B Γ Δ E σ ρ (inj₂ x) =
begin
substn+ B Γ Δ σ (weaken* B (ρ x))
≡⟨ substn+* B Γ Δ σ (weaken* B (ρ x)) ⟩
substn* (id B +++ σ) (weaken* B (ρ x))
≡⟨ substn+-∙ [] (B ++ Γ) (B ++ Δ) Δ (id B +++ σ) (snd B Δ) (ρ x) ⟩
substn* ((id B +++ σ) ∙ snd B Δ) (ρ x)
≡⟨ substn*-cong (λ y → cong (par (id B) σ) (case-≫ B y)) (ρ x) ⟩
substn* (snd B Γ ∙ σ) (ρ x)
≡⟨ sym (substn+-∙ [] (B ++ Γ) Γ Δ (snd B Γ) σ (ρ x)) ⟩
weaken* B (substn* σ (ρ x))
∎
xsubstn+-∙ {exp var} {exp var} B Γ Δ E σ ρ (inj₂ x) =
begin
substn+ B Γ Δ σ (weaken* B (ρ x))
≡⟨ substn+* B Γ Δ σ (weaken* B (ρ x)) ⟩
substn* (id B +++ σ) (weaken* B (ρ x))
≡⟨ substn+-∙ [] (B ++ Γ) (B ++ Δ) Δ (id B +++ σ) (snd B Δ) (ρ x) ⟩
substn* ((id B +++ σ) ∙ snd B Δ) (ρ x)
≡⟨ substn*-cong (λ y → cong (par (id B) σ) (case-≫ B y))(ρ x) ⟩
substn* (snd B Γ ∙ σ) (ρ x)
≡⟨ sym (substn+-∙ [] (B ++ Γ) Γ Δ (snd B Γ) σ (ρ x)) ⟩
weaken* B (substn* σ (ρ x))
∎
substn*-∙ : ∀ {k l Γ Δ E} (σ : Substn k Γ Δ) (ρ : Substn l Δ E) {T} (M : Exp E T) →
(substn* σ (substn* ρ M) ≡ substn* (σ ∙ ρ) M)
substn*-∙ {k} {l} {Γ} {Δ} {E} = substn+-∙ [] Γ Δ E
-- Proof uses the fact that substn+ is an instance of substn*
substn++ : ∀ {k} A B Γ Δ (σ : Substn k Γ Δ) {T} (M : Exp (A ++ B ++ Δ) T) →
substn+ (A ++ B) Γ Δ σ M ≡ substn+ A (B ++ Γ) (B ++ Δ) (id B +++ σ) M
substn++ A B Γ Δ σ (const c) = refl
substn++ A B Γ Δ σ (abs T M) = cong (abs {A ++ B ++ Γ} T) (substn++ (T ∷ A) B Γ Δ σ M)
substn++ A B Γ Δ σ (app M N) = cong₂ app (substn++ A B Γ Δ σ M) (substn++ A B Γ Δ σ N)
substn++ A B Γ Δ σ (var x) = cong expr (begin
xsubstn+ (A ++ B) Γ Δ σ (case (A ++ B) Δ x)
≡⟨ cong (xsubstn+ (A ++ B) Γ Δ σ) (sym (caseˡ₃ A B Δ x)) ⟩
xsubstn+ (A ++ B) Γ Δ σ (caseˡ (case₃ A B Δ x))
≡⟨ xsubstn++ A B Γ Δ σ (case₃ A B Δ x) ⟩
xsubstn+ A (B ++ Γ) (B ++ Δ) (id B +++ σ) (caseʳ (case₃ A B Δ x))
≡⟨ cong (xsubstn+ A (B ++ Γ) (B ++ Δ) (id B +++ σ)) (caseʳ₃ A B Δ x) ⟩
xsubstn+ A (B ++ Γ) (B ++ Δ) (id B +++ σ) (case A (B ++ Δ) x)
∎) where
xsubstn++ : ∀ {k} A B Γ Δ (σ : Substn k Γ Δ) {T} (x : Case₃ T A B Δ) →
xsubstn+ (A ++ B) Γ Δ σ (caseˡ x) ≡ xsubstn+ A (B ++ Γ) (B ++ Δ) (id B +++ σ) (caseʳ x)
xsubstn++ A B Γ Δ σ (inj₁ x) = refl
xsubstn++ {var} A B Γ Δ σ (inj₂ x) = cong (λ X → A ≫ par (id B) σ X) (sym (case-≪ x Δ))
xsubstn++ {exp var} A B Γ Δ σ (inj₂ x) =
begin
var (A ≫ x ≪ Γ)
≡⟨ sym (weaken*-var A (x ≪ Γ)) ⟩
weaken* A (var (x ≪ Γ))
≡⟨ cong (weaken* A) (sym (weaken*ʳ-var Γ x)) ⟩
weaken* A (weaken*ʳ Γ (var x))
≡⟨ cong (weaken* A ∘ par (id B) σ) (sym (case-≪ x Δ)) ⟩
weaken* A ((id B +++ σ) (x ≪ Δ))
∎
xsubstn++ {var} A B Γ Δ σ (inj₃ x) = cong (λ X → A ≫ par (id B) σ X) (sym (case-≫ B x))
xsubstn++ {exp var} A B Γ Δ σ (inj₃ x) =
begin
weaken* (A ++ B) (σ x)
≡⟨ sym (substn*-∙ (snd A (B ++ Γ)) (snd B Γ) (σ x)) ⟩
weaken* A (weaken* B (σ x))
≡⟨ cong (weaken* A ∘ par (id B) σ) (sym (case-≫ B x)) ⟩
weaken* A ((id B +++ σ) (B ≫ x))
∎
substn+* : ∀ {k} B Γ Δ (σ : Substn k Γ Δ) {T} (M : Exp (B ++ Δ) T) →
substn+ B Γ Δ σ M ≡ substn* (id B +++ σ) M
substn+* = substn++ []
-- Weakening of weakening is weakening
weaken*-++ : ∀ A B Γ {T} (M : Exp Γ T) →
weaken* A (weaken* B M) ≡ weaken* (A ++ B) M
weaken*-++ A B Γ = substn*-∙ (snd A (B ++ Γ)) (snd B Γ)
-- Weakening commutes with weakening
weaken*-comm : ∀ A B Γ Δ {U} (M : Exp (B ++ Δ) U) →
weaken* A (weaken+ B Γ Δ M)
≡ weaken+ (A ++ B) Γ Δ (weaken* A M)
weaken*-comm A B Γ Δ M =
begin
weaken* A (weaken+ B Γ Δ M)
≡⟨ cong (substn* (snd A (B ++ Γ ++ Δ))) (substn+* B (Γ ++ Δ) Δ (snd Γ Δ) M) ⟩
substn* (snd A (B ++ Γ ++ Δ)) (substn* (id B +++ snd Γ Δ) M)
≡⟨ substn*-∙ (snd A (B ++ Γ ++ Δ)) (id B +++ snd Γ Δ) M ⟩
substn* (snd A (B ++ Γ ++ Δ) ∙ (id B +++ snd Γ Δ)) M
≡⟨ substn*-cong lemma₂ M ⟩
substn* ((id (A ++ B) +++ snd Γ Δ) ∙ snd A (B ++ Δ)) M
≡⟨ sym (substn*-∙ (id (A ++ B) +++ snd Γ Δ) (snd A (B ++ Δ)) M) ⟩
substn* (id (A ++ B) +++ snd Γ Δ) (substn* (snd A (B ++ Δ)) M)
≡⟨ sym (substn+* (A ++ B) (Γ ++ Δ) Δ (snd Γ Δ) (substn* (snd A (B ++ Δ)) M)) ⟩
weaken+ (A ++ B) Γ Δ (weaken* A M)
∎ where
lemma₁ : ∀ {T} (x : Case T B Δ) →
snd A (B ++ Γ ++ Δ) (par (id B) (snd Γ Δ) x)
≡ (par (id (A ++ B)) (snd Γ Δ) (A ⋙ x))
lemma₁ (inj₁ x) = refl
lemma₁ (inj₂ x) = refl
lemma₂ : (snd A (B ++ Γ ++ Δ) ∙ (id B +++ snd Γ Δ)) ≈ ((id (A ++ B) +++ snd Γ Δ) ∙ snd A (B ++ Δ))
lemma₂ {T} x =
begin
snd A (B ++ Γ ++ Δ) (par (id B) (snd Γ Δ) (case B Δ x))
≡⟨ lemma₁ (case B Δ x) ⟩
par (id (A ++ B)) (snd Γ Δ) (A ⋙ (case B Δ x))
≡⟨ cong (par (id (A ++ B)) (snd Γ Δ)) (case-⋙ A B Δ x) ⟩
par (id (A ++ B)) (snd Γ Δ) (case (A ++ B) Δ (A ≫ x))
∎
weaken-comm : ∀ T B Γ Δ {U} (M : Exp (B ++ Δ) U) →
weaken T (weaken+ B Γ Δ M)
≡ weaken+ (T ∷ B) Γ Δ (weaken T M)
weaken-comm T = weaken*-comm [ T ]
-- Weakening distributes through susbtn
weaken-substn : ∀ B Γ Δ {T U} (M : Exp (B ++ Δ) T) (N : Exp (T ∷ B ++ Δ) U) →
substn (weaken+ B Γ Δ M) (weaken+ (T ∷ B) Γ Δ N)
≡ weaken+ B Γ Δ (substn M N)
weaken-substn B Γ Δ {T} M N = begin
substn (weaken+ B Γ Δ M) (weaken+ (T ∷ B) Γ Δ N)
≡⟨ cong₂ substn (substn+* B (Γ ++ Δ) Δ (snd Γ Δ) M) (substn+* (T ∷ B) (Γ ++ Δ) Δ (snd Γ Δ) N) ⟩
substn (substn* (id B +++ snd Γ Δ) M) (substn* (id (T ∷ B) +++ snd Γ Δ) N)
≡⟨ substn*-∙ (substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ)) (id (T ∷ B) +++ snd Γ Δ) N ⟩
substn* ((substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ)) ∙ (id (T ∷ B) +++ snd Γ Δ)) N
≡⟨ substn*-cong lemma₂ N ⟩
substn* ((id B +++ snd Γ Δ) ∙ (M ◁ id (B ++ Δ))) N
≡⟨ sym (substn*-∙ (id B +++ snd Γ Δ) (M ◁ id (B ++ Δ)) N) ⟩
substn* (id B +++ snd Γ Δ) (substn M N)
≡⟨ sym (substn+* B (Γ ++ Δ) Δ (snd Γ Δ) (substn M N)) ⟩
weaken+ B Γ Δ (substn M N)
∎ where
lemma₁ : ∀ {S} (x : Case₃ S [ T ] B Δ) →
(substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ))
(par (id (T ∷ B)) (snd Γ Δ) (caseˡ x))
≡ substn* (id B +++ snd Γ Δ)
(choose ⟨ M ⟩ (id (B ++ Δ)) (caseʳ x))
lemma₁ (inj₁ x) = begin
(substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ)) (x ≪ B ≪ Γ ≪ Δ)
≡⟨ cong (choose ⟨ substn* (id B +++ snd Γ Δ) M ⟩ (id (B ++ Γ ++ Δ))) (case-≪ x (B ++ Γ ++ Δ)) ⟩
⟨ substn* (id B +++ snd Γ Δ) M ⟩ x
≡⟨ subst-natural (uniq x) (substn* (id B +++ snd Γ Δ)) M ⟩
substn* (id B +++ snd Γ Δ) (⟨ M ⟩ x)
∎
lemma₁ (inj₂ x) = begin
(substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ)) ([ T ] ≫ x ≪ Γ ≪ Δ)
≡⟨ cong (choose ⟨ substn* (id B +++ snd Γ Δ) M ⟩ (id (B ++ Γ ++ Δ))) (case-≫ [ T ] (x ≪ Γ ≪ Δ)) ⟩
var (x ≪ Γ ≪ Δ)
≡⟨ cong (var ∘ par (id B) (snd Γ Δ)) (sym (case-≪ x Δ)) ⟩
var ((id B +++ snd Γ Δ) (x ≪ Δ))
≡⟨ cong (var ∘ xsubstn+ [] (B ++ Γ ++ Δ) (B ++ Δ) (id B +++ snd Γ Δ)) (sym (case-≫ [] (x ≪ Δ))) ⟩
substn* (id B +++ snd Γ Δ) (var (x ≪ Δ))
∎
lemma₁ (inj₃ x) = begin
(substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ)) ([ T ] ≫ B ≫ Γ ≫ x)
≡⟨ cong (choose ⟨ substn* (id B +++ snd Γ Δ) M ⟩ (id (B ++ Γ ++ Δ))) (case-≫ [ T ] (B ≫ Γ ≫ x)) ⟩
var (B ≫ Γ ≫ x)
≡⟨ cong (var ∘ par (id B) (snd Γ Δ)) (sym (case-≫ B x)) ⟩
var ((id B +++ snd Γ Δ) (B ≫ x))
≡⟨ cong (var ∘ xsubstn+ [] (B ++ Γ ++ Δ) (B ++ Δ) (id B +++ snd Γ Δ)) (sym (case-≫ [] (B ≫ x))) ⟩
substn* (id B +++ snd Γ Δ) (var (B ≫ x))
∎
lemma₂ : ((substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ)) ∙ (id (T ∷ B) +++ snd Γ Δ))
≈ ((id B +++ snd Γ Δ) ∙ (M ◁ id (B ++ Δ)))
lemma₂ {S} x = begin
((substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ)) ∙ (id (T ∷ B) +++ snd Γ Δ)) x
≡⟨ cong (substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ) ∘ par (id (T ∷ B)) (snd Γ Δ))
(sym (caseˡ₃ [ T ] B Δ x)) ⟩
(substn* (id B +++ snd Γ Δ) M ◁ id (B ++ Γ ++ Δ))
(par (id (T ∷ B)) (snd Γ Δ) (caseˡ (case₃ [ T ] B Δ x)))
≡⟨ lemma₁ (case₃ [ T ] B Δ x) ⟩
substn* (id B +++ snd Γ Δ)
(choose ⟨ M ⟩ (id (B ++ Δ)) (caseʳ (case₃ [ T ] B Δ x)))
≡⟨ cong (substn* (id B +++ snd Γ Δ) ∘ choose ⟨ M ⟩ (id (B ++ Δ)))
(caseʳ₃ [ T ] B Δ x) ⟩
((id B +++ snd Γ Δ) ∙ (M ◁ id (B ++ Δ))) x
∎
-- Substitution into weakening discards the substitution
substn-weaken : ∀ {Γ T U} (M : Exp Γ U) (N : Exp Γ T) →
substn N (weaken T M) ≡ M
substn-weaken {Γ} {T} M N =
begin
substn N (weaken T M)
≡⟨ substn*-∙ (N ◁ id Γ) (snd [ T ] Γ) M ⟩
substn* ((N ◁ id Γ) ∙ snd [ T ] Γ) M
≡⟨ substn*-cong (λ x → cong (choose ⟨ N ⟩ (id Γ)) (case-≫ [ T ] x)) M ⟩
substn* (id Γ) M
≡⟨ substn*-id M ⟩
M
∎
-- Substitution + weakening respects ◁
substn*-◁ : ∀ Γ Δ E {T U} (M : Exp (T ∷ Γ) U) (N : Exp (E ++ Δ) T) (σ : Substn (exp var) Δ Γ) →
substn* (N ◁ weakens* E σ) M
≡ substn N (weaken+ [ T ] E Δ (substn+ [ T ] Δ Γ σ M))
substn*-◁ Γ Δ E {T} M N σ =
begin
substn* (N ◁ weakens* E σ) M
≡⟨ substn*-cong (λ x → lemma (case [ T ] Γ x)) M ⟩
substn* ((N ◁ id (E ++ Δ)) ∙ (id [ T ] +++ (snd E Δ ∙ σ))) M
≡⟨ sym (substn*-∙ (N ◁ id (E ++ Δ)) (id [ T ] +++ (snd E Δ ∙ σ)) M) ⟩
substn N (substn* (id [ T ] +++ (snd E Δ ∙ σ)) M)
≡⟨ cong (substn N) (sym (substn+* [ T ] (E ++ Δ) Γ (snd E Δ ∙ σ) M)) ⟩
substn N (substn+ [ T ] (E ++ Δ) Γ (snd E Δ ∙ σ) M)
≡⟨ cong (substn N) (sym (substn+-∙ [ T ] (E ++ Δ) Δ Γ (snd E Δ) σ M)) ⟩
substn N (weaken+ [ T ] E Δ (substn+ [ T ] Δ Γ σ M))
∎ where
lemma : ∀ {U} (x : Case U [ T ] Γ) →
choose ⟨ N ⟩ (weakens* E σ) x
≡ substn N (par (id [ T ]) (snd E Δ ∙ σ) x)
lemma (inj₁ x) =
begin
subst (Exp (E ++ Δ)) (uniq x) N
≡⟨ cong (choose ⟨ N ⟩ (id (E ++ Δ))) (sym (case-≪ x (E ++ Δ))) ⟩
(N ◁ id (E ++ Δ)) (x ≪ E ≪ Δ)
≡⟨ sym (weaken*-[] ((N ◁ id (E ++ Δ)) (x ≪ E ≪ Δ))) ⟩
weaken* [] ((N ◁ id (E ++ Δ)) (x ≪ E ≪ Δ))
≡⟨ cong (xsubstn+ [] (E ++ Δ) ([ T ] ++ E ++ Δ) (N ◁ id (E ++ Δ)))
(sym (case-≫ [] (x ≪ E ≪ Δ))) ⟩
substn N (var (x ≪ E ≪ Δ))
≡⟨ cong (substn N) (sym (weaken*ʳ-var (E ++ Δ) x)) ⟩
substn N (weaken*ʳ (E ++ Δ) (var x))
∎
lemma (inj₂ x) = sym (substn-weaken (weaken* E (σ x)) N)
|
Source/Assembly/bootloader.asm | vitorfeliper/GGOS | 0 | 7044 | <reponame>vitorfeliper/GGOS<gh_stars>0
%include "D:/GGOS/Source/Assembly/settings.asm"
[ORG BOOTADD]
;mov ax, 0x4F02
;mov bx, 0x0115
mov ah, 0
mov al, 03
int 0x10
;
;push bp
;mov ah, 06
;mov al, 0
;mov bh, 0
;xor cx, cx
;mov dh, 25
;mov dl, 80
;int 10h
;pop bp
push word 0x3F8
call initSerial
push word 0
push word 32
push word 0Ah
push word title
call printsAt
push word 4
push word 21
push word 0Fh
push word headerPart
call printsAt
push word 5
push word 21
push word 0Fh
push word headerLine
call printsAt
push word 20
push word 21
push word 0Fh
push word msgInfo
call printsAt
;push word 0Eh
;push word msg
;call prints
;push word msg
;push word tgt
;call strcpy
;push word tgt
;push word 0x3F8
;call WriteSerialSB
;push word decstr
;push word 32767
;call itoa
;push word decstr
;push word 0x3F8
;call WriteSerialSB
hang:
mov ax, 1
int 16h
jnz hang
push ax
push word COM1
call WriteSerialB
jmp hang
%include "D:/GGOS/Source/Assembly/serial.asm"
%include "D:/GGOS/Source/Assembly/string.asm"
%include "D:/GGOS/Source/Assembly/stdlib.asm"
%include "D:/GGOS/Source/Assembly/stdio.asm"
title: db "GGOS BOOTLOADER", 0
headerPart: db "Opcao Num Disco Num Part. Tipo Tamanho", 0
headerLine: db "_____ ___ _____ ___ _____ ____ _______", 0
msgInfo: db ">", 0 |
test5.asm | abhimanyudwivedi/mp-testing | 0 | 25821 | <reponame>abhimanyudwivedi/mp-testing
.MODEL SMALL
.STACK
.DATA
PA EQU 01190H
PB EQU 01191H
PC EQU 01192H
CR EQU 01193H
CLEAR DB 0FFH,0FFH,0FFH,0FFH
FIRE DB 61H,11H,9FH,71H,01H,11H,9FH,71H,61H,11H,9FH,71H
N DB 10H
.CODE
START: MOV AX,@DATA
MOV DS,AX
MOV DX,CR
MOV AL,80H
OUT DX,AL
MOV AL,00H
MOV DX,PC
OUT DX,AL
LEA BX,CLEAR
MOV SI,03H
CALL DISW
CALL DELAY
LEA BX,FIRE
MOV SI,0BH
CALL DISW
MOV AH,4CH
INT 21H
DISW: MOV AH,[BX][SI]
CALL DISP
CALL DELAY
DEC SI
JNS DISW
RET
DISP: MOV CL,08H
BACK: MOV DX,PB
MOV AL,AH
OUT DX,AL
MOV DX,PC
MOV AL,01H
OUT DX,AL
MOV AL,00H
OUT DX,AL
ROR AH,01H
DEC CL
JNZ BACK
RET
DELAY: MOV SI,0FFFFH
BACK2: MOV DI,0FFFFH
BACK3: DEC DI
JNZ BACK3
DEC SI
JNZ BACK2
RET
END START |
programs/oeis/017/A017190.asm | neoneye/loda | 22 | 87302 | <filename>programs/oeis/017/A017190.asm
; A017190: a(n) = (9*n + 2)^6.
; 64,1771561,64000000,594823321,3010936384,10779215329,30840979456,75418890625,164206490176,326940373369,606355001344,1061520150601,1771561000000,2839760855281,4398046511104,6611856250609,9685390482496,13867245015625,19456426971136,26808753332089,36343632130624,48551226272641,64000000000000,83344647990241,107334407093824,136821750708889,172771465793536,216270112515625,268535866540096,330928743953809,404961208827904,492309163417681,594823321000000,714540961348201,853698068844544,1014741853230169,1200343652992576,1413412221390625,1657107395117056,1934854145598529,2250357012933184,2607614922465721,3010936384000000,3464955073649161,3974645798323264,4545340842854449,5182746699759616,5892961181640625,6682490916222016,7558269224026249,8527674378686464,9598548249896761,10779215329000000,12078502137213121,13505757016489984,15070870303021729,16784294883374656,18657067133265625,20700828238974976,22927845901396969,25351036422727744,27983987175790801,30840979456000000,33937011715960081,37287823182704704,40909917857572009,44820588898717696,49037943386265625,53580927470095936,58469351900270689,63723917940097024,69366243661827841,75418890625000000,81905390937410041,88850274698727424,96279097826745289,104218470266268736,112696084580640625,121740744925904896,131382396407607409,141652154820234304,152582336769287881,164206490176000000,176559425164683001,189677245332718144,203597379403181569,218358613260107776,234001122366390625,250566504564321856,268097813258767129,286639590982979584,306237903347050921,326940373369000000,348796216188498961,371856274163236864,396173052347920849,421800754355914816,448795318603515625,477214454936866816,507117681641509849
mul $0,9
add $0,2
pow $0,6
|
tools/compare_trdos_files_plus.asm | alexanderbazhenoff/zx-spectrum-various | 0 | 16491 | ORG #6000
TRKSC1 EQU #7502 ;FIRST TRACK/SECTOR OF 1
TRKSC2 EQU #8A01 ;FIRST TRACK/SECTOR OF 2
ADDR EQU #5B00 ;STARTADDR OF DIFFERENCES
LENGHT EQU #A1 ;LENGHT (SEC)
MODE EQU 0 ;0 - XOR, 1 - PUT DIFFERENCES OF 1,
;2 - PUT DIFFERENCES OF 2
DISP #4000
DI
LD (STEK),SP
LD SP,#4800
LD B,LENGHT
LD IX,ADDR
LOOP PUSH BC
PUSH IX
LD B,1
LD DE,TRKSC1
TRK1 EQU $-2
LD HL,#4800
PUSH HL
CALL LOAD
LD (TRK1),DE
LD BC,#0105
LD DE,TRKSC2
TRK2 EQU $-2
LD HL,#4900
PUSH HL
CALL LOAD
LD (TRK2),DE
XOR A
OUT (#FE),A
POP DE
POP HL
LD BC,#100
POP IX
CPLOOP LD A,(DE)
CP (HL)
JR Z,ANALOG
PUSH AF
LD A,7
OUT (#FE),A
POP AF
IF0 MODE
XOR (HL)
ENDIF
IF0 MODE-1
LD A,(HL)
ENDIF
LD (IX),A
ANALOG INC HL
INC DE
INC IX
DEC BC
LD A,B
OR C
JR NZ,CPLOOP
LD HL,#5800
ATTRIB EQU $-2
LD (HL),#3F
INC HL
LD (ATTRIB),HL
POP BC
DJNZ LOOP
LD SP,#3131
STEK EQU $-2
RET
LOAD
LL5B1C PUSH BC
PUSH DE
LD A,D
OR A
RRA
LD C,A
LD A,#3C
JR NC,LL5B28
LD A,#2C
LL5B28 LD IX,#1FF3
CALL DOS
LD A,C
LD C,#7F
LD IX,#2A53
CALL DOS
LD A,#18
LD IX,#2FC3
CALL DOS
POP DE
POP BC
LL5B44 PUSH BC
PUSH DE
LD IX,#2F1B
CALL DOS
POP DE
INC H
INC E
BIT 4,E
JR Z,LL5B5C
LD E,#0
INC D
POP BC
DJNZ LL5B1C
JR LL5B5F
LL5B5C POP BC
DJNZ LL5B44
LL5B5F RET
DOS PUSH IX
JP #3D2F
ENT
|
programs/oeis/106/A106621.asm | neoneye/loda | 22 | 160558 | ; A106621: a(n) = numerator of n/(n+20).
; 0,1,1,3,1,1,3,7,2,9,1,11,3,13,7,3,4,17,9,19,1,21,11,23,6,5,13,27,7,29,3,31,8,33,17,7,9,37,19,39,2,41,21,43,11,9,23,47,12,49,5,51,13,53,27,11,14,57,29,59,3,61,31,63,16,13,33,67,17,69,7,71,18,73,37,15,19,77,39,79,4,81,41,83,21,17,43,87,22,89,9,91,23,93,47,19,24,97,49,99
mov $1,$0
gcd $1,20
div $0,$1
|
programs/oeis/017/A017443.asm | neoneye/loda | 22 | 97804 | ; A017443: a(n) = (11*n + 4)^7.
; 16384,170859375,8031810176,94931877133,587068342272,2488651484819,8235430000000,22876792454961,55784660123648,122987386542487,250226879128704,476837158203125,860542568759296,1483273860320763,2458100350228352,3937376385699289,6122200320000000,9273284218074431,13723332506969728,19891027786401117,28296722014797824,39579931286171875,54518732413151616,74051159531521793,99298698941612032,131591980401875559,172498763090000000,223854314446892101,287794280118878208,366790143213462347,463687371083983744,581746347858515625,724686190928347136,896731549611390223,1102662484205853312,1347867523649523629,1638400000000000000,1981037757951217971,2383346337601609088,2853745728689236177,3401580794509246464,4037195463728984375,4772010788316105856,5618606965795036053,6590809424047112192,7703779066869753499,8974106778510000000,10419912285387762041,12060947473224122368,13918704257790032607,16016527107490745984,18379730316001328125,21035720123168587776,24014121782394769283,27346911672718348672,31068554553807275169,35216146062080000000,39829560546169634311,44951604339946578048,50628174571314961637,56908423604998242304,63844929217529296875,71493870602660352896,79915210305408099913,89172882182949322752,99334985490582398639,110473985190970000000,122666918584878344781,135995608361628336128,150546882167473933267,166412798790123095424,183690881057616640625,202484355549780361216,222902399220465737943,245060393028794594432,269080182677623033909,295090346557440000000,323226470993915803451,353631432897315956608,386455689911995657497,421857578164190265344,460003617706317109375,501068825756003972736,545237037828059593373,592701236857601523712,643663890412556690979,698337296093750000000,756943935220796320321,819716834902011199488,886899938586555644327,958748485197030312064,1035529396940734453125,1117521675897804947456,1205016809484450776203,1298319184889498270592,1397746512582462479849,1503630258991360000000,1616316088448478605391,1736164314502319024768,1863550360693924203757
mul $0,11
add $0,4
pow $0,7
|
alloy4fun_models/trashltl/models/9/oQx8SERL3W7BXXFmW.als | Kaixi26/org.alloytools.alloy | 0 | 712 | open main
pred idoQx8SERL3W7BXXFmW_prop10 {
always all f: Protected | f not in Trash and f not in File
}
pred __repair { idoQx8SERL3W7BXXFmW_prop10 }
check __repair { idoQx8SERL3W7BXXFmW_prop10 <=> prop10o } |
projects/batfish/src/main/antlr4/org/batfish/grammar/cisco_asa/AsaLegacy_acl.g4 | adiapel/batfish | 0 | 1068 | parser grammar AsaLegacy_acl;
import Asa_common;
options {
tokenVocab = AsaLexer;
}
access_list_ip_range
:
(
ip = IP_ADDRESS wildcard = IP_ADDRESS
)
| ANY
| ANY4
|
(
HOST? ip = IP_ADDRESS
)
| prefix = IP_PREFIX
|
(
ADDRGROUP address_group = variable
)
|
(
INTERFACE iface = variable
)
|
(
OBJECT obj = variable
)
|
(
OBJECT_GROUP og = variable
)
;
access_list_ip6_range
:
(
ip = IPV6_ADDRESS wildcard = IPV6_ADDRESS
)
| ANY
| ANY6
|
(
HOST? ipv6 = IPV6_ADDRESS
)
| ipv6_prefix = IPV6_PREFIX
|
(
ADDRGROUP address_group = variable
)
;
access_list_mac_range
:
ANY
|
(
address = MAC_ADDRESS_LITERAL wildcard = MAC_ADDRESS_LITERAL
)
|
(
HOST address = MAC_ADDRESS_LITERAL
)
;
appletalk_access_list_null_tail
:
action = access_list_action
(
(
CABLE_RANGE ~NEWLINE*
)
| OTHER_ACCESS
)? NEWLINE
;
appletalk_access_list_stanza
:
ACCESS_LIST name = ACL_NUM_APPLETALK appletalk_access_list_null_tail
;
aruba_access_list_action
:
action = access_list_action
| CAPTIVE
|
(
DST_NAT dstnat = dec
)
| SRC_NAT
;
aruba_app
:
BITTORRENT
| BITTORRENT_APPLICATION
;
aruba_appcategory
:
PEER_TO_PEER
;
asa_access_group
:
ACCESS_GROUP
(
asa_ag_interface
| asa_ag_global
)
NEWLINE
;
asa_ag_interface
:
name = variable
(
IN
| OUT
)
INTERFACE iface = variable
;
asa_ag_global
:
name = variable GLOBAL
;
bandwidth_irs_stanza
:
BANDWIDTH null_rest_of_line
;
cadant_stdacl_name
:
NAME name = variable_permissive NEWLINE
;
etype
:
ANY
| ARP
| IPV4_L5
;
extended_access_list_additional_feature
:
ACK
| ADMINISTRATIVELY_PROHIBITED
| ALTERNATE_ADDRESS
| BEYOND_SCOPE
| BFD_ECHO
| CONVERSION_ERROR
| COUNT
| CWR
| DESTINATION_UNREACHABLE
| DOD_HOST_PROHIBITED
| DOD_NET_PROHIBITED
|
(
DSCP dscp_type
)
|
(
icmp_message_type = dec icmp_message_code = dec?
)
| ECE
| ECHO
| ECHO_REPLY
| ECHO_REQUEST
|
(
ECN ecn = dec
)
| ESTABLISHED
| FIN
| FRAGMENTS
| GENERAL_PARAMETER_PROBLEM
| HOP_LIMIT
| HOPLIMIT
| HOST_ISOLATED
| HOST_PRECEDENCE_UNREACHABLE
| HOST_REDIRECT
| HOST_TOS_REDIRECT
| HOST_TOS_UNREACHABLE
| HOST_UNKNOWN
| HOST_UNREACHABLE
| INFORMATION_REPLY
| INFORMATION_REQUEST
|
(
LOG
(
DEFAULT
| DISABLE
| (level = dec (INTERVAL secs = dec)?)
)?
)
| LOG_INPUT
| MASK_REPLY
| MASK_REQUEST
| MLD_QUERY
| MLD_REDUCTION
| MLD_REPORT
| MLDV2
| MOBILE_HOST_REDIRECT
| ND
| ND_NA
| ND_NS
| ND_TYPE
| NEIGHBOR
| NET_REDIRECT
| NET_TOS_REDIRECT
| NET_TOS_UNREACHABLE
| NET_UNREACHABLE
| NETWORK_UNKNOWN
| NO_ROOM_FOR_OPTION
| OPTION_MISSING
| PACKET_TOO_BIG
| PARAMETER_PROBLEM
| PORT_UNREACHABLE
| PRECEDENCE_UNREACHABLE
| PROTOCOL_UNREACHABLE
| PSH
| REASSEMBLY_TIMEOUT
| REDIRECT
| ROUTER
| ROUTER_ADVERTISEMENT
| ROUTER_SOLICITATION
| RST
| SOURCE_QUENCH
| SOURCE_ROUTE_FAILED
| SYN
| TIME_EXCEEDED
| TIMESTAMP_REPLY
| TIMESTAMP_REQUEST
| TRACEROUTE
| TRACKED
| TTL_EXCEEDED
| TTL EQ dec
| UNREACHABLE
| URG
;
extended_access_list_null_tail
:
(
(
SEQ
| SEQUENCE
)? num = dec
)?
(
(
access_list_action protocol access_list_ip_range port_specifier?
access_list_ip_range port_specifier? REFLECT
)
| DYNAMIC
| EVALUATE
| MENU
| REMARK
| STATISTICS
) null_rest_of_line
;
extended_access_list_stanza
:
(
(
IP ACCESS_LIST EXTENDED name = variable_aclname
)
|
(
ACCESS_LIST num = ACL_NUM_EXTENDED
)
|
(
(
IP
| IPV4
) ACCESS_LIST
(
shortname = variable
| name = variable_aclname
)
)
|
(
ACCESS_LIST name = variable_aclname EXTENDED
)
)
(
(
NEWLINE
(
extended_access_list_tail
| extended_access_list_null_tail
)*
)
|
(
extended_access_list_tail
| extended_access_list_null_tail
)
) exit_line?
;
extended_access_list_tail
:
(
(
SEQ
| SEQUENCE
)? num = dec
)? ala = access_list_action
(
VLAN vlan = dec vmask = HEX
)?
(
prot = protocol
|
(
OBJECT_GROUP ogs = variable
)
|
(
OBJECT
(
inline_obj = protocol
| inline_obj_icmp = icmp_inline_object_type
| obj = variable
)
)
) srcipr = access_list_ip_range
(
alps_src = port_specifier
)? dstipr = access_list_ip_range
(
alps_dst = port_specifier
)? features += extended_access_list_additional_feature*
(
NEXTHOP1 IPV4 nexthop1 = IP_ADDRESS
(
NEXTHOP2 IPV4 nexthop2 = IP_ADDRESS
)?
)?
(
SEQUENCE num = dec
)? NEWLINE
;
extended_ipv6_access_list_stanza
:
IPV6 ACCESS_LIST EXTENDED? name = variable_permissive
(
(
NEWLINE
(
extended_ipv6_access_list_tail
| extended_access_list_null_tail
)*
)
|
(
extended_ipv6_access_list_tail
| extended_access_list_null_tail
)
) exit_line?
;
extended_ipv6_access_list_tail
:
(
(
SEQ
| SEQUENCE
)? num = dec
)? ala = access_list_action prot = protocol srcipr = access_list_ip6_range
(
alps_src = port_specifier
)? dstipr = access_list_ip6_range
(
alps_dst = port_specifier
)? features += extended_access_list_additional_feature*
(
NEXTHOP1 IPV6 nexthop1 = IPV6_ADDRESS
(
NEXTHOP2 IPV6 nexthop2 = IPV6_ADDRESS
)?
)?
(
SEQUENCE num = dec
)? NEWLINE
;
interface_rs_stanza
:
INTERFACE name = interface_name NEWLINE irs_stanza*
;
ip_as_path_access_list_stanza
:
IP AS_PATH ACCESS_LIST name = variable
(
ip_as_path_access_list_tail
|
(
NEWLINE ip_as_path_access_list_tail*
)
)
;
ip_as_path_access_list_tail
:
(
SEQ dec
)? action = access_list_action as_path_regex = RAW_TEXT NEWLINE
;
ip_prefix_list_stanza
:
(
IP
| IPV4
)? PREFIX_LIST name = variable
(
(
NEWLINE
(
ip_prefix_list_null_tail
| ip_prefix_list_tail
)*
)
|
(
ip_prefix_list_tail
| ip_prefix_list_null_tail
)
)
;
ipv6_prefix_list_stanza
:
IPV6 PREFIX_LIST name = variable
(
(
NEWLINE
(
ip_prefix_list_null_tail
| ipv6_prefix_list_tail
)*
)
|
(
ipv6_prefix_list_tail
| ip_prefix_list_null_tail
)
)
;
ip_prefix_list_null_tail
:
(
description_line
)
|
(
NO SEQ dec NEWLINE
)
;
ip_prefix_list_tail
:
(
SEQ? seqnum = dec
)? action = access_list_action prefix = IP_PREFIX
(
(
GE minpl = dec
)
|
(
LE maxpl = dec
)
|
(
EQ eqpl = dec
)
)* NEWLINE
;
ipacleth_line
:
action = access_list_action ipacleth_range NEWLINE
;
ipacleth_range
:
ANY
;
ipaclsession_ip_range
:
(
ALIAS alias = variable
)
| ANY
|
(
HOST hostip = IP_ADDRESS
)
|
(
NETWORK net = IP_ADDRESS mask = IP_ADDRESS
)
| USER
;
ipaclsession_ip6_range
:
(
ALIAS alias = variable
)
| ANY
|
(
HOST hostip = IPV6_ADDRESS
)
|
(
NETWORK net = IPV6_PREFIX
)
| USER
;
ipaclsession_line
:
src = ipaclsession_ip_range dst = ipaclsession_ip_range svc =
ipaclsession_service action = aruba_access_list_action
(
(
DOT1P_PRIORITY d1ppri = dec
)
| LOG
|
(
QUEUE
(
HIGH
)
)
|
(
TOS tos = dec
)
)* NEWLINE
;
ipaclsession_line6
:
IPV6 src = ipaclsession_ip6_range dst = ipaclsession_ip6_range svc =
ipaclsession_service6 action = aruba_access_list_action
(
LOG
|
(
QUEUE
(
HIGH
)
)
)* NEWLINE
;
ipaclsession_service
:
(
APP app = aruba_app
)
|
(
APPCATEGORY appcat = aruba_appcategory
)
|
(
prot = protocol ps = netservice_port_specifier?
)
| netsvc = variable
;
ipaclsession_service6
:
(
(
(
TCP
| UDP
) ps = netservice_port_specifier?
)
|
(
ICMPV6 is = netservice_icmpv6_specifier?
)
|
(
prot = protocol
)
)
| netsvc = variable
;
ipv6_prefix_list_tail
:
(
SEQ? seqnum = dec
)? action = access_list_action prefix6 = IPV6_PREFIX
(
(
GE minpl = dec
)
|
(
LE maxpl = dec
)
|
(
EQ eqpl = dec
)
)* NEWLINE
;
ipx_sap_access_list_null_tail
:
action = access_list_action null_rest_of_line
;
ipx_sap_access_list_stanza
:
ACCESS_LIST name = ACL_NUM_IPX_SAP ipx_sap_access_list_null_tail
;
irs_stanza
:
bandwidth_irs_stanza
| null_irs_stanza
;
mac_access_list_additional_feature
:
(
ETYPE etype
)
| HEX
| IP
| LOG_ENABLE
|
(
PRIORITY priority = dec
)
|
(
PRIORITY_FORCE priority_force = dec
)
|
(
PRIORITY_MAPPING priority_mapping = dec
)
;
netdestination_description
:
desc = description_line
;
netdestination_host
:
HOST ip = IP_ADDRESS NEWLINE
;
netdestination_invert
:
INVERT NEWLINE
;
netdestination_name
:
NAME name = variable_permissive NEWLINE
;
netdestination_network
:
NETWORK net = IP_ADDRESS mask = IP_ADDRESS NEWLINE
;
netdestination6_description
:
desc = description_line
;
netdestination6_host
:
HOST ip6 = IPV6_ADDRESS NEWLINE
;
netdestination6_invert
:
INVERT NEWLINE
;
netdestination6_name
:
NAME name = variable_permissive NEWLINE
;
netdestination6_network
:
NETWORK net6 = IPV6_PREFIX NEWLINE
;
netservice_icmpv6_specifier
:
dec
| RTR_ADV
;
netservice_port_specifier
:
(
(
start_port = dec
(
end_port = dec
)?
)
|
(
LIST DOUBLE_QUOTE
(
elems += dec
)+ DOUBLE_QUOTE
)
)
;
no_ip_prefix_list_stanza
:
NO IP PREFIX_LIST name = variable NEWLINE
;
null_as_path_regex
:
~NEWLINE*
;
null_irs_stanza
:
NO?
(
SIGNALLING
) null_rest_of_line
;
null_rs_stanza
:
NO?
(
AUTHENTICATION
| KEY_SOURCE
| LOGGING
| WINDOW_SIZE
) null_rest_of_line
;
protocol_type_code_access_list_null_tail
:
action = access_list_action null_rest_of_line
;
protocol_type_code_access_list_stanza
:
ACCESS_LIST name = ACL_NUM_PROTOCOL_TYPE_CODE
protocol_type_code_access_list_null_tail
;
rs_stanza
:
interface_rs_stanza
| null_rs_stanza
;
rsvp_stanza
:
RSVP NEWLINE rs_stanza*
;
s_arp_access_list_extended
:
ARP ACCESS_LIST name = variable_permissive NEWLINE
s_arp_access_list_extended_tail*
;
s_arp_access_list_extended_tail
:
(
(
SEQ
| SEQUENCE
)? num = dec
)? action = access_list_action
(
REQUEST
| RESPONSE
)? IP senderip = access_list_ip_range
(
targetip = access_list_ip_range
)? MAC sendermac = access_list_mac_range
(
targetmac = access_list_mac_range
)? LOG? NEWLINE
;
s_ethernet_services
:
ETHERNET_SERVICES ACCESS_LIST name = variable_permissive NEWLINE
s_ethernet_services_tail*
;
s_ethernet_services_tail
:
num = dec? action = access_list_action src_mac = xr_mac_specifier dst_mac =
xr_mac_specifier NEWLINE
;
s_ip_access_list_eth
:
IP ACCESS_LIST ETH name = variable NEWLINE
(
ipacleth_line
)*
;
s_ip_access_list_session
:
IP ACCESS_LIST SESSION name = variable NEWLINE
(
ipaclsession_line
| ipaclsession_line6
)*
;
s_mac_access_list
:
ACCESS_LIST num = ACL_NUM_MAC action = access_list_action address =
MAC_ADDRESS_LITERAL wildcard = MAC_ADDRESS_LITERAL NEWLINE
;
s_mac_access_list_extended
:
(
ACCESS_LIST num = ACL_NUM_EXTENDED_MAC s_mac_access_list_extended_tail
)
|
(
MAC ACCESS_LIST EXTENDED? name = variable_permissive EXTENDED? NEWLINE
s_mac_access_list_extended_tail*
)
;
s_mac_access_list_extended_tail
:
(
(SEQ | SEQUENCE)? num = dec
)?
action = access_list_action src = access_list_mac_range dst = access_list_mac_range
(
vlan = dec
| vlan_any = ANY
)? mac_access_list_additional_feature* NEWLINE
;
s_netdestination
:
NETDESTINATION name = variable NEWLINE
(
netdestination_description
| netdestination_host
| netdestination_invert
| netdestination_name
| netdestination_network
)*
;
s_netdestination6
:
NETDESTINATION6 name = variable NEWLINE
(
netdestination6_description
| netdestination6_host
| netdestination6_invert
| netdestination6_name
| netdestination6_network
)*
;
s_netservice
:
NETSERVICE name = variable prot = protocol ps = netservice_port_specifier?
(
ALG alg = netservice_alg
)? NEWLINE
;
standard_access_list_additional_feature
:
(
DSCP dscp_type
)
|
(
ECN ecn = dec
)
| LOG
;
standard_access_list_null_tail
:
(
(
SEQ
| SEQUENCE
)? num = dec
)?
(
REMARK
| STATISTICS
) null_rest_of_line
;
standard_access_list_stanza
:
(
(
IP ACCESS_LIST STANDARD name = variable_aclname
)
|
(
ACCESS_LIST num = ACL_NUM_STANDARD
)
|
(
ACCESS_LIST name = variable_aclname STANDARD
)
)
(
(
NEWLINE
(
standard_access_list_tail
| cadant_stdacl_name
| standard_access_list_null_tail
)*
)
|
(
(
standard_access_list_tail
| standard_access_list_null_tail
)
)
)
;
standard_ipv6_access_list_stanza
:
IPV6 ACCESS_LIST STANDARD name = variable
(
(
NEWLINE
(
standard_ipv6_access_list_tail
| standard_access_list_null_tail
)*
)
|
(
(
standard_ipv6_access_list_tail
| standard_access_list_null_tail
)
)
)
;
standard_access_list_tail
:
(
(
SEQ
| SEQUENCE
)? num = dec
)? ala = access_list_action ipr = access_list_ip_range
(
features += standard_access_list_additional_feature
)* NEWLINE
;
standard_ipv6_access_list_tail
:
(
(
SEQ
| SEQUENCE
)? num = dec
)? ala = access_list_action ipr = access_list_ip6_range
(
features += standard_access_list_additional_feature
)* NEWLINE
;
xr_mac_specifier
:
ANY
|
(
HOST host = MAC_ADDRESS_LITERAL
)
|
(
address = MAC_ADDRESS_LITERAL mask = MAC_ADDRESS_LITERAL
)
;
|
programs/oeis/338/A338041.asm | karttu/loda | 0 | 179424 | <filename>programs/oeis/338/A338041.asm<gh_stars>0
; A338041: Draw n rays from each of two distinct points in the plane; a(n) is the number of regions thus created. See Comments for details.
; 1,2,7,6,15,12,25,20,37,30,51,42,67,56,85,72,105,90,127,110,151,132,177,156,205,182,235,210,267,240,301,272,337,306,375,342,415,380,457,420,501,462,547,506,595,552,645,600,697,650,751,702,807,756,865,812,925
mov $1,$0
mov $2,$0
lpb $0,1
sub $2,$1
add $1,$0
sub $0,1
add $1,2
mov $3,1
sub $3,$2
mov $2,$3
lpe
trn $0,1
add $0,2
mul $3,2
mov $4,2
add $4,$3
add $0,$4
mul $0,2
mov $1,$0
sub $1,8
div $1,4
add $1,1
|
kernel.asm | nicobokhari13/CIS450_P2_MLFQ_in_xv6 | 0 | 167702 |
kernel: file format elf32-i386
Disassembly of section .text:
80100000 <multiboot_header>:
80100000: 02 b0 ad 1b 00 00 add 0x1bad(%eax),%dh
80100006: 00 00 add %al,(%eax)
80100008: fe 4f 52 decb 0x52(%edi)
8010000b: e4 .byte 0xe4
8010000c <entry>:
# Entering xv6 on boot processor, with paging off.
.globl entry
entry:
# Turn on page size extension for 4Mbyte pages
movl %cr4, %eax
8010000c: 0f 20 e0 mov %cr4,%eax
orl $(CR4_PSE), %eax
8010000f: 83 c8 10 or $0x10,%eax
movl %eax, %cr4
80100012: 0f 22 e0 mov %eax,%cr4
# Set page directory
movl $(V2P_WO(entrypgdir)), %eax
80100015: b8 00 b0 10 00 mov $0x10b000,%eax
movl %eax, %cr3
8010001a: 0f 22 d8 mov %eax,%cr3
# Turn on paging.
movl %cr0, %eax
8010001d: 0f 20 c0 mov %cr0,%eax
orl $(CR0_PG|CR0_WP), %eax
80100020: 0d 00 00 01 80 or $0x80010000,%eax
movl %eax, %cr0
80100025: 0f 22 c0 mov %eax,%cr0
# Set up the stack pointer.
movl $(stack + KSTACKSIZE), %esp
80100028: bc 50 d6 10 80 mov $0x8010d650,%esp
# Jump to main(), and switch to executing at
# high addresses. The indirect call is needed because
# the assembler produces a PC-relative instruction
# for a direct jump.
mov $main, %eax
8010002d: b8 8f 38 10 80 mov $0x8010388f,%eax
jmp *%eax
80100032: ff e0 jmp *%eax
80100034 <binit>:
struct buf head;
} bcache;
void
binit(void)
{
80100034: 55 push %ebp
80100035: 89 e5 mov %esp,%ebp
80100037: 83 ec 18 sub $0x18,%esp
struct buf *b;
initlock(&bcache.lock, "bcache");
8010003a: 83 ec 08 sub $0x8,%esp
8010003d: 68 64 8b 10 80 push $0x80108b64
80100042: 68 60 d6 10 80 push $0x8010d660
80100047: e8 cf 55 00 00 call 8010561b <initlock>
8010004c: 83 c4 10 add $0x10,%esp
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
8010004f: c7 05 70 15 11 80 64 movl $0x80111564,0x80111570
80100056: 15 11 80
bcache.head.next = &bcache.head;
80100059: c7 05 74 15 11 80 64 movl $0x80111564,0x80111574
80100060: 15 11 80
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
80100063: c7 45 f4 94 d6 10 80 movl $0x8010d694,-0xc(%ebp)
8010006a: eb 3a jmp 801000a6 <binit+0x72>
b->next = bcache.head.next;
8010006c: 8b 15 74 15 11 80 mov 0x80111574,%edx
80100072: 8b 45 f4 mov -0xc(%ebp),%eax
80100075: 89 50 10 mov %edx,0x10(%eax)
b->prev = &bcache.head;
80100078: 8b 45 f4 mov -0xc(%ebp),%eax
8010007b: c7 40 0c 64 15 11 80 movl $0x80111564,0xc(%eax)
b->dev = -1;
80100082: 8b 45 f4 mov -0xc(%ebp),%eax
80100085: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax)
bcache.head.next->prev = b;
8010008c: a1 74 15 11 80 mov 0x80111574,%eax
80100091: 8b 55 f4 mov -0xc(%ebp),%edx
80100094: 89 50 0c mov %edx,0xc(%eax)
bcache.head.next = b;
80100097: 8b 45 f4 mov -0xc(%ebp),%eax
8010009a: a3 74 15 11 80 mov %eax,0x80111574
//PAGEBREAK!
// Create linked list of buffers
bcache.head.prev = &bcache.head;
bcache.head.next = &bcache.head;
for(b = bcache.buf; b < bcache.buf+NBUF; b++){
8010009f: 81 45 f4 18 02 00 00 addl $0x218,-0xc(%ebp)
801000a6: b8 64 15 11 80 mov $0x80111564,%eax
801000ab: 39 45 f4 cmp %eax,-0xc(%ebp)
801000ae: 72 bc jb 8010006c <binit+0x38>
b->prev = &bcache.head;
b->dev = -1;
bcache.head.next->prev = b;
bcache.head.next = b;
}
}
801000b0: 90 nop
801000b1: c9 leave
801000b2: c3 ret
801000b3 <bget>:
// Look through buffer cache for block on device dev.
// If not found, allocate a buffer.
// In either case, return B_BUSY buffer.
static struct buf*
bget(uint dev, uint blockno)
{
801000b3: 55 push %ebp
801000b4: 89 e5 mov %esp,%ebp
801000b6: 83 ec 18 sub $0x18,%esp
struct buf *b;
acquire(&bcache.lock);
801000b9: 83 ec 0c sub $0xc,%esp
801000bc: 68 60 d6 10 80 push $0x8010d660
801000c1: e8 77 55 00 00 call 8010563d <acquire>
801000c6: 83 c4 10 add $0x10,%esp
loop:
// Is the block already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
801000c9: a1 74 15 11 80 mov 0x80111574,%eax
801000ce: 89 45 f4 mov %eax,-0xc(%ebp)
801000d1: eb 67 jmp 8010013a <bget+0x87>
if(b->dev == dev && b->blockno == blockno){
801000d3: 8b 45 f4 mov -0xc(%ebp),%eax
801000d6: 8b 40 04 mov 0x4(%eax),%eax
801000d9: 3b 45 08 cmp 0x8(%ebp),%eax
801000dc: 75 53 jne 80100131 <bget+0x7e>
801000de: 8b 45 f4 mov -0xc(%ebp),%eax
801000e1: 8b 40 08 mov 0x8(%eax),%eax
801000e4: 3b 45 0c cmp 0xc(%ebp),%eax
801000e7: 75 48 jne 80100131 <bget+0x7e>
if(!(b->flags & B_BUSY)){
801000e9: 8b 45 f4 mov -0xc(%ebp),%eax
801000ec: 8b 00 mov (%eax),%eax
801000ee: 83 e0 01 and $0x1,%eax
801000f1: 85 c0 test %eax,%eax
801000f3: 75 27 jne 8010011c <bget+0x69>
b->flags |= B_BUSY;
801000f5: 8b 45 f4 mov -0xc(%ebp),%eax
801000f8: 8b 00 mov (%eax),%eax
801000fa: 83 c8 01 or $0x1,%eax
801000fd: 89 c2 mov %eax,%edx
801000ff: 8b 45 f4 mov -0xc(%ebp),%eax
80100102: 89 10 mov %edx,(%eax)
release(&bcache.lock);
80100104: 83 ec 0c sub $0xc,%esp
80100107: 68 60 d6 10 80 push $0x8010d660
8010010c: e8 93 55 00 00 call 801056a4 <release>
80100111: 83 c4 10 add $0x10,%esp
return b;
80100114: 8b 45 f4 mov -0xc(%ebp),%eax
80100117: e9 98 00 00 00 jmp 801001b4 <bget+0x101>
}
sleep(b, &bcache.lock);
8010011c: 83 ec 08 sub $0x8,%esp
8010011f: 68 60 d6 10 80 push $0x8010d660
80100124: ff 75 f4 pushl -0xc(%ebp)
80100127: e8 0f 52 00 00 call 8010533b <sleep>
8010012c: 83 c4 10 add $0x10,%esp
goto loop;
8010012f: eb 98 jmp 801000c9 <bget+0x16>
acquire(&bcache.lock);
loop:
// Is the block already cached?
for(b = bcache.head.next; b != &bcache.head; b = b->next){
80100131: 8b 45 f4 mov -0xc(%ebp),%eax
80100134: 8b 40 10 mov 0x10(%eax),%eax
80100137: 89 45 f4 mov %eax,-0xc(%ebp)
8010013a: 81 7d f4 64 15 11 80 cmpl $0x80111564,-0xc(%ebp)
80100141: 75 90 jne 801000d3 <bget+0x20>
}
// Not cached; recycle some non-busy and clean buffer.
// "clean" because B_DIRTY and !B_BUSY means log.c
// hasn't yet committed the changes to the buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100143: a1 70 15 11 80 mov 0x80111570,%eax
80100148: 89 45 f4 mov %eax,-0xc(%ebp)
8010014b: eb 51 jmp 8010019e <bget+0xeb>
if((b->flags & B_BUSY) == 0 && (b->flags & B_DIRTY) == 0){
8010014d: 8b 45 f4 mov -0xc(%ebp),%eax
80100150: 8b 00 mov (%eax),%eax
80100152: 83 e0 01 and $0x1,%eax
80100155: 85 c0 test %eax,%eax
80100157: 75 3c jne 80100195 <bget+0xe2>
80100159: 8b 45 f4 mov -0xc(%ebp),%eax
8010015c: 8b 00 mov (%eax),%eax
8010015e: 83 e0 04 and $0x4,%eax
80100161: 85 c0 test %eax,%eax
80100163: 75 30 jne 80100195 <bget+0xe2>
b->dev = dev;
80100165: 8b 45 f4 mov -0xc(%ebp),%eax
80100168: 8b 55 08 mov 0x8(%ebp),%edx
8010016b: 89 50 04 mov %edx,0x4(%eax)
b->blockno = blockno;
8010016e: 8b 45 f4 mov -0xc(%ebp),%eax
80100171: 8b 55 0c mov 0xc(%ebp),%edx
80100174: 89 50 08 mov %edx,0x8(%eax)
b->flags = B_BUSY;
80100177: 8b 45 f4 mov -0xc(%ebp),%eax
8010017a: c7 00 01 00 00 00 movl $0x1,(%eax)
release(&bcache.lock);
80100180: 83 ec 0c sub $0xc,%esp
80100183: 68 60 d6 10 80 push $0x8010d660
80100188: e8 17 55 00 00 call 801056a4 <release>
8010018d: 83 c4 10 add $0x10,%esp
return b;
80100190: 8b 45 f4 mov -0xc(%ebp),%eax
80100193: eb 1f jmp 801001b4 <bget+0x101>
}
// Not cached; recycle some non-busy and clean buffer.
// "clean" because B_DIRTY and !B_BUSY means log.c
// hasn't yet committed the changes to the buffer.
for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
80100195: 8b 45 f4 mov -0xc(%ebp),%eax
80100198: 8b 40 0c mov 0xc(%eax),%eax
8010019b: 89 45 f4 mov %eax,-0xc(%ebp)
8010019e: 81 7d f4 64 15 11 80 cmpl $0x80111564,-0xc(%ebp)
801001a5: 75 a6 jne 8010014d <bget+0x9a>
b->flags = B_BUSY;
release(&bcache.lock);
return b;
}
}
panic("bget: no buffers");
801001a7: 83 ec 0c sub $0xc,%esp
801001aa: 68 6b 8b 10 80 push $0x80108b6b
801001af: e8 b2 03 00 00 call 80100566 <panic>
}
801001b4: c9 leave
801001b5: c3 ret
801001b6 <bread>:
// Return a B_BUSY buf with the contents of the indicated block.
struct buf*
bread(uint dev, uint blockno)
{
801001b6: 55 push %ebp
801001b7: 89 e5 mov %esp,%ebp
801001b9: 83 ec 18 sub $0x18,%esp
struct buf *b;
b = bget(dev, blockno);
801001bc: 83 ec 08 sub $0x8,%esp
801001bf: ff 75 0c pushl 0xc(%ebp)
801001c2: ff 75 08 pushl 0x8(%ebp)
801001c5: e8 e9 fe ff ff call 801000b3 <bget>
801001ca: 83 c4 10 add $0x10,%esp
801001cd: 89 45 f4 mov %eax,-0xc(%ebp)
if(!(b->flags & B_VALID)) {
801001d0: 8b 45 f4 mov -0xc(%ebp),%eax
801001d3: 8b 00 mov (%eax),%eax
801001d5: 83 e0 02 and $0x2,%eax
801001d8: 85 c0 test %eax,%eax
801001da: 75 0e jne 801001ea <bread+0x34>
iderw(b);
801001dc: 83 ec 0c sub $0xc,%esp
801001df: ff 75 f4 pushl -0xc(%ebp)
801001e2: e8 26 27 00 00 call 8010290d <iderw>
801001e7: 83 c4 10 add $0x10,%esp
}
return b;
801001ea: 8b 45 f4 mov -0xc(%ebp),%eax
}
801001ed: c9 leave
801001ee: c3 ret
801001ef <bwrite>:
// Write b's contents to disk. Must be B_BUSY.
void
bwrite(struct buf *b)
{
801001ef: 55 push %ebp
801001f0: 89 e5 mov %esp,%ebp
801001f2: 83 ec 08 sub $0x8,%esp
if((b->flags & B_BUSY) == 0)
801001f5: 8b 45 08 mov 0x8(%ebp),%eax
801001f8: 8b 00 mov (%eax),%eax
801001fa: 83 e0 01 and $0x1,%eax
801001fd: 85 c0 test %eax,%eax
801001ff: 75 0d jne 8010020e <bwrite+0x1f>
panic("bwrite");
80100201: 83 ec 0c sub $0xc,%esp
80100204: 68 7c 8b 10 80 push $0x80108b7c
80100209: e8 58 03 00 00 call 80100566 <panic>
b->flags |= B_DIRTY;
8010020e: 8b 45 08 mov 0x8(%ebp),%eax
80100211: 8b 00 mov (%eax),%eax
80100213: 83 c8 04 or $0x4,%eax
80100216: 89 c2 mov %eax,%edx
80100218: 8b 45 08 mov 0x8(%ebp),%eax
8010021b: 89 10 mov %edx,(%eax)
iderw(b);
8010021d: 83 ec 0c sub $0xc,%esp
80100220: ff 75 08 pushl 0x8(%ebp)
80100223: e8 e5 26 00 00 call 8010290d <iderw>
80100228: 83 c4 10 add $0x10,%esp
}
8010022b: 90 nop
8010022c: c9 leave
8010022d: c3 ret
8010022e <brelse>:
// Release a B_BUSY buffer.
// Move to the head of the MRU list.
void
brelse(struct buf *b)
{
8010022e: 55 push %ebp
8010022f: 89 e5 mov %esp,%ebp
80100231: 83 ec 08 sub $0x8,%esp
if((b->flags & B_BUSY) == 0)
80100234: 8b 45 08 mov 0x8(%ebp),%eax
80100237: 8b 00 mov (%eax),%eax
80100239: 83 e0 01 and $0x1,%eax
8010023c: 85 c0 test %eax,%eax
8010023e: 75 0d jne 8010024d <brelse+0x1f>
panic("brelse");
80100240: 83 ec 0c sub $0xc,%esp
80100243: 68 83 8b 10 80 push $0x80108b83
80100248: e8 19 03 00 00 call 80100566 <panic>
acquire(&bcache.lock);
8010024d: 83 ec 0c sub $0xc,%esp
80100250: 68 60 d6 10 80 push $0x8010d660
80100255: e8 e3 53 00 00 call 8010563d <acquire>
8010025a: 83 c4 10 add $0x10,%esp
b->next->prev = b->prev;
8010025d: 8b 45 08 mov 0x8(%ebp),%eax
80100260: 8b 40 10 mov 0x10(%eax),%eax
80100263: 8b 55 08 mov 0x8(%ebp),%edx
80100266: 8b 52 0c mov 0xc(%edx),%edx
80100269: 89 50 0c mov %edx,0xc(%eax)
b->prev->next = b->next;
8010026c: 8b 45 08 mov 0x8(%ebp),%eax
8010026f: 8b 40 0c mov 0xc(%eax),%eax
80100272: 8b 55 08 mov 0x8(%ebp),%edx
80100275: 8b 52 10 mov 0x10(%edx),%edx
80100278: 89 50 10 mov %edx,0x10(%eax)
b->next = bcache.head.next;
8010027b: 8b 15 74 15 11 80 mov 0x80111574,%edx
80100281: 8b 45 08 mov 0x8(%ebp),%eax
80100284: 89 50 10 mov %edx,0x10(%eax)
b->prev = &bcache.head;
80100287: 8b 45 08 mov 0x8(%ebp),%eax
8010028a: c7 40 0c 64 15 11 80 movl $0x80111564,0xc(%eax)
bcache.head.next->prev = b;
80100291: a1 74 15 11 80 mov 0x80111574,%eax
80100296: 8b 55 08 mov 0x8(%ebp),%edx
80100299: 89 50 0c mov %edx,0xc(%eax)
bcache.head.next = b;
8010029c: 8b 45 08 mov 0x8(%ebp),%eax
8010029f: a3 74 15 11 80 mov %eax,0x80111574
b->flags &= ~B_BUSY;
801002a4: 8b 45 08 mov 0x8(%ebp),%eax
801002a7: 8b 00 mov (%eax),%eax
801002a9: 83 e0 fe and $0xfffffffe,%eax
801002ac: 89 c2 mov %eax,%edx
801002ae: 8b 45 08 mov 0x8(%ebp),%eax
801002b1: 89 10 mov %edx,(%eax)
wakeup(b);
801002b3: 83 ec 0c sub $0xc,%esp
801002b6: ff 75 08 pushl 0x8(%ebp)
801002b9: e8 6b 51 00 00 call 80105429 <wakeup>
801002be: 83 c4 10 add $0x10,%esp
release(&bcache.lock);
801002c1: 83 ec 0c sub $0xc,%esp
801002c4: 68 60 d6 10 80 push $0x8010d660
801002c9: e8 d6 53 00 00 call 801056a4 <release>
801002ce: 83 c4 10 add $0x10,%esp
}
801002d1: 90 nop
801002d2: c9 leave
801002d3: c3 ret
801002d4 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
801002d4: 55 push %ebp
801002d5: 89 e5 mov %esp,%ebp
801002d7: 83 ec 14 sub $0x14,%esp
801002da: 8b 45 08 mov 0x8(%ebp),%eax
801002dd: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801002e1: 0f b7 45 ec movzwl -0x14(%ebp),%eax
801002e5: 89 c2 mov %eax,%edx
801002e7: ec in (%dx),%al
801002e8: 88 45 ff mov %al,-0x1(%ebp)
return data;
801002eb: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
801002ef: c9 leave
801002f0: c3 ret
801002f1 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
801002f1: 55 push %ebp
801002f2: 89 e5 mov %esp,%ebp
801002f4: 83 ec 08 sub $0x8,%esp
801002f7: 8b 55 08 mov 0x8(%ebp),%edx
801002fa: 8b 45 0c mov 0xc(%ebp),%eax
801002fd: 66 89 55 fc mov %dx,-0x4(%ebp)
80100301: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80100304: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80100308: 0f b7 55 fc movzwl -0x4(%ebp),%edx
8010030c: ee out %al,(%dx)
}
8010030d: 90 nop
8010030e: c9 leave
8010030f: c3 ret
80100310 <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
80100310: 55 push %ebp
80100311: 89 e5 mov %esp,%ebp
asm volatile("cli");
80100313: fa cli
}
80100314: 90 nop
80100315: 5d pop %ebp
80100316: c3 ret
80100317 <printint>:
int locking;
} cons;
static void
printint(int xx, int base, int sign)
{
80100317: 55 push %ebp
80100318: 89 e5 mov %esp,%ebp
8010031a: 53 push %ebx
8010031b: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789abcdef";
char buf[16];
int i;
uint x;
if(sign && (sign = xx < 0))
8010031e: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100322: 74 1c je 80100340 <printint+0x29>
80100324: 8b 45 08 mov 0x8(%ebp),%eax
80100327: c1 e8 1f shr $0x1f,%eax
8010032a: 0f b6 c0 movzbl %al,%eax
8010032d: 89 45 10 mov %eax,0x10(%ebp)
80100330: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100334: 74 0a je 80100340 <printint+0x29>
x = -xx;
80100336: 8b 45 08 mov 0x8(%ebp),%eax
80100339: f7 d8 neg %eax
8010033b: 89 45 f0 mov %eax,-0x10(%ebp)
8010033e: eb 06 jmp 80100346 <printint+0x2f>
else
x = xx;
80100340: 8b 45 08 mov 0x8(%ebp),%eax
80100343: 89 45 f0 mov %eax,-0x10(%ebp)
i = 0;
80100346: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
8010034d: 8b 4d f4 mov -0xc(%ebp),%ecx
80100350: 8d 41 01 lea 0x1(%ecx),%eax
80100353: 89 45 f4 mov %eax,-0xc(%ebp)
80100356: 8b 5d 0c mov 0xc(%ebp),%ebx
80100359: 8b 45 f0 mov -0x10(%ebp),%eax
8010035c: ba 00 00 00 00 mov $0x0,%edx
80100361: f7 f3 div %ebx
80100363: 89 d0 mov %edx,%eax
80100365: 0f b6 80 04 a0 10 80 movzbl -0x7fef5ffc(%eax),%eax
8010036c: 88 44 0d e0 mov %al,-0x20(%ebp,%ecx,1)
}while((x /= base) != 0);
80100370: 8b 5d 0c mov 0xc(%ebp),%ebx
80100373: 8b 45 f0 mov -0x10(%ebp),%eax
80100376: ba 00 00 00 00 mov $0x0,%edx
8010037b: f7 f3 div %ebx
8010037d: 89 45 f0 mov %eax,-0x10(%ebp)
80100380: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80100384: 75 c7 jne 8010034d <printint+0x36>
if(sign)
80100386: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
8010038a: 74 2a je 801003b6 <printint+0x9f>
buf[i++] = '-';
8010038c: 8b 45 f4 mov -0xc(%ebp),%eax
8010038f: 8d 50 01 lea 0x1(%eax),%edx
80100392: 89 55 f4 mov %edx,-0xc(%ebp)
80100395: c6 44 05 e0 2d movb $0x2d,-0x20(%ebp,%eax,1)
while(--i >= 0)
8010039a: eb 1a jmp 801003b6 <printint+0x9f>
consputc(buf[i]);
8010039c: 8d 55 e0 lea -0x20(%ebp),%edx
8010039f: 8b 45 f4 mov -0xc(%ebp),%eax
801003a2: 01 d0 add %edx,%eax
801003a4: 0f b6 00 movzbl (%eax),%eax
801003a7: 0f be c0 movsbl %al,%eax
801003aa: 83 ec 0c sub $0xc,%esp
801003ad: 50 push %eax
801003ae: e8 df 03 00 00 call 80100792 <consputc>
801003b3: 83 c4 10 add $0x10,%esp
}while((x /= base) != 0);
if(sign)
buf[i++] = '-';
while(--i >= 0)
801003b6: 83 6d f4 01 subl $0x1,-0xc(%ebp)
801003ba: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801003be: 79 dc jns 8010039c <printint+0x85>
consputc(buf[i]);
}
801003c0: 90 nop
801003c1: 8b 5d fc mov -0x4(%ebp),%ebx
801003c4: c9 leave
801003c5: c3 ret
801003c6 <cprintf>:
//PAGEBREAK: 50
// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
801003c6: 55 push %ebp
801003c7: 89 e5 mov %esp,%ebp
801003c9: 83 ec 28 sub $0x28,%esp
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
801003cc: a1 f4 c5 10 80 mov 0x8010c5f4,%eax
801003d1: 89 45 e8 mov %eax,-0x18(%ebp)
if(locking)
801003d4: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
801003d8: 74 10 je 801003ea <cprintf+0x24>
acquire(&cons.lock);
801003da: 83 ec 0c sub $0xc,%esp
801003dd: 68 c0 c5 10 80 push $0x8010c5c0
801003e2: e8 56 52 00 00 call 8010563d <acquire>
801003e7: 83 c4 10 add $0x10,%esp
if (fmt == 0)
801003ea: 8b 45 08 mov 0x8(%ebp),%eax
801003ed: 85 c0 test %eax,%eax
801003ef: 75 0d jne 801003fe <cprintf+0x38>
panic("null fmt");
801003f1: 83 ec 0c sub $0xc,%esp
801003f4: 68 8a 8b 10 80 push $0x80108b8a
801003f9: e8 68 01 00 00 call 80100566 <panic>
argp = (uint*)(void*)(&fmt + 1);
801003fe: 8d 45 0c lea 0xc(%ebp),%eax
80100401: 89 45 f0 mov %eax,-0x10(%ebp)
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100404: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010040b: e9 1a 01 00 00 jmp 8010052a <cprintf+0x164>
if(c != '%'){
80100410: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
80100414: 74 13 je 80100429 <cprintf+0x63>
consputc(c);
80100416: 83 ec 0c sub $0xc,%esp
80100419: ff 75 e4 pushl -0x1c(%ebp)
8010041c: e8 71 03 00 00 call 80100792 <consputc>
80100421: 83 c4 10 add $0x10,%esp
continue;
80100424: e9 fd 00 00 00 jmp 80100526 <cprintf+0x160>
}
c = fmt[++i] & 0xff;
80100429: 8b 55 08 mov 0x8(%ebp),%edx
8010042c: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100430: 8b 45 f4 mov -0xc(%ebp),%eax
80100433: 01 d0 add %edx,%eax
80100435: 0f b6 00 movzbl (%eax),%eax
80100438: 0f be c0 movsbl %al,%eax
8010043b: 25 ff 00 00 00 and $0xff,%eax
80100440: 89 45 e4 mov %eax,-0x1c(%ebp)
if(c == 0)
80100443: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80100447: 0f 84 ff 00 00 00 je 8010054c <cprintf+0x186>
break;
switch(c){
8010044d: 8b 45 e4 mov -0x1c(%ebp),%eax
80100450: 83 f8 70 cmp $0x70,%eax
80100453: 74 47 je 8010049c <cprintf+0xd6>
80100455: 83 f8 70 cmp $0x70,%eax
80100458: 7f 13 jg 8010046d <cprintf+0xa7>
8010045a: 83 f8 25 cmp $0x25,%eax
8010045d: 0f 84 98 00 00 00 je 801004fb <cprintf+0x135>
80100463: 83 f8 64 cmp $0x64,%eax
80100466: 74 14 je 8010047c <cprintf+0xb6>
80100468: e9 9d 00 00 00 jmp 8010050a <cprintf+0x144>
8010046d: 83 f8 73 cmp $0x73,%eax
80100470: 74 47 je 801004b9 <cprintf+0xf3>
80100472: 83 f8 78 cmp $0x78,%eax
80100475: 74 25 je 8010049c <cprintf+0xd6>
80100477: e9 8e 00 00 00 jmp 8010050a <cprintf+0x144>
case 'd':
printint(*argp++, 10, 1);
8010047c: 8b 45 f0 mov -0x10(%ebp),%eax
8010047f: 8d 50 04 lea 0x4(%eax),%edx
80100482: 89 55 f0 mov %edx,-0x10(%ebp)
80100485: 8b 00 mov (%eax),%eax
80100487: 83 ec 04 sub $0x4,%esp
8010048a: 6a 01 push $0x1
8010048c: 6a 0a push $0xa
8010048e: 50 push %eax
8010048f: e8 83 fe ff ff call 80100317 <printint>
80100494: 83 c4 10 add $0x10,%esp
break;
80100497: e9 8a 00 00 00 jmp 80100526 <cprintf+0x160>
case 'x':
case 'p':
printint(*argp++, 16, 0);
8010049c: 8b 45 f0 mov -0x10(%ebp),%eax
8010049f: 8d 50 04 lea 0x4(%eax),%edx
801004a2: 89 55 f0 mov %edx,-0x10(%ebp)
801004a5: 8b 00 mov (%eax),%eax
801004a7: 83 ec 04 sub $0x4,%esp
801004aa: 6a 00 push $0x0
801004ac: 6a 10 push $0x10
801004ae: 50 push %eax
801004af: e8 63 fe ff ff call 80100317 <printint>
801004b4: 83 c4 10 add $0x10,%esp
break;
801004b7: eb 6d jmp 80100526 <cprintf+0x160>
case 's':
if((s = (char*)*argp++) == 0)
801004b9: 8b 45 f0 mov -0x10(%ebp),%eax
801004bc: 8d 50 04 lea 0x4(%eax),%edx
801004bf: 89 55 f0 mov %edx,-0x10(%ebp)
801004c2: 8b 00 mov (%eax),%eax
801004c4: 89 45 ec mov %eax,-0x14(%ebp)
801004c7: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
801004cb: 75 22 jne 801004ef <cprintf+0x129>
s = "(null)";
801004cd: c7 45 ec 93 8b 10 80 movl $0x80108b93,-0x14(%ebp)
for(; *s; s++)
801004d4: eb 19 jmp 801004ef <cprintf+0x129>
consputc(*s);
801004d6: 8b 45 ec mov -0x14(%ebp),%eax
801004d9: 0f b6 00 movzbl (%eax),%eax
801004dc: 0f be c0 movsbl %al,%eax
801004df: 83 ec 0c sub $0xc,%esp
801004e2: 50 push %eax
801004e3: e8 aa 02 00 00 call 80100792 <consputc>
801004e8: 83 c4 10 add $0x10,%esp
printint(*argp++, 16, 0);
break;
case 's':
if((s = (char*)*argp++) == 0)
s = "(null)";
for(; *s; s++)
801004eb: 83 45 ec 01 addl $0x1,-0x14(%ebp)
801004ef: 8b 45 ec mov -0x14(%ebp),%eax
801004f2: 0f b6 00 movzbl (%eax),%eax
801004f5: 84 c0 test %al,%al
801004f7: 75 dd jne 801004d6 <cprintf+0x110>
consputc(*s);
break;
801004f9: eb 2b jmp 80100526 <cprintf+0x160>
case '%':
consputc('%');
801004fb: 83 ec 0c sub $0xc,%esp
801004fe: 6a 25 push $0x25
80100500: e8 8d 02 00 00 call 80100792 <consputc>
80100505: 83 c4 10 add $0x10,%esp
break;
80100508: eb 1c jmp 80100526 <cprintf+0x160>
default:
// Print unknown % sequence to draw attention.
consputc('%');
8010050a: 83 ec 0c sub $0xc,%esp
8010050d: 6a 25 push $0x25
8010050f: e8 7e 02 00 00 call 80100792 <consputc>
80100514: 83 c4 10 add $0x10,%esp
consputc(c);
80100517: 83 ec 0c sub $0xc,%esp
8010051a: ff 75 e4 pushl -0x1c(%ebp)
8010051d: e8 70 02 00 00 call 80100792 <consputc>
80100522: 83 c4 10 add $0x10,%esp
break;
80100525: 90 nop
if (fmt == 0)
panic("null fmt");
argp = (uint*)(void*)(&fmt + 1);
for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
80100526: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010052a: 8b 55 08 mov 0x8(%ebp),%edx
8010052d: 8b 45 f4 mov -0xc(%ebp),%eax
80100530: 01 d0 add %edx,%eax
80100532: 0f b6 00 movzbl (%eax),%eax
80100535: 0f be c0 movsbl %al,%eax
80100538: 25 ff 00 00 00 and $0xff,%eax
8010053d: 89 45 e4 mov %eax,-0x1c(%ebp)
80100540: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
80100544: 0f 85 c6 fe ff ff jne 80100410 <cprintf+0x4a>
8010054a: eb 01 jmp 8010054d <cprintf+0x187>
consputc(c);
continue;
}
c = fmt[++i] & 0xff;
if(c == 0)
break;
8010054c: 90 nop
consputc(c);
break;
}
}
if(locking)
8010054d: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
80100551: 74 10 je 80100563 <cprintf+0x19d>
release(&cons.lock);
80100553: 83 ec 0c sub $0xc,%esp
80100556: 68 c0 c5 10 80 push $0x8010c5c0
8010055b: e8 44 51 00 00 call 801056a4 <release>
80100560: 83 c4 10 add $0x10,%esp
}
80100563: 90 nop
80100564: c9 leave
80100565: c3 ret
80100566 <panic>:
void
panic(char *s)
{
80100566: 55 push %ebp
80100567: 89 e5 mov %esp,%ebp
80100569: 83 ec 38 sub $0x38,%esp
int i;
uint pcs[10];
cli();
8010056c: e8 9f fd ff ff call 80100310 <cli>
cons.locking = 0;
80100571: c7 05 f4 c5 10 80 00 movl $0x0,0x8010c5f4
80100578: 00 00 00
cprintf("cpu%d: panic: ", cpu->id);
8010057b: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80100581: 0f b6 00 movzbl (%eax),%eax
80100584: 0f b6 c0 movzbl %al,%eax
80100587: 83 ec 08 sub $0x8,%esp
8010058a: 50 push %eax
8010058b: 68 9a 8b 10 80 push $0x80108b9a
80100590: e8 31 fe ff ff call 801003c6 <cprintf>
80100595: 83 c4 10 add $0x10,%esp
cprintf(s);
80100598: 8b 45 08 mov 0x8(%ebp),%eax
8010059b: 83 ec 0c sub $0xc,%esp
8010059e: 50 push %eax
8010059f: e8 22 fe ff ff call 801003c6 <cprintf>
801005a4: 83 c4 10 add $0x10,%esp
cprintf("\n");
801005a7: 83 ec 0c sub $0xc,%esp
801005aa: 68 a9 8b 10 80 push $0x80108ba9
801005af: e8 12 fe ff ff call 801003c6 <cprintf>
801005b4: 83 c4 10 add $0x10,%esp
getcallerpcs(&s, pcs);
801005b7: 83 ec 08 sub $0x8,%esp
801005ba: 8d 45 cc lea -0x34(%ebp),%eax
801005bd: 50 push %eax
801005be: 8d 45 08 lea 0x8(%ebp),%eax
801005c1: 50 push %eax
801005c2: e8 2f 51 00 00 call 801056f6 <getcallerpcs>
801005c7: 83 c4 10 add $0x10,%esp
for(i=0; i<10; i++)
801005ca: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801005d1: eb 1c jmp 801005ef <panic+0x89>
cprintf(" %p", pcs[i]);
801005d3: 8b 45 f4 mov -0xc(%ebp),%eax
801005d6: 8b 44 85 cc mov -0x34(%ebp,%eax,4),%eax
801005da: 83 ec 08 sub $0x8,%esp
801005dd: 50 push %eax
801005de: 68 ab 8b 10 80 push $0x80108bab
801005e3: e8 de fd ff ff call 801003c6 <cprintf>
801005e8: 83 c4 10 add $0x10,%esp
cons.locking = 0;
cprintf("cpu%d: panic: ", cpu->id);
cprintf(s);
cprintf("\n");
getcallerpcs(&s, pcs);
for(i=0; i<10; i++)
801005eb: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801005ef: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
801005f3: 7e de jle 801005d3 <panic+0x6d>
cprintf(" %p", pcs[i]);
panicked = 1; // freeze other CPU
801005f5: c7 05 a0 c5 10 80 01 movl $0x1,0x8010c5a0
801005fc: 00 00 00
for(;;)
;
801005ff: eb fe jmp 801005ff <panic+0x99>
80100601 <cgaputc>:
#define CRTPORT 0x3d4
static ushort *crt = (ushort*)P2V(0xb8000); // CGA memory
static void
cgaputc(int c)
{
80100601: 55 push %ebp
80100602: 89 e5 mov %esp,%ebp
80100604: 83 ec 18 sub $0x18,%esp
int pos;
// Cursor position: col + 80*row.
outb(CRTPORT, 14);
80100607: 6a 0e push $0xe
80100609: 68 d4 03 00 00 push $0x3d4
8010060e: e8 de fc ff ff call 801002f1 <outb>
80100613: 83 c4 08 add $0x8,%esp
pos = inb(CRTPORT+1) << 8;
80100616: 68 d5 03 00 00 push $0x3d5
8010061b: e8 b4 fc ff ff call 801002d4 <inb>
80100620: 83 c4 04 add $0x4,%esp
80100623: 0f b6 c0 movzbl %al,%eax
80100626: c1 e0 08 shl $0x8,%eax
80100629: 89 45 f4 mov %eax,-0xc(%ebp)
outb(CRTPORT, 15);
8010062c: 6a 0f push $0xf
8010062e: 68 d4 03 00 00 push $0x3d4
80100633: e8 b9 fc ff ff call 801002f1 <outb>
80100638: 83 c4 08 add $0x8,%esp
pos |= inb(CRTPORT+1);
8010063b: 68 d5 03 00 00 push $0x3d5
80100640: e8 8f fc ff ff call 801002d4 <inb>
80100645: 83 c4 04 add $0x4,%esp
80100648: 0f b6 c0 movzbl %al,%eax
8010064b: 09 45 f4 or %eax,-0xc(%ebp)
if(c == '\n')
8010064e: 83 7d 08 0a cmpl $0xa,0x8(%ebp)
80100652: 75 30 jne 80100684 <cgaputc+0x83>
pos += 80 - pos%80;
80100654: 8b 4d f4 mov -0xc(%ebp),%ecx
80100657: ba 67 66 66 66 mov $0x66666667,%edx
8010065c: 89 c8 mov %ecx,%eax
8010065e: f7 ea imul %edx
80100660: c1 fa 05 sar $0x5,%edx
80100663: 89 c8 mov %ecx,%eax
80100665: c1 f8 1f sar $0x1f,%eax
80100668: 29 c2 sub %eax,%edx
8010066a: 89 d0 mov %edx,%eax
8010066c: c1 e0 02 shl $0x2,%eax
8010066f: 01 d0 add %edx,%eax
80100671: c1 e0 04 shl $0x4,%eax
80100674: 29 c1 sub %eax,%ecx
80100676: 89 ca mov %ecx,%edx
80100678: b8 50 00 00 00 mov $0x50,%eax
8010067d: 29 d0 sub %edx,%eax
8010067f: 01 45 f4 add %eax,-0xc(%ebp)
80100682: eb 34 jmp 801006b8 <cgaputc+0xb7>
else if(c == BACKSPACE){
80100684: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp)
8010068b: 75 0c jne 80100699 <cgaputc+0x98>
if(pos > 0) --pos;
8010068d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100691: 7e 25 jle 801006b8 <cgaputc+0xb7>
80100693: 83 6d f4 01 subl $0x1,-0xc(%ebp)
80100697: eb 1f jmp 801006b8 <cgaputc+0xb7>
} else
crt[pos++] = (c&0xff) | 0x0700; // black on white
80100699: 8b 0d 00 a0 10 80 mov 0x8010a000,%ecx
8010069f: 8b 45 f4 mov -0xc(%ebp),%eax
801006a2: 8d 50 01 lea 0x1(%eax),%edx
801006a5: 89 55 f4 mov %edx,-0xc(%ebp)
801006a8: 01 c0 add %eax,%eax
801006aa: 01 c8 add %ecx,%eax
801006ac: 8b 55 08 mov 0x8(%ebp),%edx
801006af: 0f b6 d2 movzbl %dl,%edx
801006b2: 80 ce 07 or $0x7,%dh
801006b5: 66 89 10 mov %dx,(%eax)
if(pos < 0 || pos > 25*80)
801006b8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801006bc: 78 09 js 801006c7 <cgaputc+0xc6>
801006be: 81 7d f4 d0 07 00 00 cmpl $0x7d0,-0xc(%ebp)
801006c5: 7e 0d jle 801006d4 <cgaputc+0xd3>
panic("pos under/overflow");
801006c7: 83 ec 0c sub $0xc,%esp
801006ca: 68 af 8b 10 80 push $0x80108baf
801006cf: e8 92 fe ff ff call 80100566 <panic>
if((pos/80) >= 24){ // Scroll up.
801006d4: 81 7d f4 7f 07 00 00 cmpl $0x77f,-0xc(%ebp)
801006db: 7e 4c jle 80100729 <cgaputc+0x128>
memmove(crt, crt+80, sizeof(crt[0])*23*80);
801006dd: a1 00 a0 10 80 mov 0x8010a000,%eax
801006e2: 8d 90 a0 00 00 00 lea 0xa0(%eax),%edx
801006e8: a1 00 a0 10 80 mov 0x8010a000,%eax
801006ed: 83 ec 04 sub $0x4,%esp
801006f0: 68 60 0e 00 00 push $0xe60
801006f5: 52 push %edx
801006f6: 50 push %eax
801006f7: e8 63 52 00 00 call 8010595f <memmove>
801006fc: 83 c4 10 add $0x10,%esp
pos -= 80;
801006ff: 83 6d f4 50 subl $0x50,-0xc(%ebp)
memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
80100703: b8 80 07 00 00 mov $0x780,%eax
80100708: 2b 45 f4 sub -0xc(%ebp),%eax
8010070b: 8d 14 00 lea (%eax,%eax,1),%edx
8010070e: a1 00 a0 10 80 mov 0x8010a000,%eax
80100713: 8b 4d f4 mov -0xc(%ebp),%ecx
80100716: 01 c9 add %ecx,%ecx
80100718: 01 c8 add %ecx,%eax
8010071a: 83 ec 04 sub $0x4,%esp
8010071d: 52 push %edx
8010071e: 6a 00 push $0x0
80100720: 50 push %eax
80100721: e8 7a 51 00 00 call 801058a0 <memset>
80100726: 83 c4 10 add $0x10,%esp
}
outb(CRTPORT, 14);
80100729: 83 ec 08 sub $0x8,%esp
8010072c: 6a 0e push $0xe
8010072e: 68 d4 03 00 00 push $0x3d4
80100733: e8 b9 fb ff ff call 801002f1 <outb>
80100738: 83 c4 10 add $0x10,%esp
outb(CRTPORT+1, pos>>8);
8010073b: 8b 45 f4 mov -0xc(%ebp),%eax
8010073e: c1 f8 08 sar $0x8,%eax
80100741: 0f b6 c0 movzbl %al,%eax
80100744: 83 ec 08 sub $0x8,%esp
80100747: 50 push %eax
80100748: 68 d5 03 00 00 push $0x3d5
8010074d: e8 9f fb ff ff call 801002f1 <outb>
80100752: 83 c4 10 add $0x10,%esp
outb(CRTPORT, 15);
80100755: 83 ec 08 sub $0x8,%esp
80100758: 6a 0f push $0xf
8010075a: 68 d4 03 00 00 push $0x3d4
8010075f: e8 8d fb ff ff call 801002f1 <outb>
80100764: 83 c4 10 add $0x10,%esp
outb(CRTPORT+1, pos);
80100767: 8b 45 f4 mov -0xc(%ebp),%eax
8010076a: 0f b6 c0 movzbl %al,%eax
8010076d: 83 ec 08 sub $0x8,%esp
80100770: 50 push %eax
80100771: 68 d5 03 00 00 push $0x3d5
80100776: e8 76 fb ff ff call 801002f1 <outb>
8010077b: 83 c4 10 add $0x10,%esp
crt[pos] = ' ' | 0x0700;
8010077e: a1 00 a0 10 80 mov 0x8010a000,%eax
80100783: 8b 55 f4 mov -0xc(%ebp),%edx
80100786: 01 d2 add %edx,%edx
80100788: 01 d0 add %edx,%eax
8010078a: 66 c7 00 20 07 movw $0x720,(%eax)
}
8010078f: 90 nop
80100790: c9 leave
80100791: c3 ret
80100792 <consputc>:
void
consputc(int c)
{
80100792: 55 push %ebp
80100793: 89 e5 mov %esp,%ebp
80100795: 83 ec 08 sub $0x8,%esp
if(panicked){
80100798: a1 a0 c5 10 80 mov 0x8010c5a0,%eax
8010079d: 85 c0 test %eax,%eax
8010079f: 74 07 je 801007a8 <consputc+0x16>
cli();
801007a1: e8 6a fb ff ff call 80100310 <cli>
for(;;)
;
801007a6: eb fe jmp 801007a6 <consputc+0x14>
}
if(c == BACKSPACE){
801007a8: 81 7d 08 00 01 00 00 cmpl $0x100,0x8(%ebp)
801007af: 75 29 jne 801007da <consputc+0x48>
uartputc('\b'); uartputc(' '); uartputc('\b');
801007b1: 83 ec 0c sub $0xc,%esp
801007b4: 6a 08 push $0x8
801007b6: e8 2f 6a 00 00 call 801071ea <uartputc>
801007bb: 83 c4 10 add $0x10,%esp
801007be: 83 ec 0c sub $0xc,%esp
801007c1: 6a 20 push $0x20
801007c3: e8 22 6a 00 00 call 801071ea <uartputc>
801007c8: 83 c4 10 add $0x10,%esp
801007cb: 83 ec 0c sub $0xc,%esp
801007ce: 6a 08 push $0x8
801007d0: e8 15 6a 00 00 call 801071ea <uartputc>
801007d5: 83 c4 10 add $0x10,%esp
801007d8: eb 0e jmp 801007e8 <consputc+0x56>
} else
uartputc(c);
801007da: 83 ec 0c sub $0xc,%esp
801007dd: ff 75 08 pushl 0x8(%ebp)
801007e0: e8 05 6a 00 00 call 801071ea <uartputc>
801007e5: 83 c4 10 add $0x10,%esp
cgaputc(c);
801007e8: 83 ec 0c sub $0xc,%esp
801007eb: ff 75 08 pushl 0x8(%ebp)
801007ee: e8 0e fe ff ff call 80100601 <cgaputc>
801007f3: 83 c4 10 add $0x10,%esp
}
801007f6: 90 nop
801007f7: c9 leave
801007f8: c3 ret
801007f9 <consoleintr>:
#define C(x) ((x)-'@') // Control-x
void
consoleintr(int (*getc)(void))
{
801007f9: 55 push %ebp
801007fa: 89 e5 mov %esp,%ebp
801007fc: 83 ec 18 sub $0x18,%esp
int c, doprocdump = 0;
801007ff: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
acquire(&cons.lock);
80100806: 83 ec 0c sub $0xc,%esp
80100809: 68 c0 c5 10 80 push $0x8010c5c0
8010080e: e8 2a 4e 00 00 call 8010563d <acquire>
80100813: 83 c4 10 add $0x10,%esp
while((c = getc()) >= 0){
80100816: e9 44 01 00 00 jmp 8010095f <consoleintr+0x166>
switch(c){
8010081b: 8b 45 f0 mov -0x10(%ebp),%eax
8010081e: 83 f8 10 cmp $0x10,%eax
80100821: 74 1e je 80100841 <consoleintr+0x48>
80100823: 83 f8 10 cmp $0x10,%eax
80100826: 7f 0a jg 80100832 <consoleintr+0x39>
80100828: 83 f8 08 cmp $0x8,%eax
8010082b: 74 6b je 80100898 <consoleintr+0x9f>
8010082d: e9 9b 00 00 00 jmp 801008cd <consoleintr+0xd4>
80100832: 83 f8 15 cmp $0x15,%eax
80100835: 74 33 je 8010086a <consoleintr+0x71>
80100837: 83 f8 7f cmp $0x7f,%eax
8010083a: 74 5c je 80100898 <consoleintr+0x9f>
8010083c: e9 8c 00 00 00 jmp 801008cd <consoleintr+0xd4>
case C('P'): // Process listing.
doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later
80100841: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
break;
80100848: e9 12 01 00 00 jmp 8010095f <consoleintr+0x166>
case C('U'): // Kill line.
while(input.e != input.w &&
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
8010084d: a1 08 18 11 80 mov 0x80111808,%eax
80100852: 83 e8 01 sub $0x1,%eax
80100855: a3 08 18 11 80 mov %eax,0x80111808
consputc(BACKSPACE);
8010085a: 83 ec 0c sub $0xc,%esp
8010085d: 68 00 01 00 00 push $0x100
80100862: e8 2b ff ff ff call 80100792 <consputc>
80100867: 83 c4 10 add $0x10,%esp
switch(c){
case C('P'): // Process listing.
doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later
break;
case C('U'): // Kill line.
while(input.e != input.w &&
8010086a: 8b 15 08 18 11 80 mov 0x80111808,%edx
80100870: a1 04 18 11 80 mov 0x80111804,%eax
80100875: 39 c2 cmp %eax,%edx
80100877: 0f 84 e2 00 00 00 je 8010095f <consoleintr+0x166>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
8010087d: a1 08 18 11 80 mov 0x80111808,%eax
80100882: 83 e8 01 sub $0x1,%eax
80100885: 83 e0 7f and $0x7f,%eax
80100888: 0f b6 80 80 17 11 80 movzbl -0x7feee880(%eax),%eax
switch(c){
case C('P'): // Process listing.
doprocdump = 1; // procdump() locks cons.lock indirectly; invoke later
break;
case C('U'): // Kill line.
while(input.e != input.w &&
8010088f: 3c 0a cmp $0xa,%al
80100891: 75 ba jne 8010084d <consoleintr+0x54>
input.buf[(input.e-1) % INPUT_BUF] != '\n'){
input.e--;
consputc(BACKSPACE);
}
break;
80100893: e9 c7 00 00 00 jmp 8010095f <consoleintr+0x166>
case C('H'): case '\x7f': // Backspace
if(input.e != input.w){
80100898: 8b 15 08 18 11 80 mov 0x80111808,%edx
8010089e: a1 04 18 11 80 mov 0x80111804,%eax
801008a3: 39 c2 cmp %eax,%edx
801008a5: 0f 84 b4 00 00 00 je 8010095f <consoleintr+0x166>
input.e--;
801008ab: a1 08 18 11 80 mov 0x80111808,%eax
801008b0: 83 e8 01 sub $0x1,%eax
801008b3: a3 08 18 11 80 mov %eax,0x80111808
consputc(BACKSPACE);
801008b8: 83 ec 0c sub $0xc,%esp
801008bb: 68 00 01 00 00 push $0x100
801008c0: e8 cd fe ff ff call 80100792 <consputc>
801008c5: 83 c4 10 add $0x10,%esp
}
break;
801008c8: e9 92 00 00 00 jmp 8010095f <consoleintr+0x166>
default:
if(c != 0 && input.e-input.r < INPUT_BUF){
801008cd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801008d1: 0f 84 87 00 00 00 je 8010095e <consoleintr+0x165>
801008d7: 8b 15 08 18 11 80 mov 0x80111808,%edx
801008dd: a1 00 18 11 80 mov 0x80111800,%eax
801008e2: 29 c2 sub %eax,%edx
801008e4: 89 d0 mov %edx,%eax
801008e6: 83 f8 7f cmp $0x7f,%eax
801008e9: 77 73 ja 8010095e <consoleintr+0x165>
c = (c == '\r') ? '\n' : c;
801008eb: 83 7d f0 0d cmpl $0xd,-0x10(%ebp)
801008ef: 74 05 je 801008f6 <consoleintr+0xfd>
801008f1: 8b 45 f0 mov -0x10(%ebp),%eax
801008f4: eb 05 jmp 801008fb <consoleintr+0x102>
801008f6: b8 0a 00 00 00 mov $0xa,%eax
801008fb: 89 45 f0 mov %eax,-0x10(%ebp)
input.buf[input.e++ % INPUT_BUF] = c;
801008fe: a1 08 18 11 80 mov 0x80111808,%eax
80100903: 8d 50 01 lea 0x1(%eax),%edx
80100906: 89 15 08 18 11 80 mov %edx,0x80111808
8010090c: 83 e0 7f and $0x7f,%eax
8010090f: 8b 55 f0 mov -0x10(%ebp),%edx
80100912: 88 90 80 17 11 80 mov %dl,-0x7feee880(%eax)
consputc(c);
80100918: 83 ec 0c sub $0xc,%esp
8010091b: ff 75 f0 pushl -0x10(%ebp)
8010091e: e8 6f fe ff ff call 80100792 <consputc>
80100923: 83 c4 10 add $0x10,%esp
if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
80100926: 83 7d f0 0a cmpl $0xa,-0x10(%ebp)
8010092a: 74 18 je 80100944 <consoleintr+0x14b>
8010092c: 83 7d f0 04 cmpl $0x4,-0x10(%ebp)
80100930: 74 12 je 80100944 <consoleintr+0x14b>
80100932: a1 08 18 11 80 mov 0x80111808,%eax
80100937: 8b 15 00 18 11 80 mov 0x80111800,%edx
8010093d: 83 ea 80 sub $0xffffff80,%edx
80100940: 39 d0 cmp %edx,%eax
80100942: 75 1a jne 8010095e <consoleintr+0x165>
input.w = input.e;
80100944: a1 08 18 11 80 mov 0x80111808,%eax
80100949: a3 04 18 11 80 mov %eax,0x80111804
wakeup(&input.r);
8010094e: 83 ec 0c sub $0xc,%esp
80100951: 68 00 18 11 80 push $0x80111800
80100956: e8 ce 4a 00 00 call 80105429 <wakeup>
8010095b: 83 c4 10 add $0x10,%esp
}
}
break;
8010095e: 90 nop
consoleintr(int (*getc)(void))
{
int c, doprocdump = 0;
acquire(&cons.lock);
while((c = getc()) >= 0){
8010095f: 8b 45 08 mov 0x8(%ebp),%eax
80100962: ff d0 call *%eax
80100964: 89 45 f0 mov %eax,-0x10(%ebp)
80100967: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010096b: 0f 89 aa fe ff ff jns 8010081b <consoleintr+0x22>
}
}
break;
}
}
release(&cons.lock);
80100971: 83 ec 0c sub $0xc,%esp
80100974: 68 c0 c5 10 80 push $0x8010c5c0
80100979: e8 26 4d 00 00 call 801056a4 <release>
8010097e: 83 c4 10 add $0x10,%esp
if(doprocdump) {
80100981: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80100985: 74 05 je 8010098c <consoleintr+0x193>
procdump(); // now call procdump() wo. cons.lock held
80100987: e8 5b 4b 00 00 call 801054e7 <procdump>
}
}
8010098c: 90 nop
8010098d: c9 leave
8010098e: c3 ret
8010098f <consoleread>:
int
consoleread(struct inode *ip, char *dst, int n)
{
8010098f: 55 push %ebp
80100990: 89 e5 mov %esp,%ebp
80100992: 83 ec 18 sub $0x18,%esp
uint target;
int c;
iunlock(ip);
80100995: 83 ec 0c sub $0xc,%esp
80100998: ff 75 08 pushl 0x8(%ebp)
8010099b: e8 28 11 00 00 call 80101ac8 <iunlock>
801009a0: 83 c4 10 add $0x10,%esp
target = n;
801009a3: 8b 45 10 mov 0x10(%ebp),%eax
801009a6: 89 45 f4 mov %eax,-0xc(%ebp)
acquire(&cons.lock);
801009a9: 83 ec 0c sub $0xc,%esp
801009ac: 68 c0 c5 10 80 push $0x8010c5c0
801009b1: e8 87 4c 00 00 call 8010563d <acquire>
801009b6: 83 c4 10 add $0x10,%esp
while(n > 0){
801009b9: e9 ac 00 00 00 jmp 80100a6a <consoleread+0xdb>
while(input.r == input.w){
if(proc->killed){
801009be: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801009c4: 8b 40 24 mov 0x24(%eax),%eax
801009c7: 85 c0 test %eax,%eax
801009c9: 74 28 je 801009f3 <consoleread+0x64>
release(&cons.lock);
801009cb: 83 ec 0c sub $0xc,%esp
801009ce: 68 c0 c5 10 80 push $0x8010c5c0
801009d3: e8 cc 4c 00 00 call 801056a4 <release>
801009d8: 83 c4 10 add $0x10,%esp
ilock(ip);
801009db: 83 ec 0c sub $0xc,%esp
801009de: ff 75 08 pushl 0x8(%ebp)
801009e1: e8 84 0f 00 00 call 8010196a <ilock>
801009e6: 83 c4 10 add $0x10,%esp
return -1;
801009e9: b8 ff ff ff ff mov $0xffffffff,%eax
801009ee: e9 ab 00 00 00 jmp 80100a9e <consoleread+0x10f>
}
sleep(&input.r, &cons.lock);
801009f3: 83 ec 08 sub $0x8,%esp
801009f6: 68 c0 c5 10 80 push $0x8010c5c0
801009fb: 68 00 18 11 80 push $0x80111800
80100a00: e8 36 49 00 00 call 8010533b <sleep>
80100a05: 83 c4 10 add $0x10,%esp
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
while(input.r == input.w){
80100a08: 8b 15 00 18 11 80 mov 0x80111800,%edx
80100a0e: a1 04 18 11 80 mov 0x80111804,%eax
80100a13: 39 c2 cmp %eax,%edx
80100a15: 74 a7 je 801009be <consoleread+0x2f>
ilock(ip);
return -1;
}
sleep(&input.r, &cons.lock);
}
c = input.buf[input.r++ % INPUT_BUF];
80100a17: a1 00 18 11 80 mov 0x80111800,%eax
80100a1c: 8d 50 01 lea 0x1(%eax),%edx
80100a1f: 89 15 00 18 11 80 mov %edx,0x80111800
80100a25: 83 e0 7f and $0x7f,%eax
80100a28: 0f b6 80 80 17 11 80 movzbl -0x7feee880(%eax),%eax
80100a2f: 0f be c0 movsbl %al,%eax
80100a32: 89 45 f0 mov %eax,-0x10(%ebp)
if(c == C('D')){ // EOF
80100a35: 83 7d f0 04 cmpl $0x4,-0x10(%ebp)
80100a39: 75 17 jne 80100a52 <consoleread+0xc3>
if(n < target){
80100a3b: 8b 45 10 mov 0x10(%ebp),%eax
80100a3e: 3b 45 f4 cmp -0xc(%ebp),%eax
80100a41: 73 2f jae 80100a72 <consoleread+0xe3>
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
80100a43: a1 00 18 11 80 mov 0x80111800,%eax
80100a48: 83 e8 01 sub $0x1,%eax
80100a4b: a3 00 18 11 80 mov %eax,0x80111800
}
break;
80100a50: eb 20 jmp 80100a72 <consoleread+0xe3>
}
*dst++ = c;
80100a52: 8b 45 0c mov 0xc(%ebp),%eax
80100a55: 8d 50 01 lea 0x1(%eax),%edx
80100a58: 89 55 0c mov %edx,0xc(%ebp)
80100a5b: 8b 55 f0 mov -0x10(%ebp),%edx
80100a5e: 88 10 mov %dl,(%eax)
--n;
80100a60: 83 6d 10 01 subl $0x1,0x10(%ebp)
if(c == '\n')
80100a64: 83 7d f0 0a cmpl $0xa,-0x10(%ebp)
80100a68: 74 0b je 80100a75 <consoleread+0xe6>
int c;
iunlock(ip);
target = n;
acquire(&cons.lock);
while(n > 0){
80100a6a: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80100a6e: 7f 98 jg 80100a08 <consoleread+0x79>
80100a70: eb 04 jmp 80100a76 <consoleread+0xe7>
if(n < target){
// Save ^D for next time, to make sure
// caller gets a 0-byte result.
input.r--;
}
break;
80100a72: 90 nop
80100a73: eb 01 jmp 80100a76 <consoleread+0xe7>
}
*dst++ = c;
--n;
if(c == '\n')
break;
80100a75: 90 nop
}
release(&cons.lock);
80100a76: 83 ec 0c sub $0xc,%esp
80100a79: 68 c0 c5 10 80 push $0x8010c5c0
80100a7e: e8 21 4c 00 00 call 801056a4 <release>
80100a83: 83 c4 10 add $0x10,%esp
ilock(ip);
80100a86: 83 ec 0c sub $0xc,%esp
80100a89: ff 75 08 pushl 0x8(%ebp)
80100a8c: e8 d9 0e 00 00 call 8010196a <ilock>
80100a91: 83 c4 10 add $0x10,%esp
return target - n;
80100a94: 8b 45 10 mov 0x10(%ebp),%eax
80100a97: 8b 55 f4 mov -0xc(%ebp),%edx
80100a9a: 29 c2 sub %eax,%edx
80100a9c: 89 d0 mov %edx,%eax
}
80100a9e: c9 leave
80100a9f: c3 ret
80100aa0 <consolewrite>:
int
consolewrite(struct inode *ip, char *buf, int n)
{
80100aa0: 55 push %ebp
80100aa1: 89 e5 mov %esp,%ebp
80100aa3: 83 ec 18 sub $0x18,%esp
int i;
iunlock(ip);
80100aa6: 83 ec 0c sub $0xc,%esp
80100aa9: ff 75 08 pushl 0x8(%ebp)
80100aac: e8 17 10 00 00 call 80101ac8 <iunlock>
80100ab1: 83 c4 10 add $0x10,%esp
acquire(&cons.lock);
80100ab4: 83 ec 0c sub $0xc,%esp
80100ab7: 68 c0 c5 10 80 push $0x8010c5c0
80100abc: e8 7c 4b 00 00 call 8010563d <acquire>
80100ac1: 83 c4 10 add $0x10,%esp
for(i = 0; i < n; i++)
80100ac4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80100acb: eb 21 jmp 80100aee <consolewrite+0x4e>
consputc(buf[i] & 0xff);
80100acd: 8b 55 f4 mov -0xc(%ebp),%edx
80100ad0: 8b 45 0c mov 0xc(%ebp),%eax
80100ad3: 01 d0 add %edx,%eax
80100ad5: 0f b6 00 movzbl (%eax),%eax
80100ad8: 0f be c0 movsbl %al,%eax
80100adb: 0f b6 c0 movzbl %al,%eax
80100ade: 83 ec 0c sub $0xc,%esp
80100ae1: 50 push %eax
80100ae2: e8 ab fc ff ff call 80100792 <consputc>
80100ae7: 83 c4 10 add $0x10,%esp
{
int i;
iunlock(ip);
acquire(&cons.lock);
for(i = 0; i < n; i++)
80100aea: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100aee: 8b 45 f4 mov -0xc(%ebp),%eax
80100af1: 3b 45 10 cmp 0x10(%ebp),%eax
80100af4: 7c d7 jl 80100acd <consolewrite+0x2d>
consputc(buf[i] & 0xff);
release(&cons.lock);
80100af6: 83 ec 0c sub $0xc,%esp
80100af9: 68 c0 c5 10 80 push $0x8010c5c0
80100afe: e8 a1 4b 00 00 call 801056a4 <release>
80100b03: 83 c4 10 add $0x10,%esp
ilock(ip);
80100b06: 83 ec 0c sub $0xc,%esp
80100b09: ff 75 08 pushl 0x8(%ebp)
80100b0c: e8 59 0e 00 00 call 8010196a <ilock>
80100b11: 83 c4 10 add $0x10,%esp
return n;
80100b14: 8b 45 10 mov 0x10(%ebp),%eax
}
80100b17: c9 leave
80100b18: c3 ret
80100b19 <consoleinit>:
void
consoleinit(void)
{
80100b19: 55 push %ebp
80100b1a: 89 e5 mov %esp,%ebp
80100b1c: 83 ec 08 sub $0x8,%esp
initlock(&cons.lock, "console");
80100b1f: 83 ec 08 sub $0x8,%esp
80100b22: 68 c2 8b 10 80 push $0x80108bc2
80100b27: 68 c0 c5 10 80 push $0x8010c5c0
80100b2c: e8 ea 4a 00 00 call 8010561b <initlock>
80100b31: 83 c4 10 add $0x10,%esp
devsw[CONSOLE].write = consolewrite;
80100b34: c7 05 cc 21 11 80 a0 movl $0x80100aa0,0x801121cc
80100b3b: 0a 10 80
devsw[CONSOLE].read = consoleread;
80100b3e: c7 05 c8 21 11 80 8f movl $0x8010098f,0x801121c8
80100b45: 09 10 80
cons.locking = 1;
80100b48: c7 05 f4 c5 10 80 01 movl $0x1,0x8010c5f4
80100b4f: 00 00 00
picenable(IRQ_KBD);
80100b52: 83 ec 0c sub $0xc,%esp
80100b55: 6a 01 push $0x1
80100b57: e8 cf 33 00 00 call 80103f2b <picenable>
80100b5c: 83 c4 10 add $0x10,%esp
ioapicenable(IRQ_KBD, 0);
80100b5f: 83 ec 08 sub $0x8,%esp
80100b62: 6a 00 push $0x0
80100b64: 6a 01 push $0x1
80100b66: e8 6f 1f 00 00 call 80102ada <ioapicenable>
80100b6b: 83 c4 10 add $0x10,%esp
}
80100b6e: 90 nop
80100b6f: c9 leave
80100b70: c3 ret
80100b71 <exec>:
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
80100b71: 55 push %ebp
80100b72: 89 e5 mov %esp,%ebp
80100b74: 81 ec 18 01 00 00 sub $0x118,%esp
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
begin_op();
80100b7a: e8 ce 29 00 00 call 8010354d <begin_op>
if((ip = namei(path)) == 0){
80100b7f: 83 ec 0c sub $0xc,%esp
80100b82: ff 75 08 pushl 0x8(%ebp)
80100b85: e8 9e 19 00 00 call 80102528 <namei>
80100b8a: 83 c4 10 add $0x10,%esp
80100b8d: 89 45 d8 mov %eax,-0x28(%ebp)
80100b90: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100b94: 75 0f jne 80100ba5 <exec+0x34>
end_op();
80100b96: e8 3e 2a 00 00 call 801035d9 <end_op>
return -1;
80100b9b: b8 ff ff ff ff mov $0xffffffff,%eax
80100ba0: e9 ce 03 00 00 jmp 80100f73 <exec+0x402>
}
ilock(ip);
80100ba5: 83 ec 0c sub $0xc,%esp
80100ba8: ff 75 d8 pushl -0x28(%ebp)
80100bab: e8 ba 0d 00 00 call 8010196a <ilock>
80100bb0: 83 c4 10 add $0x10,%esp
pgdir = 0;
80100bb3: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
80100bba: 6a 34 push $0x34
80100bbc: 6a 00 push $0x0
80100bbe: 8d 85 0c ff ff ff lea -0xf4(%ebp),%eax
80100bc4: 50 push %eax
80100bc5: ff 75 d8 pushl -0x28(%ebp)
80100bc8: e8 0b 13 00 00 call 80101ed8 <readi>
80100bcd: 83 c4 10 add $0x10,%esp
80100bd0: 83 f8 33 cmp $0x33,%eax
80100bd3: 0f 86 49 03 00 00 jbe 80100f22 <exec+0x3b1>
goto bad;
if(elf.magic != ELF_MAGIC)
80100bd9: 8b 85 0c ff ff ff mov -0xf4(%ebp),%eax
80100bdf: 3d 7f 45 4c 46 cmp $0x464c457f,%eax
80100be4: 0f 85 3b 03 00 00 jne 80100f25 <exec+0x3b4>
goto bad;
if((pgdir = setupkvm()) == 0)
80100bea: e8 50 77 00 00 call 8010833f <setupkvm>
80100bef: 89 45 d4 mov %eax,-0x2c(%ebp)
80100bf2: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100bf6: 0f 84 2c 03 00 00 je 80100f28 <exec+0x3b7>
goto bad;
// Load program into memory.
sz = 0;
80100bfc: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100c03: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
80100c0a: 8b 85 28 ff ff ff mov -0xd8(%ebp),%eax
80100c10: 89 45 e8 mov %eax,-0x18(%ebp)
80100c13: e9 ab 00 00 00 jmp 80100cc3 <exec+0x152>
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
80100c18: 8b 45 e8 mov -0x18(%ebp),%eax
80100c1b: 6a 20 push $0x20
80100c1d: 50 push %eax
80100c1e: 8d 85 ec fe ff ff lea -0x114(%ebp),%eax
80100c24: 50 push %eax
80100c25: ff 75 d8 pushl -0x28(%ebp)
80100c28: e8 ab 12 00 00 call 80101ed8 <readi>
80100c2d: 83 c4 10 add $0x10,%esp
80100c30: 83 f8 20 cmp $0x20,%eax
80100c33: 0f 85 f2 02 00 00 jne 80100f2b <exec+0x3ba>
goto bad;
if(ph.type != ELF_PROG_LOAD)
80100c39: 8b 85 ec fe ff ff mov -0x114(%ebp),%eax
80100c3f: 83 f8 01 cmp $0x1,%eax
80100c42: 75 71 jne 80100cb5 <exec+0x144>
continue;
if(ph.memsz < ph.filesz)
80100c44: 8b 95 00 ff ff ff mov -0x100(%ebp),%edx
80100c4a: 8b 85 fc fe ff ff mov -0x104(%ebp),%eax
80100c50: 39 c2 cmp %eax,%edx
80100c52: 0f 82 d6 02 00 00 jb 80100f2e <exec+0x3bd>
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
80100c58: 8b 95 f4 fe ff ff mov -0x10c(%ebp),%edx
80100c5e: 8b 85 00 ff ff ff mov -0x100(%ebp),%eax
80100c64: 01 d0 add %edx,%eax
80100c66: 83 ec 04 sub $0x4,%esp
80100c69: 50 push %eax
80100c6a: ff 75 e0 pushl -0x20(%ebp)
80100c6d: ff 75 d4 pushl -0x2c(%ebp)
80100c70: e8 71 7a 00 00 call 801086e6 <allocuvm>
80100c75: 83 c4 10 add $0x10,%esp
80100c78: 89 45 e0 mov %eax,-0x20(%ebp)
80100c7b: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100c7f: 0f 84 ac 02 00 00 je 80100f31 <exec+0x3c0>
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
80100c85: 8b 95 fc fe ff ff mov -0x104(%ebp),%edx
80100c8b: 8b 85 f0 fe ff ff mov -0x110(%ebp),%eax
80100c91: 8b 8d f4 fe ff ff mov -0x10c(%ebp),%ecx
80100c97: 83 ec 0c sub $0xc,%esp
80100c9a: 52 push %edx
80100c9b: 50 push %eax
80100c9c: ff 75 d8 pushl -0x28(%ebp)
80100c9f: 51 push %ecx
80100ca0: ff 75 d4 pushl -0x2c(%ebp)
80100ca3: e8 67 79 00 00 call 8010860f <loaduvm>
80100ca8: 83 c4 20 add $0x20,%esp
80100cab: 85 c0 test %eax,%eax
80100cad: 0f 88 81 02 00 00 js 80100f34 <exec+0x3c3>
80100cb3: eb 01 jmp 80100cb6 <exec+0x145>
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
goto bad;
if(ph.type != ELF_PROG_LOAD)
continue;
80100cb5: 90 nop
if((pgdir = setupkvm()) == 0)
goto bad;
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
80100cb6: 83 45 ec 01 addl $0x1,-0x14(%ebp)
80100cba: 8b 45 e8 mov -0x18(%ebp),%eax
80100cbd: 83 c0 20 add $0x20,%eax
80100cc0: 89 45 e8 mov %eax,-0x18(%ebp)
80100cc3: 0f b7 85 38 ff ff ff movzwl -0xc8(%ebp),%eax
80100cca: 0f b7 c0 movzwl %ax,%eax
80100ccd: 3b 45 ec cmp -0x14(%ebp),%eax
80100cd0: 0f 8f 42 ff ff ff jg 80100c18 <exec+0xa7>
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
80100cd6: 83 ec 0c sub $0xc,%esp
80100cd9: ff 75 d8 pushl -0x28(%ebp)
80100cdc: e8 49 0f 00 00 call 80101c2a <iunlockput>
80100ce1: 83 c4 10 add $0x10,%esp
end_op();
80100ce4: e8 f0 28 00 00 call 801035d9 <end_op>
ip = 0;
80100ce9: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
80100cf0: 8b 45 e0 mov -0x20(%ebp),%eax
80100cf3: 05 ff 0f 00 00 add $0xfff,%eax
80100cf8: 25 00 f0 ff ff and $0xfffff000,%eax
80100cfd: 89 45 e0 mov %eax,-0x20(%ebp)
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
80100d00: 8b 45 e0 mov -0x20(%ebp),%eax
80100d03: 05 00 20 00 00 add $0x2000,%eax
80100d08: 83 ec 04 sub $0x4,%esp
80100d0b: 50 push %eax
80100d0c: ff 75 e0 pushl -0x20(%ebp)
80100d0f: ff 75 d4 pushl -0x2c(%ebp)
80100d12: e8 cf 79 00 00 call 801086e6 <allocuvm>
80100d17: 83 c4 10 add $0x10,%esp
80100d1a: 89 45 e0 mov %eax,-0x20(%ebp)
80100d1d: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80100d21: 0f 84 10 02 00 00 je 80100f37 <exec+0x3c6>
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
80100d27: 8b 45 e0 mov -0x20(%ebp),%eax
80100d2a: 2d 00 20 00 00 sub $0x2000,%eax
80100d2f: 83 ec 08 sub $0x8,%esp
80100d32: 50 push %eax
80100d33: ff 75 d4 pushl -0x2c(%ebp)
80100d36: e8 d1 7b 00 00 call 8010890c <clearpteu>
80100d3b: 83 c4 10 add $0x10,%esp
sp = sz;
80100d3e: 8b 45 e0 mov -0x20(%ebp),%eax
80100d41: 89 45 dc mov %eax,-0x24(%ebp)
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100d44: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80100d4b: e9 96 00 00 00 jmp 80100de6 <exec+0x275>
if(argc >= MAXARG)
80100d50: 83 7d e4 1f cmpl $0x1f,-0x1c(%ebp)
80100d54: 0f 87 e0 01 00 00 ja 80100f3a <exec+0x3c9>
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
80100d5a: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d5d: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100d64: 8b 45 0c mov 0xc(%ebp),%eax
80100d67: 01 d0 add %edx,%eax
80100d69: 8b 00 mov (%eax),%eax
80100d6b: 83 ec 0c sub $0xc,%esp
80100d6e: 50 push %eax
80100d6f: e8 79 4d 00 00 call 80105aed <strlen>
80100d74: 83 c4 10 add $0x10,%esp
80100d77: 89 c2 mov %eax,%edx
80100d79: 8b 45 dc mov -0x24(%ebp),%eax
80100d7c: 29 d0 sub %edx,%eax
80100d7e: 83 e8 01 sub $0x1,%eax
80100d81: 83 e0 fc and $0xfffffffc,%eax
80100d84: 89 45 dc mov %eax,-0x24(%ebp)
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
80100d87: 8b 45 e4 mov -0x1c(%ebp),%eax
80100d8a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100d91: 8b 45 0c mov 0xc(%ebp),%eax
80100d94: 01 d0 add %edx,%eax
80100d96: 8b 00 mov (%eax),%eax
80100d98: 83 ec 0c sub $0xc,%esp
80100d9b: 50 push %eax
80100d9c: e8 4c 4d 00 00 call 80105aed <strlen>
80100da1: 83 c4 10 add $0x10,%esp
80100da4: 83 c0 01 add $0x1,%eax
80100da7: 89 c1 mov %eax,%ecx
80100da9: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dac: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100db3: 8b 45 0c mov 0xc(%ebp),%eax
80100db6: 01 d0 add %edx,%eax
80100db8: 8b 00 mov (%eax),%eax
80100dba: 51 push %ecx
80100dbb: 50 push %eax
80100dbc: ff 75 dc pushl -0x24(%ebp)
80100dbf: ff 75 d4 pushl -0x2c(%ebp)
80100dc2: e8 fc 7c 00 00 call 80108ac3 <copyout>
80100dc7: 83 c4 10 add $0x10,%esp
80100dca: 85 c0 test %eax,%eax
80100dcc: 0f 88 6b 01 00 00 js 80100f3d <exec+0x3cc>
goto bad;
ustack[3+argc] = sp;
80100dd2: 8b 45 e4 mov -0x1c(%ebp),%eax
80100dd5: 8d 50 03 lea 0x3(%eax),%edx
80100dd8: 8b 45 dc mov -0x24(%ebp),%eax
80100ddb: 89 84 95 40 ff ff ff mov %eax,-0xc0(%ebp,%edx,4)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
80100de2: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
80100de6: 8b 45 e4 mov -0x1c(%ebp),%eax
80100de9: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100df0: 8b 45 0c mov 0xc(%ebp),%eax
80100df3: 01 d0 add %edx,%eax
80100df5: 8b 00 mov (%eax),%eax
80100df7: 85 c0 test %eax,%eax
80100df9: 0f 85 51 ff ff ff jne 80100d50 <exec+0x1df>
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
80100dff: 8b 45 e4 mov -0x1c(%ebp),%eax
80100e02: 83 c0 03 add $0x3,%eax
80100e05: c7 84 85 40 ff ff ff movl $0x0,-0xc0(%ebp,%eax,4)
80100e0c: 00 00 00 00
ustack[0] = 0xffffffff; // fake return PC
80100e10: c7 85 40 ff ff ff ff movl $0xffffffff,-0xc0(%ebp)
80100e17: ff ff ff
ustack[1] = argc;
80100e1a: 8b 45 e4 mov -0x1c(%ebp),%eax
80100e1d: 89 85 44 ff ff ff mov %eax,-0xbc(%ebp)
ustack[2] = sp - (argc+1)*4; // argv pointer
80100e23: 8b 45 e4 mov -0x1c(%ebp),%eax
80100e26: 83 c0 01 add $0x1,%eax
80100e29: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80100e30: 8b 45 dc mov -0x24(%ebp),%eax
80100e33: 29 d0 sub %edx,%eax
80100e35: 89 85 48 ff ff ff mov %eax,-0xb8(%ebp)
sp -= (3+argc+1) * 4;
80100e3b: 8b 45 e4 mov -0x1c(%ebp),%eax
80100e3e: 83 c0 04 add $0x4,%eax
80100e41: c1 e0 02 shl $0x2,%eax
80100e44: 29 45 dc sub %eax,-0x24(%ebp)
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
80100e47: 8b 45 e4 mov -0x1c(%ebp),%eax
80100e4a: 83 c0 04 add $0x4,%eax
80100e4d: c1 e0 02 shl $0x2,%eax
80100e50: 50 push %eax
80100e51: 8d 85 40 ff ff ff lea -0xc0(%ebp),%eax
80100e57: 50 push %eax
80100e58: ff 75 dc pushl -0x24(%ebp)
80100e5b: ff 75 d4 pushl -0x2c(%ebp)
80100e5e: e8 60 7c 00 00 call 80108ac3 <copyout>
80100e63: 83 c4 10 add $0x10,%esp
80100e66: 85 c0 test %eax,%eax
80100e68: 0f 88 d2 00 00 00 js 80100f40 <exec+0x3cf>
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100e6e: 8b 45 08 mov 0x8(%ebp),%eax
80100e71: 89 45 f4 mov %eax,-0xc(%ebp)
80100e74: 8b 45 f4 mov -0xc(%ebp),%eax
80100e77: 89 45 f0 mov %eax,-0x10(%ebp)
80100e7a: eb 17 jmp 80100e93 <exec+0x322>
if(*s == '/')
80100e7c: 8b 45 f4 mov -0xc(%ebp),%eax
80100e7f: 0f b6 00 movzbl (%eax),%eax
80100e82: 3c 2f cmp $0x2f,%al
80100e84: 75 09 jne 80100e8f <exec+0x31e>
last = s+1;
80100e86: 8b 45 f4 mov -0xc(%ebp),%eax
80100e89: 83 c0 01 add $0x1,%eax
80100e8c: 89 45 f0 mov %eax,-0x10(%ebp)
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
80100e8f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80100e93: 8b 45 f4 mov -0xc(%ebp),%eax
80100e96: 0f b6 00 movzbl (%eax),%eax
80100e99: 84 c0 test %al,%al
80100e9b: 75 df jne 80100e7c <exec+0x30b>
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
80100e9d: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ea3: 83 c0 6c add $0x6c,%eax
80100ea6: 83 ec 04 sub $0x4,%esp
80100ea9: 6a 10 push $0x10
80100eab: ff 75 f0 pushl -0x10(%ebp)
80100eae: 50 push %eax
80100eaf: e8 ef 4b 00 00 call 80105aa3 <safestrcpy>
80100eb4: 83 c4 10 add $0x10,%esp
// Commit to the user image.
oldpgdir = proc->pgdir;
80100eb7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ebd: 8b 40 04 mov 0x4(%eax),%eax
80100ec0: 89 45 d0 mov %eax,-0x30(%ebp)
proc->pgdir = pgdir;
80100ec3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ec9: 8b 55 d4 mov -0x2c(%ebp),%edx
80100ecc: 89 50 04 mov %edx,0x4(%eax)
proc->sz = sz;
80100ecf: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ed5: 8b 55 e0 mov -0x20(%ebp),%edx
80100ed8: 89 10 mov %edx,(%eax)
proc->tf->eip = elf.entry; // main
80100eda: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ee0: 8b 40 18 mov 0x18(%eax),%eax
80100ee3: 8b 95 24 ff ff ff mov -0xdc(%ebp),%edx
80100ee9: 89 50 38 mov %edx,0x38(%eax)
proc->tf->esp = sp;
80100eec: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100ef2: 8b 40 18 mov 0x18(%eax),%eax
80100ef5: 8b 55 dc mov -0x24(%ebp),%edx
80100ef8: 89 50 44 mov %edx,0x44(%eax)
switchuvm(proc);
80100efb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80100f01: 83 ec 0c sub $0xc,%esp
80100f04: 50 push %eax
80100f05: e8 1c 75 00 00 call 80108426 <switchuvm>
80100f0a: 83 c4 10 add $0x10,%esp
freevm(oldpgdir);
80100f0d: 83 ec 0c sub $0xc,%esp
80100f10: ff 75 d0 pushl -0x30(%ebp)
80100f13: e8 54 79 00 00 call 8010886c <freevm>
80100f18: 83 c4 10 add $0x10,%esp
return 0;
80100f1b: b8 00 00 00 00 mov $0x0,%eax
80100f20: eb 51 jmp 80100f73 <exec+0x402>
ilock(ip);
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
goto bad;
80100f22: 90 nop
80100f23: eb 1c jmp 80100f41 <exec+0x3d0>
if(elf.magic != ELF_MAGIC)
goto bad;
80100f25: 90 nop
80100f26: eb 19 jmp 80100f41 <exec+0x3d0>
if((pgdir = setupkvm()) == 0)
goto bad;
80100f28: 90 nop
80100f29: eb 16 jmp 80100f41 <exec+0x3d0>
// Load program into memory.
sz = 0;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
goto bad;
80100f2b: 90 nop
80100f2c: eb 13 jmp 80100f41 <exec+0x3d0>
if(ph.type != ELF_PROG_LOAD)
continue;
if(ph.memsz < ph.filesz)
goto bad;
80100f2e: 90 nop
80100f2f: eb 10 jmp 80100f41 <exec+0x3d0>
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
80100f31: 90 nop
80100f32: eb 0d jmp 80100f41 <exec+0x3d0>
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
80100f34: 90 nop
80100f35: eb 0a jmp 80100f41 <exec+0x3d0>
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
goto bad;
80100f37: 90 nop
80100f38: eb 07 jmp 80100f41 <exec+0x3d0>
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
if(argc >= MAXARG)
goto bad;
80100f3a: 90 nop
80100f3b: eb 04 jmp 80100f41 <exec+0x3d0>
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
80100f3d: 90 nop
80100f3e: eb 01 jmp 80100f41 <exec+0x3d0>
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
80100f40: 90 nop
switchuvm(proc);
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
80100f41: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp)
80100f45: 74 0e je 80100f55 <exec+0x3e4>
freevm(pgdir);
80100f47: 83 ec 0c sub $0xc,%esp
80100f4a: ff 75 d4 pushl -0x2c(%ebp)
80100f4d: e8 1a 79 00 00 call 8010886c <freevm>
80100f52: 83 c4 10 add $0x10,%esp
if(ip){
80100f55: 83 7d d8 00 cmpl $0x0,-0x28(%ebp)
80100f59: 74 13 je 80100f6e <exec+0x3fd>
iunlockput(ip);
80100f5b: 83 ec 0c sub $0xc,%esp
80100f5e: ff 75 d8 pushl -0x28(%ebp)
80100f61: e8 c4 0c 00 00 call 80101c2a <iunlockput>
80100f66: 83 c4 10 add $0x10,%esp
end_op();
80100f69: e8 6b 26 00 00 call 801035d9 <end_op>
}
return -1;
80100f6e: b8 ff ff ff ff mov $0xffffffff,%eax
}
80100f73: c9 leave
80100f74: c3 ret
80100f75 <fileinit>:
struct file file[NFILE];
} ftable;
void
fileinit(void)
{
80100f75: 55 push %ebp
80100f76: 89 e5 mov %esp,%ebp
80100f78: 83 ec 08 sub $0x8,%esp
initlock(&ftable.lock, "ftable");
80100f7b: 83 ec 08 sub $0x8,%esp
80100f7e: 68 ca 8b 10 80 push $0x80108bca
80100f83: 68 20 18 11 80 push $0x80111820
80100f88: e8 8e 46 00 00 call 8010561b <initlock>
80100f8d: 83 c4 10 add $0x10,%esp
}
80100f90: 90 nop
80100f91: c9 leave
80100f92: c3 ret
80100f93 <filealloc>:
// Allocate a file structure.
struct file*
filealloc(void)
{
80100f93: 55 push %ebp
80100f94: 89 e5 mov %esp,%ebp
80100f96: 83 ec 18 sub $0x18,%esp
struct file *f;
acquire(&ftable.lock);
80100f99: 83 ec 0c sub $0xc,%esp
80100f9c: 68 20 18 11 80 push $0x80111820
80100fa1: e8 97 46 00 00 call 8010563d <acquire>
80100fa6: 83 c4 10 add $0x10,%esp
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100fa9: c7 45 f4 54 18 11 80 movl $0x80111854,-0xc(%ebp)
80100fb0: eb 2d jmp 80100fdf <filealloc+0x4c>
if(f->ref == 0){
80100fb2: 8b 45 f4 mov -0xc(%ebp),%eax
80100fb5: 8b 40 04 mov 0x4(%eax),%eax
80100fb8: 85 c0 test %eax,%eax
80100fba: 75 1f jne 80100fdb <filealloc+0x48>
f->ref = 1;
80100fbc: 8b 45 f4 mov -0xc(%ebp),%eax
80100fbf: c7 40 04 01 00 00 00 movl $0x1,0x4(%eax)
release(&ftable.lock);
80100fc6: 83 ec 0c sub $0xc,%esp
80100fc9: 68 20 18 11 80 push $0x80111820
80100fce: e8 d1 46 00 00 call 801056a4 <release>
80100fd3: 83 c4 10 add $0x10,%esp
return f;
80100fd6: 8b 45 f4 mov -0xc(%ebp),%eax
80100fd9: eb 23 jmp 80100ffe <filealloc+0x6b>
filealloc(void)
{
struct file *f;
acquire(&ftable.lock);
for(f = ftable.file; f < ftable.file + NFILE; f++){
80100fdb: 83 45 f4 18 addl $0x18,-0xc(%ebp)
80100fdf: b8 b4 21 11 80 mov $0x801121b4,%eax
80100fe4: 39 45 f4 cmp %eax,-0xc(%ebp)
80100fe7: 72 c9 jb 80100fb2 <filealloc+0x1f>
f->ref = 1;
release(&ftable.lock);
return f;
}
}
release(&ftable.lock);
80100fe9: 83 ec 0c sub $0xc,%esp
80100fec: 68 20 18 11 80 push $0x80111820
80100ff1: e8 ae 46 00 00 call 801056a4 <release>
80100ff6: 83 c4 10 add $0x10,%esp
return 0;
80100ff9: b8 00 00 00 00 mov $0x0,%eax
}
80100ffe: c9 leave
80100fff: c3 ret
80101000 <filedup>:
// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
80101000: 55 push %ebp
80101001: 89 e5 mov %esp,%ebp
80101003: 83 ec 08 sub $0x8,%esp
acquire(&ftable.lock);
80101006: 83 ec 0c sub $0xc,%esp
80101009: 68 20 18 11 80 push $0x80111820
8010100e: e8 2a 46 00 00 call 8010563d <acquire>
80101013: 83 c4 10 add $0x10,%esp
if(f->ref < 1)
80101016: 8b 45 08 mov 0x8(%ebp),%eax
80101019: 8b 40 04 mov 0x4(%eax),%eax
8010101c: 85 c0 test %eax,%eax
8010101e: 7f 0d jg 8010102d <filedup+0x2d>
panic("filedup");
80101020: 83 ec 0c sub $0xc,%esp
80101023: 68 d1 8b 10 80 push $0x80108bd1
80101028: e8 39 f5 ff ff call 80100566 <panic>
f->ref++;
8010102d: 8b 45 08 mov 0x8(%ebp),%eax
80101030: 8b 40 04 mov 0x4(%eax),%eax
80101033: 8d 50 01 lea 0x1(%eax),%edx
80101036: 8b 45 08 mov 0x8(%ebp),%eax
80101039: 89 50 04 mov %edx,0x4(%eax)
release(&ftable.lock);
8010103c: 83 ec 0c sub $0xc,%esp
8010103f: 68 20 18 11 80 push $0x80111820
80101044: e8 5b 46 00 00 call 801056a4 <release>
80101049: 83 c4 10 add $0x10,%esp
return f;
8010104c: 8b 45 08 mov 0x8(%ebp),%eax
}
8010104f: c9 leave
80101050: c3 ret
80101051 <fileclose>:
// Close file f. (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
80101051: 55 push %ebp
80101052: 89 e5 mov %esp,%ebp
80101054: 83 ec 28 sub $0x28,%esp
struct file ff;
acquire(&ftable.lock);
80101057: 83 ec 0c sub $0xc,%esp
8010105a: 68 20 18 11 80 push $0x80111820
8010105f: e8 d9 45 00 00 call 8010563d <acquire>
80101064: 83 c4 10 add $0x10,%esp
if(f->ref < 1)
80101067: 8b 45 08 mov 0x8(%ebp),%eax
8010106a: 8b 40 04 mov 0x4(%eax),%eax
8010106d: 85 c0 test %eax,%eax
8010106f: 7f 0d jg 8010107e <fileclose+0x2d>
panic("fileclose");
80101071: 83 ec 0c sub $0xc,%esp
80101074: 68 d9 8b 10 80 push $0x80108bd9
80101079: e8 e8 f4 ff ff call 80100566 <panic>
if(--f->ref > 0){
8010107e: 8b 45 08 mov 0x8(%ebp),%eax
80101081: 8b 40 04 mov 0x4(%eax),%eax
80101084: 8d 50 ff lea -0x1(%eax),%edx
80101087: 8b 45 08 mov 0x8(%ebp),%eax
8010108a: 89 50 04 mov %edx,0x4(%eax)
8010108d: 8b 45 08 mov 0x8(%ebp),%eax
80101090: 8b 40 04 mov 0x4(%eax),%eax
80101093: 85 c0 test %eax,%eax
80101095: 7e 15 jle 801010ac <fileclose+0x5b>
release(&ftable.lock);
80101097: 83 ec 0c sub $0xc,%esp
8010109a: 68 20 18 11 80 push $0x80111820
8010109f: e8 00 46 00 00 call 801056a4 <release>
801010a4: 83 c4 10 add $0x10,%esp
801010a7: e9 8b 00 00 00 jmp 80101137 <fileclose+0xe6>
return;
}
ff = *f;
801010ac: 8b 45 08 mov 0x8(%ebp),%eax
801010af: 8b 10 mov (%eax),%edx
801010b1: 89 55 e0 mov %edx,-0x20(%ebp)
801010b4: 8b 50 04 mov 0x4(%eax),%edx
801010b7: 89 55 e4 mov %edx,-0x1c(%ebp)
801010ba: 8b 50 08 mov 0x8(%eax),%edx
801010bd: 89 55 e8 mov %edx,-0x18(%ebp)
801010c0: 8b 50 0c mov 0xc(%eax),%edx
801010c3: 89 55 ec mov %edx,-0x14(%ebp)
801010c6: 8b 50 10 mov 0x10(%eax),%edx
801010c9: 89 55 f0 mov %edx,-0x10(%ebp)
801010cc: 8b 40 14 mov 0x14(%eax),%eax
801010cf: 89 45 f4 mov %eax,-0xc(%ebp)
f->ref = 0;
801010d2: 8b 45 08 mov 0x8(%ebp),%eax
801010d5: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax)
f->type = FD_NONE;
801010dc: 8b 45 08 mov 0x8(%ebp),%eax
801010df: c7 00 00 00 00 00 movl $0x0,(%eax)
release(&ftable.lock);
801010e5: 83 ec 0c sub $0xc,%esp
801010e8: 68 20 18 11 80 push $0x80111820
801010ed: e8 b2 45 00 00 call 801056a4 <release>
801010f2: 83 c4 10 add $0x10,%esp
if(ff.type == FD_PIPE)
801010f5: 8b 45 e0 mov -0x20(%ebp),%eax
801010f8: 83 f8 01 cmp $0x1,%eax
801010fb: 75 19 jne 80101116 <fileclose+0xc5>
pipeclose(ff.pipe, ff.writable);
801010fd: 0f b6 45 e9 movzbl -0x17(%ebp),%eax
80101101: 0f be d0 movsbl %al,%edx
80101104: 8b 45 ec mov -0x14(%ebp),%eax
80101107: 83 ec 08 sub $0x8,%esp
8010110a: 52 push %edx
8010110b: 50 push %eax
8010110c: e8 83 30 00 00 call 80104194 <pipeclose>
80101111: 83 c4 10 add $0x10,%esp
80101114: eb 21 jmp 80101137 <fileclose+0xe6>
else if(ff.type == FD_INODE){
80101116: 8b 45 e0 mov -0x20(%ebp),%eax
80101119: 83 f8 02 cmp $0x2,%eax
8010111c: 75 19 jne 80101137 <fileclose+0xe6>
begin_op();
8010111e: e8 2a 24 00 00 call 8010354d <begin_op>
iput(ff.ip);
80101123: 8b 45 f0 mov -0x10(%ebp),%eax
80101126: 83 ec 0c sub $0xc,%esp
80101129: 50 push %eax
8010112a: e8 0b 0a 00 00 call 80101b3a <iput>
8010112f: 83 c4 10 add $0x10,%esp
end_op();
80101132: e8 a2 24 00 00 call 801035d9 <end_op>
}
}
80101137: c9 leave
80101138: c3 ret
80101139 <filestat>:
// Get metadata about file f.
int
filestat(struct file *f, struct stat *st)
{
80101139: 55 push %ebp
8010113a: 89 e5 mov %esp,%ebp
8010113c: 83 ec 08 sub $0x8,%esp
if(f->type == FD_INODE){
8010113f: 8b 45 08 mov 0x8(%ebp),%eax
80101142: 8b 00 mov (%eax),%eax
80101144: 83 f8 02 cmp $0x2,%eax
80101147: 75 40 jne 80101189 <filestat+0x50>
ilock(f->ip);
80101149: 8b 45 08 mov 0x8(%ebp),%eax
8010114c: 8b 40 10 mov 0x10(%eax),%eax
8010114f: 83 ec 0c sub $0xc,%esp
80101152: 50 push %eax
80101153: e8 12 08 00 00 call 8010196a <ilock>
80101158: 83 c4 10 add $0x10,%esp
stati(f->ip, st);
8010115b: 8b 45 08 mov 0x8(%ebp),%eax
8010115e: 8b 40 10 mov 0x10(%eax),%eax
80101161: 83 ec 08 sub $0x8,%esp
80101164: ff 75 0c pushl 0xc(%ebp)
80101167: 50 push %eax
80101168: e8 25 0d 00 00 call 80101e92 <stati>
8010116d: 83 c4 10 add $0x10,%esp
iunlock(f->ip);
80101170: 8b 45 08 mov 0x8(%ebp),%eax
80101173: 8b 40 10 mov 0x10(%eax),%eax
80101176: 83 ec 0c sub $0xc,%esp
80101179: 50 push %eax
8010117a: e8 49 09 00 00 call 80101ac8 <iunlock>
8010117f: 83 c4 10 add $0x10,%esp
return 0;
80101182: b8 00 00 00 00 mov $0x0,%eax
80101187: eb 05 jmp 8010118e <filestat+0x55>
}
return -1;
80101189: b8 ff ff ff ff mov $0xffffffff,%eax
}
8010118e: c9 leave
8010118f: c3 ret
80101190 <fileread>:
// Read from file f.
int
fileread(struct file *f, char *addr, int n)
{
80101190: 55 push %ebp
80101191: 89 e5 mov %esp,%ebp
80101193: 83 ec 18 sub $0x18,%esp
int r;
if(f->readable == 0)
80101196: 8b 45 08 mov 0x8(%ebp),%eax
80101199: 0f b6 40 08 movzbl 0x8(%eax),%eax
8010119d: 84 c0 test %al,%al
8010119f: 75 0a jne 801011ab <fileread+0x1b>
return -1;
801011a1: b8 ff ff ff ff mov $0xffffffff,%eax
801011a6: e9 9b 00 00 00 jmp 80101246 <fileread+0xb6>
if(f->type == FD_PIPE)
801011ab: 8b 45 08 mov 0x8(%ebp),%eax
801011ae: 8b 00 mov (%eax),%eax
801011b0: 83 f8 01 cmp $0x1,%eax
801011b3: 75 1a jne 801011cf <fileread+0x3f>
return piperead(f->pipe, addr, n);
801011b5: 8b 45 08 mov 0x8(%ebp),%eax
801011b8: 8b 40 0c mov 0xc(%eax),%eax
801011bb: 83 ec 04 sub $0x4,%esp
801011be: ff 75 10 pushl 0x10(%ebp)
801011c1: ff 75 0c pushl 0xc(%ebp)
801011c4: 50 push %eax
801011c5: e8 72 31 00 00 call 8010433c <piperead>
801011ca: 83 c4 10 add $0x10,%esp
801011cd: eb 77 jmp 80101246 <fileread+0xb6>
if(f->type == FD_INODE){
801011cf: 8b 45 08 mov 0x8(%ebp),%eax
801011d2: 8b 00 mov (%eax),%eax
801011d4: 83 f8 02 cmp $0x2,%eax
801011d7: 75 60 jne 80101239 <fileread+0xa9>
ilock(f->ip);
801011d9: 8b 45 08 mov 0x8(%ebp),%eax
801011dc: 8b 40 10 mov 0x10(%eax),%eax
801011df: 83 ec 0c sub $0xc,%esp
801011e2: 50 push %eax
801011e3: e8 82 07 00 00 call 8010196a <ilock>
801011e8: 83 c4 10 add $0x10,%esp
if((r = readi(f->ip, addr, f->off, n)) > 0)
801011eb: 8b 4d 10 mov 0x10(%ebp),%ecx
801011ee: 8b 45 08 mov 0x8(%ebp),%eax
801011f1: 8b 50 14 mov 0x14(%eax),%edx
801011f4: 8b 45 08 mov 0x8(%ebp),%eax
801011f7: 8b 40 10 mov 0x10(%eax),%eax
801011fa: 51 push %ecx
801011fb: 52 push %edx
801011fc: ff 75 0c pushl 0xc(%ebp)
801011ff: 50 push %eax
80101200: e8 d3 0c 00 00 call 80101ed8 <readi>
80101205: 83 c4 10 add $0x10,%esp
80101208: 89 45 f4 mov %eax,-0xc(%ebp)
8010120b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010120f: 7e 11 jle 80101222 <fileread+0x92>
f->off += r;
80101211: 8b 45 08 mov 0x8(%ebp),%eax
80101214: 8b 50 14 mov 0x14(%eax),%edx
80101217: 8b 45 f4 mov -0xc(%ebp),%eax
8010121a: 01 c2 add %eax,%edx
8010121c: 8b 45 08 mov 0x8(%ebp),%eax
8010121f: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
80101222: 8b 45 08 mov 0x8(%ebp),%eax
80101225: 8b 40 10 mov 0x10(%eax),%eax
80101228: 83 ec 0c sub $0xc,%esp
8010122b: 50 push %eax
8010122c: e8 97 08 00 00 call 80101ac8 <iunlock>
80101231: 83 c4 10 add $0x10,%esp
return r;
80101234: 8b 45 f4 mov -0xc(%ebp),%eax
80101237: eb 0d jmp 80101246 <fileread+0xb6>
}
panic("fileread");
80101239: 83 ec 0c sub $0xc,%esp
8010123c: 68 e3 8b 10 80 push $0x80108be3
80101241: e8 20 f3 ff ff call 80100566 <panic>
}
80101246: c9 leave
80101247: c3 ret
80101248 <filewrite>:
//PAGEBREAK!
// Write to file f.
int
filewrite(struct file *f, char *addr, int n)
{
80101248: 55 push %ebp
80101249: 89 e5 mov %esp,%ebp
8010124b: 53 push %ebx
8010124c: 83 ec 14 sub $0x14,%esp
int r;
if(f->writable == 0)
8010124f: 8b 45 08 mov 0x8(%ebp),%eax
80101252: 0f b6 40 09 movzbl 0x9(%eax),%eax
80101256: 84 c0 test %al,%al
80101258: 75 0a jne 80101264 <filewrite+0x1c>
return -1;
8010125a: b8 ff ff ff ff mov $0xffffffff,%eax
8010125f: e9 1b 01 00 00 jmp 8010137f <filewrite+0x137>
if(f->type == FD_PIPE)
80101264: 8b 45 08 mov 0x8(%ebp),%eax
80101267: 8b 00 mov (%eax),%eax
80101269: 83 f8 01 cmp $0x1,%eax
8010126c: 75 1d jne 8010128b <filewrite+0x43>
return pipewrite(f->pipe, addr, n);
8010126e: 8b 45 08 mov 0x8(%ebp),%eax
80101271: 8b 40 0c mov 0xc(%eax),%eax
80101274: 83 ec 04 sub $0x4,%esp
80101277: ff 75 10 pushl 0x10(%ebp)
8010127a: ff 75 0c pushl 0xc(%ebp)
8010127d: 50 push %eax
8010127e: e8 bb 2f 00 00 call 8010423e <pipewrite>
80101283: 83 c4 10 add $0x10,%esp
80101286: e9 f4 00 00 00 jmp 8010137f <filewrite+0x137>
if(f->type == FD_INODE){
8010128b: 8b 45 08 mov 0x8(%ebp),%eax
8010128e: 8b 00 mov (%eax),%eax
80101290: 83 f8 02 cmp $0x2,%eax
80101293: 0f 85 d9 00 00 00 jne 80101372 <filewrite+0x12a>
// the maximum log transaction size, including
// i-node, indirect block, allocation blocks,
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((LOGSIZE-1-1-2) / 2) * 512;
80101299: c7 45 ec 00 1a 00 00 movl $0x1a00,-0x14(%ebp)
int i = 0;
801012a0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
while(i < n){
801012a7: e9 a3 00 00 00 jmp 8010134f <filewrite+0x107>
int n1 = n - i;
801012ac: 8b 45 10 mov 0x10(%ebp),%eax
801012af: 2b 45 f4 sub -0xc(%ebp),%eax
801012b2: 89 45 f0 mov %eax,-0x10(%ebp)
if(n1 > max)
801012b5: 8b 45 f0 mov -0x10(%ebp),%eax
801012b8: 3b 45 ec cmp -0x14(%ebp),%eax
801012bb: 7e 06 jle 801012c3 <filewrite+0x7b>
n1 = max;
801012bd: 8b 45 ec mov -0x14(%ebp),%eax
801012c0: 89 45 f0 mov %eax,-0x10(%ebp)
begin_op();
801012c3: e8 85 22 00 00 call 8010354d <begin_op>
ilock(f->ip);
801012c8: 8b 45 08 mov 0x8(%ebp),%eax
801012cb: 8b 40 10 mov 0x10(%eax),%eax
801012ce: 83 ec 0c sub $0xc,%esp
801012d1: 50 push %eax
801012d2: e8 93 06 00 00 call 8010196a <ilock>
801012d7: 83 c4 10 add $0x10,%esp
if ((r = writei(f->ip, addr + i, f->off, n1)) > 0)
801012da: 8b 4d f0 mov -0x10(%ebp),%ecx
801012dd: 8b 45 08 mov 0x8(%ebp),%eax
801012e0: 8b 50 14 mov 0x14(%eax),%edx
801012e3: 8b 5d f4 mov -0xc(%ebp),%ebx
801012e6: 8b 45 0c mov 0xc(%ebp),%eax
801012e9: 01 c3 add %eax,%ebx
801012eb: 8b 45 08 mov 0x8(%ebp),%eax
801012ee: 8b 40 10 mov 0x10(%eax),%eax
801012f1: 51 push %ecx
801012f2: 52 push %edx
801012f3: 53 push %ebx
801012f4: 50 push %eax
801012f5: e8 35 0d 00 00 call 8010202f <writei>
801012fa: 83 c4 10 add $0x10,%esp
801012fd: 89 45 e8 mov %eax,-0x18(%ebp)
80101300: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
80101304: 7e 11 jle 80101317 <filewrite+0xcf>
f->off += r;
80101306: 8b 45 08 mov 0x8(%ebp),%eax
80101309: 8b 50 14 mov 0x14(%eax),%edx
8010130c: 8b 45 e8 mov -0x18(%ebp),%eax
8010130f: 01 c2 add %eax,%edx
80101311: 8b 45 08 mov 0x8(%ebp),%eax
80101314: 89 50 14 mov %edx,0x14(%eax)
iunlock(f->ip);
80101317: 8b 45 08 mov 0x8(%ebp),%eax
8010131a: 8b 40 10 mov 0x10(%eax),%eax
8010131d: 83 ec 0c sub $0xc,%esp
80101320: 50 push %eax
80101321: e8 a2 07 00 00 call 80101ac8 <iunlock>
80101326: 83 c4 10 add $0x10,%esp
end_op();
80101329: e8 ab 22 00 00 call 801035d9 <end_op>
if(r < 0)
8010132e: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
80101332: 78 29 js 8010135d <filewrite+0x115>
break;
if(r != n1)
80101334: 8b 45 e8 mov -0x18(%ebp),%eax
80101337: 3b 45 f0 cmp -0x10(%ebp),%eax
8010133a: 74 0d je 80101349 <filewrite+0x101>
panic("short filewrite");
8010133c: 83 ec 0c sub $0xc,%esp
8010133f: 68 ec 8b 10 80 push $0x80108bec
80101344: e8 1d f2 ff ff call 80100566 <panic>
i += r;
80101349: 8b 45 e8 mov -0x18(%ebp),%eax
8010134c: 01 45 f4 add %eax,-0xc(%ebp)
// and 2 blocks of slop for non-aligned writes.
// this really belongs lower down, since writei()
// might be writing a device like the console.
int max = ((LOGSIZE-1-1-2) / 2) * 512;
int i = 0;
while(i < n){
8010134f: 8b 45 f4 mov -0xc(%ebp),%eax
80101352: 3b 45 10 cmp 0x10(%ebp),%eax
80101355: 0f 8c 51 ff ff ff jl 801012ac <filewrite+0x64>
8010135b: eb 01 jmp 8010135e <filewrite+0x116>
f->off += r;
iunlock(f->ip);
end_op();
if(r < 0)
break;
8010135d: 90 nop
if(r != n1)
panic("short filewrite");
i += r;
}
return i == n ? n : -1;
8010135e: 8b 45 f4 mov -0xc(%ebp),%eax
80101361: 3b 45 10 cmp 0x10(%ebp),%eax
80101364: 75 05 jne 8010136b <filewrite+0x123>
80101366: 8b 45 10 mov 0x10(%ebp),%eax
80101369: eb 14 jmp 8010137f <filewrite+0x137>
8010136b: b8 ff ff ff ff mov $0xffffffff,%eax
80101370: eb 0d jmp 8010137f <filewrite+0x137>
}
panic("filewrite");
80101372: 83 ec 0c sub $0xc,%esp
80101375: 68 fc 8b 10 80 push $0x80108bfc
8010137a: e8 e7 f1 ff ff call 80100566 <panic>
}
8010137f: 8b 5d fc mov -0x4(%ebp),%ebx
80101382: c9 leave
80101383: c3 ret
80101384 <readsb>:
struct superblock sb; // there should be one per dev, but we run with one dev
// Read the super block.
void
readsb(int dev, struct superblock *sb)
{
80101384: 55 push %ebp
80101385: 89 e5 mov %esp,%ebp
80101387: 83 ec 18 sub $0x18,%esp
struct buf *bp;
bp = bread(dev, 1);
8010138a: 8b 45 08 mov 0x8(%ebp),%eax
8010138d: 83 ec 08 sub $0x8,%esp
80101390: 6a 01 push $0x1
80101392: 50 push %eax
80101393: e8 1e ee ff ff call 801001b6 <bread>
80101398: 83 c4 10 add $0x10,%esp
8010139b: 89 45 f4 mov %eax,-0xc(%ebp)
memmove(sb, bp->data, sizeof(*sb));
8010139e: 8b 45 f4 mov -0xc(%ebp),%eax
801013a1: 83 c0 18 add $0x18,%eax
801013a4: 83 ec 04 sub $0x4,%esp
801013a7: 6a 1c push $0x1c
801013a9: 50 push %eax
801013aa: ff 75 0c pushl 0xc(%ebp)
801013ad: e8 ad 45 00 00 call 8010595f <memmove>
801013b2: 83 c4 10 add $0x10,%esp
brelse(bp);
801013b5: 83 ec 0c sub $0xc,%esp
801013b8: ff 75 f4 pushl -0xc(%ebp)
801013bb: e8 6e ee ff ff call 8010022e <brelse>
801013c0: 83 c4 10 add $0x10,%esp
}
801013c3: 90 nop
801013c4: c9 leave
801013c5: c3 ret
801013c6 <bzero>:
// Zero a block.
static void
bzero(int dev, int bno)
{
801013c6: 55 push %ebp
801013c7: 89 e5 mov %esp,%ebp
801013c9: 83 ec 18 sub $0x18,%esp
struct buf *bp;
bp = bread(dev, bno);
801013cc: 8b 55 0c mov 0xc(%ebp),%edx
801013cf: 8b 45 08 mov 0x8(%ebp),%eax
801013d2: 83 ec 08 sub $0x8,%esp
801013d5: 52 push %edx
801013d6: 50 push %eax
801013d7: e8 da ed ff ff call 801001b6 <bread>
801013dc: 83 c4 10 add $0x10,%esp
801013df: 89 45 f4 mov %eax,-0xc(%ebp)
memset(bp->data, 0, BSIZE);
801013e2: 8b 45 f4 mov -0xc(%ebp),%eax
801013e5: 83 c0 18 add $0x18,%eax
801013e8: 83 ec 04 sub $0x4,%esp
801013eb: 68 00 02 00 00 push $0x200
801013f0: 6a 00 push $0x0
801013f2: 50 push %eax
801013f3: e8 a8 44 00 00 call 801058a0 <memset>
801013f8: 83 c4 10 add $0x10,%esp
log_write(bp);
801013fb: 83 ec 0c sub $0xc,%esp
801013fe: ff 75 f4 pushl -0xc(%ebp)
80101401: e8 7f 23 00 00 call 80103785 <log_write>
80101406: 83 c4 10 add $0x10,%esp
brelse(bp);
80101409: 83 ec 0c sub $0xc,%esp
8010140c: ff 75 f4 pushl -0xc(%ebp)
8010140f: e8 1a ee ff ff call 8010022e <brelse>
80101414: 83 c4 10 add $0x10,%esp
}
80101417: 90 nop
80101418: c9 leave
80101419: c3 ret
8010141a <balloc>:
// Blocks.
// Allocate a zeroed disk block.
static uint
balloc(uint dev)
{
8010141a: 55 push %ebp
8010141b: 89 e5 mov %esp,%ebp
8010141d: 83 ec 18 sub $0x18,%esp
int b, bi, m;
struct buf *bp;
bp = 0;
80101420: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
for(b = 0; b < sb.size; b += BPB){
80101427: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010142e: e9 13 01 00 00 jmp 80101546 <balloc+0x12c>
bp = bread(dev, BBLOCK(b, sb));
80101433: 8b 45 f4 mov -0xc(%ebp),%eax
80101436: 8d 90 ff 0f 00 00 lea 0xfff(%eax),%edx
8010143c: 85 c0 test %eax,%eax
8010143e: 0f 48 c2 cmovs %edx,%eax
80101441: c1 f8 0c sar $0xc,%eax
80101444: 89 c2 mov %eax,%edx
80101446: a1 38 22 11 80 mov 0x80112238,%eax
8010144b: 01 d0 add %edx,%eax
8010144d: 83 ec 08 sub $0x8,%esp
80101450: 50 push %eax
80101451: ff 75 08 pushl 0x8(%ebp)
80101454: e8 5d ed ff ff call 801001b6 <bread>
80101459: 83 c4 10 add $0x10,%esp
8010145c: 89 45 ec mov %eax,-0x14(%ebp)
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
8010145f: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80101466: e9 a6 00 00 00 jmp 80101511 <balloc+0xf7>
m = 1 << (bi % 8);
8010146b: 8b 45 f0 mov -0x10(%ebp),%eax
8010146e: 99 cltd
8010146f: c1 ea 1d shr $0x1d,%edx
80101472: 01 d0 add %edx,%eax
80101474: 83 e0 07 and $0x7,%eax
80101477: 29 d0 sub %edx,%eax
80101479: ba 01 00 00 00 mov $0x1,%edx
8010147e: 89 c1 mov %eax,%ecx
80101480: d3 e2 shl %cl,%edx
80101482: 89 d0 mov %edx,%eax
80101484: 89 45 e8 mov %eax,-0x18(%ebp)
if((bp->data[bi/8] & m) == 0){ // Is block free?
80101487: 8b 45 f0 mov -0x10(%ebp),%eax
8010148a: 8d 50 07 lea 0x7(%eax),%edx
8010148d: 85 c0 test %eax,%eax
8010148f: 0f 48 c2 cmovs %edx,%eax
80101492: c1 f8 03 sar $0x3,%eax
80101495: 89 c2 mov %eax,%edx
80101497: 8b 45 ec mov -0x14(%ebp),%eax
8010149a: 0f b6 44 10 18 movzbl 0x18(%eax,%edx,1),%eax
8010149f: 0f b6 c0 movzbl %al,%eax
801014a2: 23 45 e8 and -0x18(%ebp),%eax
801014a5: 85 c0 test %eax,%eax
801014a7: 75 64 jne 8010150d <balloc+0xf3>
bp->data[bi/8] |= m; // Mark block in use.
801014a9: 8b 45 f0 mov -0x10(%ebp),%eax
801014ac: 8d 50 07 lea 0x7(%eax),%edx
801014af: 85 c0 test %eax,%eax
801014b1: 0f 48 c2 cmovs %edx,%eax
801014b4: c1 f8 03 sar $0x3,%eax
801014b7: 8b 55 ec mov -0x14(%ebp),%edx
801014ba: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
801014bf: 89 d1 mov %edx,%ecx
801014c1: 8b 55 e8 mov -0x18(%ebp),%edx
801014c4: 09 ca or %ecx,%edx
801014c6: 89 d1 mov %edx,%ecx
801014c8: 8b 55 ec mov -0x14(%ebp),%edx
801014cb: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
801014cf: 83 ec 0c sub $0xc,%esp
801014d2: ff 75 ec pushl -0x14(%ebp)
801014d5: e8 ab 22 00 00 call 80103785 <log_write>
801014da: 83 c4 10 add $0x10,%esp
brelse(bp);
801014dd: 83 ec 0c sub $0xc,%esp
801014e0: ff 75 ec pushl -0x14(%ebp)
801014e3: e8 46 ed ff ff call 8010022e <brelse>
801014e8: 83 c4 10 add $0x10,%esp
bzero(dev, b + bi);
801014eb: 8b 55 f4 mov -0xc(%ebp),%edx
801014ee: 8b 45 f0 mov -0x10(%ebp),%eax
801014f1: 01 c2 add %eax,%edx
801014f3: 8b 45 08 mov 0x8(%ebp),%eax
801014f6: 83 ec 08 sub $0x8,%esp
801014f9: 52 push %edx
801014fa: 50 push %eax
801014fb: e8 c6 fe ff ff call 801013c6 <bzero>
80101500: 83 c4 10 add $0x10,%esp
return b + bi;
80101503: 8b 55 f4 mov -0xc(%ebp),%edx
80101506: 8b 45 f0 mov -0x10(%ebp),%eax
80101509: 01 d0 add %edx,%eax
8010150b: eb 57 jmp 80101564 <balloc+0x14a>
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
bp = bread(dev, BBLOCK(b, sb));
for(bi = 0; bi < BPB && b + bi < sb.size; bi++){
8010150d: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80101511: 81 7d f0 ff 0f 00 00 cmpl $0xfff,-0x10(%ebp)
80101518: 7f 17 jg 80101531 <balloc+0x117>
8010151a: 8b 55 f4 mov -0xc(%ebp),%edx
8010151d: 8b 45 f0 mov -0x10(%ebp),%eax
80101520: 01 d0 add %edx,%eax
80101522: 89 c2 mov %eax,%edx
80101524: a1 20 22 11 80 mov 0x80112220,%eax
80101529: 39 c2 cmp %eax,%edx
8010152b: 0f 82 3a ff ff ff jb 8010146b <balloc+0x51>
brelse(bp);
bzero(dev, b + bi);
return b + bi;
}
}
brelse(bp);
80101531: 83 ec 0c sub $0xc,%esp
80101534: ff 75 ec pushl -0x14(%ebp)
80101537: e8 f2 ec ff ff call 8010022e <brelse>
8010153c: 83 c4 10 add $0x10,%esp
{
int b, bi, m;
struct buf *bp;
bp = 0;
for(b = 0; b < sb.size; b += BPB){
8010153f: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80101546: 8b 15 20 22 11 80 mov 0x80112220,%edx
8010154c: 8b 45 f4 mov -0xc(%ebp),%eax
8010154f: 39 c2 cmp %eax,%edx
80101551: 0f 87 dc fe ff ff ja 80101433 <balloc+0x19>
return b + bi;
}
}
brelse(bp);
}
panic("balloc: out of blocks");
80101557: 83 ec 0c sub $0xc,%esp
8010155a: 68 08 8c 10 80 push $0x80108c08
8010155f: e8 02 f0 ff ff call 80100566 <panic>
}
80101564: c9 leave
80101565: c3 ret
80101566 <bfree>:
// Free a disk block.
static void
bfree(int dev, uint b)
{
80101566: 55 push %ebp
80101567: 89 e5 mov %esp,%ebp
80101569: 83 ec 18 sub $0x18,%esp
struct buf *bp;
int bi, m;
readsb(dev, &sb);
8010156c: 83 ec 08 sub $0x8,%esp
8010156f: 68 20 22 11 80 push $0x80112220
80101574: ff 75 08 pushl 0x8(%ebp)
80101577: e8 08 fe ff ff call 80101384 <readsb>
8010157c: 83 c4 10 add $0x10,%esp
bp = bread(dev, BBLOCK(b, sb));
8010157f: 8b 45 0c mov 0xc(%ebp),%eax
80101582: c1 e8 0c shr $0xc,%eax
80101585: 89 c2 mov %eax,%edx
80101587: a1 38 22 11 80 mov 0x80112238,%eax
8010158c: 01 c2 add %eax,%edx
8010158e: 8b 45 08 mov 0x8(%ebp),%eax
80101591: 83 ec 08 sub $0x8,%esp
80101594: 52 push %edx
80101595: 50 push %eax
80101596: e8 1b ec ff ff call 801001b6 <bread>
8010159b: 83 c4 10 add $0x10,%esp
8010159e: 89 45 f4 mov %eax,-0xc(%ebp)
bi = b % BPB;
801015a1: 8b 45 0c mov 0xc(%ebp),%eax
801015a4: 25 ff 0f 00 00 and $0xfff,%eax
801015a9: 89 45 f0 mov %eax,-0x10(%ebp)
m = 1 << (bi % 8);
801015ac: 8b 45 f0 mov -0x10(%ebp),%eax
801015af: 99 cltd
801015b0: c1 ea 1d shr $0x1d,%edx
801015b3: 01 d0 add %edx,%eax
801015b5: 83 e0 07 and $0x7,%eax
801015b8: 29 d0 sub %edx,%eax
801015ba: ba 01 00 00 00 mov $0x1,%edx
801015bf: 89 c1 mov %eax,%ecx
801015c1: d3 e2 shl %cl,%edx
801015c3: 89 d0 mov %edx,%eax
801015c5: 89 45 ec mov %eax,-0x14(%ebp)
if((bp->data[bi/8] & m) == 0)
801015c8: 8b 45 f0 mov -0x10(%ebp),%eax
801015cb: 8d 50 07 lea 0x7(%eax),%edx
801015ce: 85 c0 test %eax,%eax
801015d0: 0f 48 c2 cmovs %edx,%eax
801015d3: c1 f8 03 sar $0x3,%eax
801015d6: 89 c2 mov %eax,%edx
801015d8: 8b 45 f4 mov -0xc(%ebp),%eax
801015db: 0f b6 44 10 18 movzbl 0x18(%eax,%edx,1),%eax
801015e0: 0f b6 c0 movzbl %al,%eax
801015e3: 23 45 ec and -0x14(%ebp),%eax
801015e6: 85 c0 test %eax,%eax
801015e8: 75 0d jne 801015f7 <bfree+0x91>
panic("freeing free block");
801015ea: 83 ec 0c sub $0xc,%esp
801015ed: 68 1e 8c 10 80 push $0x80108c1e
801015f2: e8 6f ef ff ff call 80100566 <panic>
bp->data[bi/8] &= ~m;
801015f7: 8b 45 f0 mov -0x10(%ebp),%eax
801015fa: 8d 50 07 lea 0x7(%eax),%edx
801015fd: 85 c0 test %eax,%eax
801015ff: 0f 48 c2 cmovs %edx,%eax
80101602: c1 f8 03 sar $0x3,%eax
80101605: 8b 55 f4 mov -0xc(%ebp),%edx
80101608: 0f b6 54 02 18 movzbl 0x18(%edx,%eax,1),%edx
8010160d: 89 d1 mov %edx,%ecx
8010160f: 8b 55 ec mov -0x14(%ebp),%edx
80101612: f7 d2 not %edx
80101614: 21 ca and %ecx,%edx
80101616: 89 d1 mov %edx,%ecx
80101618: 8b 55 f4 mov -0xc(%ebp),%edx
8010161b: 88 4c 02 18 mov %cl,0x18(%edx,%eax,1)
log_write(bp);
8010161f: 83 ec 0c sub $0xc,%esp
80101622: ff 75 f4 pushl -0xc(%ebp)
80101625: e8 5b 21 00 00 call 80103785 <log_write>
8010162a: 83 c4 10 add $0x10,%esp
brelse(bp);
8010162d: 83 ec 0c sub $0xc,%esp
80101630: ff 75 f4 pushl -0xc(%ebp)
80101633: e8 f6 eb ff ff call 8010022e <brelse>
80101638: 83 c4 10 add $0x10,%esp
}
8010163b: 90 nop
8010163c: c9 leave
8010163d: c3 ret
8010163e <iinit>:
struct inode inode[NINODE];
} icache;
void
iinit(int dev)
{
8010163e: 55 push %ebp
8010163f: 89 e5 mov %esp,%ebp
80101641: 57 push %edi
80101642: 56 push %esi
80101643: 53 push %ebx
80101644: 83 ec 1c sub $0x1c,%esp
initlock(&icache.lock, "icache");
80101647: 83 ec 08 sub $0x8,%esp
8010164a: 68 31 8c 10 80 push $0x80108c31
8010164f: 68 40 22 11 80 push $0x80112240
80101654: e8 c2 3f 00 00 call 8010561b <initlock>
80101659: 83 c4 10 add $0x10,%esp
readsb(dev, &sb);
8010165c: 83 ec 08 sub $0x8,%esp
8010165f: 68 20 22 11 80 push $0x80112220
80101664: ff 75 08 pushl 0x8(%ebp)
80101667: e8 18 fd ff ff call 80101384 <readsb>
8010166c: 83 c4 10 add $0x10,%esp
cprintf("sb: size %d nblocks %d ninodes %d nlog %d logstart %d inodestart %d bmap start %d\n", sb.size,
8010166f: a1 38 22 11 80 mov 0x80112238,%eax
80101674: 89 45 e4 mov %eax,-0x1c(%ebp)
80101677: 8b 3d 34 22 11 80 mov 0x80112234,%edi
8010167d: 8b 35 30 22 11 80 mov 0x80112230,%esi
80101683: 8b 1d 2c 22 11 80 mov 0x8011222c,%ebx
80101689: 8b 0d 28 22 11 80 mov 0x80112228,%ecx
8010168f: 8b 15 24 22 11 80 mov 0x80112224,%edx
80101695: a1 20 22 11 80 mov 0x80112220,%eax
8010169a: ff 75 e4 pushl -0x1c(%ebp)
8010169d: 57 push %edi
8010169e: 56 push %esi
8010169f: 53 push %ebx
801016a0: 51 push %ecx
801016a1: 52 push %edx
801016a2: 50 push %eax
801016a3: 68 38 8c 10 80 push $0x80108c38
801016a8: e8 19 ed ff ff call 801003c6 <cprintf>
801016ad: 83 c4 20 add $0x20,%esp
sb.nblocks, sb.ninodes, sb.nlog, sb.logstart, sb.inodestart, sb.bmapstart);
}
801016b0: 90 nop
801016b1: 8d 65 f4 lea -0xc(%ebp),%esp
801016b4: 5b pop %ebx
801016b5: 5e pop %esi
801016b6: 5f pop %edi
801016b7: 5d pop %ebp
801016b8: c3 ret
801016b9 <ialloc>:
//PAGEBREAK!
// Allocate a new inode with the given type on device dev.
// A free inode has a type of zero.
struct inode*
ialloc(uint dev, short type)
{
801016b9: 55 push %ebp
801016ba: 89 e5 mov %esp,%ebp
801016bc: 83 ec 28 sub $0x28,%esp
801016bf: 8b 45 0c mov 0xc(%ebp),%eax
801016c2: 66 89 45 e4 mov %ax,-0x1c(%ebp)
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
801016c6: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
801016cd: e9 9e 00 00 00 jmp 80101770 <ialloc+0xb7>
bp = bread(dev, IBLOCK(inum, sb));
801016d2: 8b 45 f4 mov -0xc(%ebp),%eax
801016d5: c1 e8 03 shr $0x3,%eax
801016d8: 89 c2 mov %eax,%edx
801016da: a1 34 22 11 80 mov 0x80112234,%eax
801016df: 01 d0 add %edx,%eax
801016e1: 83 ec 08 sub $0x8,%esp
801016e4: 50 push %eax
801016e5: ff 75 08 pushl 0x8(%ebp)
801016e8: e8 c9 ea ff ff call 801001b6 <bread>
801016ed: 83 c4 10 add $0x10,%esp
801016f0: 89 45 f0 mov %eax,-0x10(%ebp)
dip = (struct dinode*)bp->data + inum%IPB;
801016f3: 8b 45 f0 mov -0x10(%ebp),%eax
801016f6: 8d 50 18 lea 0x18(%eax),%edx
801016f9: 8b 45 f4 mov -0xc(%ebp),%eax
801016fc: 83 e0 07 and $0x7,%eax
801016ff: c1 e0 06 shl $0x6,%eax
80101702: 01 d0 add %edx,%eax
80101704: 89 45 ec mov %eax,-0x14(%ebp)
if(dip->type == 0){ // a free inode
80101707: 8b 45 ec mov -0x14(%ebp),%eax
8010170a: 0f b7 00 movzwl (%eax),%eax
8010170d: 66 85 c0 test %ax,%ax
80101710: 75 4c jne 8010175e <ialloc+0xa5>
memset(dip, 0, sizeof(*dip));
80101712: 83 ec 04 sub $0x4,%esp
80101715: 6a 40 push $0x40
80101717: 6a 00 push $0x0
80101719: ff 75 ec pushl -0x14(%ebp)
8010171c: e8 7f 41 00 00 call 801058a0 <memset>
80101721: 83 c4 10 add $0x10,%esp
dip->type = type;
80101724: 8b 45 ec mov -0x14(%ebp),%eax
80101727: 0f b7 55 e4 movzwl -0x1c(%ebp),%edx
8010172b: 66 89 10 mov %dx,(%eax)
log_write(bp); // mark it allocated on the disk
8010172e: 83 ec 0c sub $0xc,%esp
80101731: ff 75 f0 pushl -0x10(%ebp)
80101734: e8 4c 20 00 00 call 80103785 <log_write>
80101739: 83 c4 10 add $0x10,%esp
brelse(bp);
8010173c: 83 ec 0c sub $0xc,%esp
8010173f: ff 75 f0 pushl -0x10(%ebp)
80101742: e8 e7 ea ff ff call 8010022e <brelse>
80101747: 83 c4 10 add $0x10,%esp
return iget(dev, inum);
8010174a: 8b 45 f4 mov -0xc(%ebp),%eax
8010174d: 83 ec 08 sub $0x8,%esp
80101750: 50 push %eax
80101751: ff 75 08 pushl 0x8(%ebp)
80101754: e8 f8 00 00 00 call 80101851 <iget>
80101759: 83 c4 10 add $0x10,%esp
8010175c: eb 30 jmp 8010178e <ialloc+0xd5>
}
brelse(bp);
8010175e: 83 ec 0c sub $0xc,%esp
80101761: ff 75 f0 pushl -0x10(%ebp)
80101764: e8 c5 ea ff ff call 8010022e <brelse>
80101769: 83 c4 10 add $0x10,%esp
{
int inum;
struct buf *bp;
struct dinode *dip;
for(inum = 1; inum < sb.ninodes; inum++){
8010176c: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80101770: 8b 15 28 22 11 80 mov 0x80112228,%edx
80101776: 8b 45 f4 mov -0xc(%ebp),%eax
80101779: 39 c2 cmp %eax,%edx
8010177b: 0f 87 51 ff ff ff ja 801016d2 <ialloc+0x19>
brelse(bp);
return iget(dev, inum);
}
brelse(bp);
}
panic("ialloc: no inodes");
80101781: 83 ec 0c sub $0xc,%esp
80101784: 68 8b 8c 10 80 push $0x80108c8b
80101789: e8 d8 ed ff ff call 80100566 <panic>
}
8010178e: c9 leave
8010178f: c3 ret
80101790 <iupdate>:
// Copy a modified in-memory inode to disk.
void
iupdate(struct inode *ip)
{
80101790: 55 push %ebp
80101791: 89 e5 mov %esp,%ebp
80101793: 83 ec 18 sub $0x18,%esp
struct buf *bp;
struct dinode *dip;
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
80101796: 8b 45 08 mov 0x8(%ebp),%eax
80101799: 8b 40 04 mov 0x4(%eax),%eax
8010179c: c1 e8 03 shr $0x3,%eax
8010179f: 89 c2 mov %eax,%edx
801017a1: a1 34 22 11 80 mov 0x80112234,%eax
801017a6: 01 c2 add %eax,%edx
801017a8: 8b 45 08 mov 0x8(%ebp),%eax
801017ab: 8b 00 mov (%eax),%eax
801017ad: 83 ec 08 sub $0x8,%esp
801017b0: 52 push %edx
801017b1: 50 push %eax
801017b2: e8 ff e9 ff ff call 801001b6 <bread>
801017b7: 83 c4 10 add $0x10,%esp
801017ba: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
801017bd: 8b 45 f4 mov -0xc(%ebp),%eax
801017c0: 8d 50 18 lea 0x18(%eax),%edx
801017c3: 8b 45 08 mov 0x8(%ebp),%eax
801017c6: 8b 40 04 mov 0x4(%eax),%eax
801017c9: 83 e0 07 and $0x7,%eax
801017cc: c1 e0 06 shl $0x6,%eax
801017cf: 01 d0 add %edx,%eax
801017d1: 89 45 f0 mov %eax,-0x10(%ebp)
dip->type = ip->type;
801017d4: 8b 45 08 mov 0x8(%ebp),%eax
801017d7: 0f b7 50 10 movzwl 0x10(%eax),%edx
801017db: 8b 45 f0 mov -0x10(%ebp),%eax
801017de: 66 89 10 mov %dx,(%eax)
dip->major = ip->major;
801017e1: 8b 45 08 mov 0x8(%ebp),%eax
801017e4: 0f b7 50 12 movzwl 0x12(%eax),%edx
801017e8: 8b 45 f0 mov -0x10(%ebp),%eax
801017eb: 66 89 50 02 mov %dx,0x2(%eax)
dip->minor = ip->minor;
801017ef: 8b 45 08 mov 0x8(%ebp),%eax
801017f2: 0f b7 50 14 movzwl 0x14(%eax),%edx
801017f6: 8b 45 f0 mov -0x10(%ebp),%eax
801017f9: 66 89 50 04 mov %dx,0x4(%eax)
dip->nlink = ip->nlink;
801017fd: 8b 45 08 mov 0x8(%ebp),%eax
80101800: 0f b7 50 16 movzwl 0x16(%eax),%edx
80101804: 8b 45 f0 mov -0x10(%ebp),%eax
80101807: 66 89 50 06 mov %dx,0x6(%eax)
dip->size = ip->size;
8010180b: 8b 45 08 mov 0x8(%ebp),%eax
8010180e: 8b 50 18 mov 0x18(%eax),%edx
80101811: 8b 45 f0 mov -0x10(%ebp),%eax
80101814: 89 50 08 mov %edx,0x8(%eax)
memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
80101817: 8b 45 08 mov 0x8(%ebp),%eax
8010181a: 8d 50 1c lea 0x1c(%eax),%edx
8010181d: 8b 45 f0 mov -0x10(%ebp),%eax
80101820: 83 c0 0c add $0xc,%eax
80101823: 83 ec 04 sub $0x4,%esp
80101826: 6a 34 push $0x34
80101828: 52 push %edx
80101829: 50 push %eax
8010182a: e8 30 41 00 00 call 8010595f <memmove>
8010182f: 83 c4 10 add $0x10,%esp
log_write(bp);
80101832: 83 ec 0c sub $0xc,%esp
80101835: ff 75 f4 pushl -0xc(%ebp)
80101838: e8 48 1f 00 00 call 80103785 <log_write>
8010183d: 83 c4 10 add $0x10,%esp
brelse(bp);
80101840: 83 ec 0c sub $0xc,%esp
80101843: ff 75 f4 pushl -0xc(%ebp)
80101846: e8 e3 e9 ff ff call 8010022e <brelse>
8010184b: 83 c4 10 add $0x10,%esp
}
8010184e: 90 nop
8010184f: c9 leave
80101850: c3 ret
80101851 <iget>:
// Find the inode with number inum on device dev
// and return the in-memory copy. Does not lock
// the inode and does not read it from disk.
static struct inode*
iget(uint dev, uint inum)
{
80101851: 55 push %ebp
80101852: 89 e5 mov %esp,%ebp
80101854: 83 ec 18 sub $0x18,%esp
struct inode *ip, *empty;
acquire(&icache.lock);
80101857: 83 ec 0c sub $0xc,%esp
8010185a: 68 40 22 11 80 push $0x80112240
8010185f: e8 d9 3d 00 00 call 8010563d <acquire>
80101864: 83 c4 10 add $0x10,%esp
// Is the inode already cached?
empty = 0;
80101867: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
8010186e: c7 45 f4 74 22 11 80 movl $0x80112274,-0xc(%ebp)
80101875: eb 5d jmp 801018d4 <iget+0x83>
if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
80101877: 8b 45 f4 mov -0xc(%ebp),%eax
8010187a: 8b 40 08 mov 0x8(%eax),%eax
8010187d: 85 c0 test %eax,%eax
8010187f: 7e 39 jle 801018ba <iget+0x69>
80101881: 8b 45 f4 mov -0xc(%ebp),%eax
80101884: 8b 00 mov (%eax),%eax
80101886: 3b 45 08 cmp 0x8(%ebp),%eax
80101889: 75 2f jne 801018ba <iget+0x69>
8010188b: 8b 45 f4 mov -0xc(%ebp),%eax
8010188e: 8b 40 04 mov 0x4(%eax),%eax
80101891: 3b 45 0c cmp 0xc(%ebp),%eax
80101894: 75 24 jne 801018ba <iget+0x69>
ip->ref++;
80101896: 8b 45 f4 mov -0xc(%ebp),%eax
80101899: 8b 40 08 mov 0x8(%eax),%eax
8010189c: 8d 50 01 lea 0x1(%eax),%edx
8010189f: 8b 45 f4 mov -0xc(%ebp),%eax
801018a2: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
801018a5: 83 ec 0c sub $0xc,%esp
801018a8: 68 40 22 11 80 push $0x80112240
801018ad: e8 f2 3d 00 00 call 801056a4 <release>
801018b2: 83 c4 10 add $0x10,%esp
return ip;
801018b5: 8b 45 f4 mov -0xc(%ebp),%eax
801018b8: eb 74 jmp 8010192e <iget+0xdd>
}
if(empty == 0 && ip->ref == 0) // Remember empty slot.
801018ba: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801018be: 75 10 jne 801018d0 <iget+0x7f>
801018c0: 8b 45 f4 mov -0xc(%ebp),%eax
801018c3: 8b 40 08 mov 0x8(%eax),%eax
801018c6: 85 c0 test %eax,%eax
801018c8: 75 06 jne 801018d0 <iget+0x7f>
empty = ip;
801018ca: 8b 45 f4 mov -0xc(%ebp),%eax
801018cd: 89 45 f0 mov %eax,-0x10(%ebp)
acquire(&icache.lock);
// Is the inode already cached?
empty = 0;
for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
801018d0: 83 45 f4 50 addl $0x50,-0xc(%ebp)
801018d4: 81 7d f4 14 32 11 80 cmpl $0x80113214,-0xc(%ebp)
801018db: 72 9a jb 80101877 <iget+0x26>
if(empty == 0 && ip->ref == 0) // Remember empty slot.
empty = ip;
}
// Recycle an inode cache entry.
if(empty == 0)
801018dd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801018e1: 75 0d jne 801018f0 <iget+0x9f>
panic("iget: no inodes");
801018e3: 83 ec 0c sub $0xc,%esp
801018e6: 68 9d 8c 10 80 push $0x80108c9d
801018eb: e8 76 ec ff ff call 80100566 <panic>
ip = empty;
801018f0: 8b 45 f0 mov -0x10(%ebp),%eax
801018f3: 89 45 f4 mov %eax,-0xc(%ebp)
ip->dev = dev;
801018f6: 8b 45 f4 mov -0xc(%ebp),%eax
801018f9: 8b 55 08 mov 0x8(%ebp),%edx
801018fc: 89 10 mov %edx,(%eax)
ip->inum = inum;
801018fe: 8b 45 f4 mov -0xc(%ebp),%eax
80101901: 8b 55 0c mov 0xc(%ebp),%edx
80101904: 89 50 04 mov %edx,0x4(%eax)
ip->ref = 1;
80101907: 8b 45 f4 mov -0xc(%ebp),%eax
8010190a: c7 40 08 01 00 00 00 movl $0x1,0x8(%eax)
ip->flags = 0;
80101911: 8b 45 f4 mov -0xc(%ebp),%eax
80101914: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
release(&icache.lock);
8010191b: 83 ec 0c sub $0xc,%esp
8010191e: 68 40 22 11 80 push $0x80112240
80101923: e8 7c 3d 00 00 call 801056a4 <release>
80101928: 83 c4 10 add $0x10,%esp
return ip;
8010192b: 8b 45 f4 mov -0xc(%ebp),%eax
}
8010192e: c9 leave
8010192f: c3 ret
80101930 <idup>:
// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
80101930: 55 push %ebp
80101931: 89 e5 mov %esp,%ebp
80101933: 83 ec 08 sub $0x8,%esp
acquire(&icache.lock);
80101936: 83 ec 0c sub $0xc,%esp
80101939: 68 40 22 11 80 push $0x80112240
8010193e: e8 fa 3c 00 00 call 8010563d <acquire>
80101943: 83 c4 10 add $0x10,%esp
ip->ref++;
80101946: 8b 45 08 mov 0x8(%ebp),%eax
80101949: 8b 40 08 mov 0x8(%eax),%eax
8010194c: 8d 50 01 lea 0x1(%eax),%edx
8010194f: 8b 45 08 mov 0x8(%ebp),%eax
80101952: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101955: 83 ec 0c sub $0xc,%esp
80101958: 68 40 22 11 80 push $0x80112240
8010195d: e8 42 3d 00 00 call 801056a4 <release>
80101962: 83 c4 10 add $0x10,%esp
return ip;
80101965: 8b 45 08 mov 0x8(%ebp),%eax
}
80101968: c9 leave
80101969: c3 ret
8010196a <ilock>:
// Lock the given inode.
// Reads the inode from disk if necessary.
void
ilock(struct inode *ip)
{
8010196a: 55 push %ebp
8010196b: 89 e5 mov %esp,%ebp
8010196d: 83 ec 18 sub $0x18,%esp
struct buf *bp;
struct dinode *dip;
if(ip == 0 || ip->ref < 1)
80101970: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80101974: 74 0a je 80101980 <ilock+0x16>
80101976: 8b 45 08 mov 0x8(%ebp),%eax
80101979: 8b 40 08 mov 0x8(%eax),%eax
8010197c: 85 c0 test %eax,%eax
8010197e: 7f 0d jg 8010198d <ilock+0x23>
panic("ilock");
80101980: 83 ec 0c sub $0xc,%esp
80101983: 68 ad 8c 10 80 push $0x80108cad
80101988: e8 d9 eb ff ff call 80100566 <panic>
acquire(&icache.lock);
8010198d: 83 ec 0c sub $0xc,%esp
80101990: 68 40 22 11 80 push $0x80112240
80101995: e8 a3 3c 00 00 call 8010563d <acquire>
8010199a: 83 c4 10 add $0x10,%esp
while(ip->flags & I_BUSY)
8010199d: eb 13 jmp 801019b2 <ilock+0x48>
sleep(ip, &icache.lock);
8010199f: 83 ec 08 sub $0x8,%esp
801019a2: 68 40 22 11 80 push $0x80112240
801019a7: ff 75 08 pushl 0x8(%ebp)
801019aa: e8 8c 39 00 00 call 8010533b <sleep>
801019af: 83 c4 10 add $0x10,%esp
if(ip == 0 || ip->ref < 1)
panic("ilock");
acquire(&icache.lock);
while(ip->flags & I_BUSY)
801019b2: 8b 45 08 mov 0x8(%ebp),%eax
801019b5: 8b 40 0c mov 0xc(%eax),%eax
801019b8: 83 e0 01 and $0x1,%eax
801019bb: 85 c0 test %eax,%eax
801019bd: 75 e0 jne 8010199f <ilock+0x35>
sleep(ip, &icache.lock);
ip->flags |= I_BUSY;
801019bf: 8b 45 08 mov 0x8(%ebp),%eax
801019c2: 8b 40 0c mov 0xc(%eax),%eax
801019c5: 83 c8 01 or $0x1,%eax
801019c8: 89 c2 mov %eax,%edx
801019ca: 8b 45 08 mov 0x8(%ebp),%eax
801019cd: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
801019d0: 83 ec 0c sub $0xc,%esp
801019d3: 68 40 22 11 80 push $0x80112240
801019d8: e8 c7 3c 00 00 call 801056a4 <release>
801019dd: 83 c4 10 add $0x10,%esp
if(!(ip->flags & I_VALID)){
801019e0: 8b 45 08 mov 0x8(%ebp),%eax
801019e3: 8b 40 0c mov 0xc(%eax),%eax
801019e6: 83 e0 02 and $0x2,%eax
801019e9: 85 c0 test %eax,%eax
801019eb: 0f 85 d4 00 00 00 jne 80101ac5 <ilock+0x15b>
bp = bread(ip->dev, IBLOCK(ip->inum, sb));
801019f1: 8b 45 08 mov 0x8(%ebp),%eax
801019f4: 8b 40 04 mov 0x4(%eax),%eax
801019f7: c1 e8 03 shr $0x3,%eax
801019fa: 89 c2 mov %eax,%edx
801019fc: a1 34 22 11 80 mov 0x80112234,%eax
80101a01: 01 c2 add %eax,%edx
80101a03: 8b 45 08 mov 0x8(%ebp),%eax
80101a06: 8b 00 mov (%eax),%eax
80101a08: 83 ec 08 sub $0x8,%esp
80101a0b: 52 push %edx
80101a0c: 50 push %eax
80101a0d: e8 a4 e7 ff ff call 801001b6 <bread>
80101a12: 83 c4 10 add $0x10,%esp
80101a15: 89 45 f4 mov %eax,-0xc(%ebp)
dip = (struct dinode*)bp->data + ip->inum%IPB;
80101a18: 8b 45 f4 mov -0xc(%ebp),%eax
80101a1b: 8d 50 18 lea 0x18(%eax),%edx
80101a1e: 8b 45 08 mov 0x8(%ebp),%eax
80101a21: 8b 40 04 mov 0x4(%eax),%eax
80101a24: 83 e0 07 and $0x7,%eax
80101a27: c1 e0 06 shl $0x6,%eax
80101a2a: 01 d0 add %edx,%eax
80101a2c: 89 45 f0 mov %eax,-0x10(%ebp)
ip->type = dip->type;
80101a2f: 8b 45 f0 mov -0x10(%ebp),%eax
80101a32: 0f b7 10 movzwl (%eax),%edx
80101a35: 8b 45 08 mov 0x8(%ebp),%eax
80101a38: 66 89 50 10 mov %dx,0x10(%eax)
ip->major = dip->major;
80101a3c: 8b 45 f0 mov -0x10(%ebp),%eax
80101a3f: 0f b7 50 02 movzwl 0x2(%eax),%edx
80101a43: 8b 45 08 mov 0x8(%ebp),%eax
80101a46: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = dip->minor;
80101a4a: 8b 45 f0 mov -0x10(%ebp),%eax
80101a4d: 0f b7 50 04 movzwl 0x4(%eax),%edx
80101a51: 8b 45 08 mov 0x8(%ebp),%eax
80101a54: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = dip->nlink;
80101a58: 8b 45 f0 mov -0x10(%ebp),%eax
80101a5b: 0f b7 50 06 movzwl 0x6(%eax),%edx
80101a5f: 8b 45 08 mov 0x8(%ebp),%eax
80101a62: 66 89 50 16 mov %dx,0x16(%eax)
ip->size = dip->size;
80101a66: 8b 45 f0 mov -0x10(%ebp),%eax
80101a69: 8b 50 08 mov 0x8(%eax),%edx
80101a6c: 8b 45 08 mov 0x8(%ebp),%eax
80101a6f: 89 50 18 mov %edx,0x18(%eax)
memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
80101a72: 8b 45 f0 mov -0x10(%ebp),%eax
80101a75: 8d 50 0c lea 0xc(%eax),%edx
80101a78: 8b 45 08 mov 0x8(%ebp),%eax
80101a7b: 83 c0 1c add $0x1c,%eax
80101a7e: 83 ec 04 sub $0x4,%esp
80101a81: 6a 34 push $0x34
80101a83: 52 push %edx
80101a84: 50 push %eax
80101a85: e8 d5 3e 00 00 call 8010595f <memmove>
80101a8a: 83 c4 10 add $0x10,%esp
brelse(bp);
80101a8d: 83 ec 0c sub $0xc,%esp
80101a90: ff 75 f4 pushl -0xc(%ebp)
80101a93: e8 96 e7 ff ff call 8010022e <brelse>
80101a98: 83 c4 10 add $0x10,%esp
ip->flags |= I_VALID;
80101a9b: 8b 45 08 mov 0x8(%ebp),%eax
80101a9e: 8b 40 0c mov 0xc(%eax),%eax
80101aa1: 83 c8 02 or $0x2,%eax
80101aa4: 89 c2 mov %eax,%edx
80101aa6: 8b 45 08 mov 0x8(%ebp),%eax
80101aa9: 89 50 0c mov %edx,0xc(%eax)
if(ip->type == 0)
80101aac: 8b 45 08 mov 0x8(%ebp),%eax
80101aaf: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101ab3: 66 85 c0 test %ax,%ax
80101ab6: 75 0d jne 80101ac5 <ilock+0x15b>
panic("ilock: no type");
80101ab8: 83 ec 0c sub $0xc,%esp
80101abb: 68 b3 8c 10 80 push $0x80108cb3
80101ac0: e8 a1 ea ff ff call 80100566 <panic>
}
}
80101ac5: 90 nop
80101ac6: c9 leave
80101ac7: c3 ret
80101ac8 <iunlock>:
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
80101ac8: 55 push %ebp
80101ac9: 89 e5 mov %esp,%ebp
80101acb: 83 ec 08 sub $0x8,%esp
if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
80101ace: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80101ad2: 74 17 je 80101aeb <iunlock+0x23>
80101ad4: 8b 45 08 mov 0x8(%ebp),%eax
80101ad7: 8b 40 0c mov 0xc(%eax),%eax
80101ada: 83 e0 01 and $0x1,%eax
80101add: 85 c0 test %eax,%eax
80101adf: 74 0a je 80101aeb <iunlock+0x23>
80101ae1: 8b 45 08 mov 0x8(%ebp),%eax
80101ae4: 8b 40 08 mov 0x8(%eax),%eax
80101ae7: 85 c0 test %eax,%eax
80101ae9: 7f 0d jg 80101af8 <iunlock+0x30>
panic("iunlock");
80101aeb: 83 ec 0c sub $0xc,%esp
80101aee: 68 c2 8c 10 80 push $0x80108cc2
80101af3: e8 6e ea ff ff call 80100566 <panic>
acquire(&icache.lock);
80101af8: 83 ec 0c sub $0xc,%esp
80101afb: 68 40 22 11 80 push $0x80112240
80101b00: e8 38 3b 00 00 call 8010563d <acquire>
80101b05: 83 c4 10 add $0x10,%esp
ip->flags &= ~I_BUSY;
80101b08: 8b 45 08 mov 0x8(%ebp),%eax
80101b0b: 8b 40 0c mov 0xc(%eax),%eax
80101b0e: 83 e0 fe and $0xfffffffe,%eax
80101b11: 89 c2 mov %eax,%edx
80101b13: 8b 45 08 mov 0x8(%ebp),%eax
80101b16: 89 50 0c mov %edx,0xc(%eax)
wakeup(ip);
80101b19: 83 ec 0c sub $0xc,%esp
80101b1c: ff 75 08 pushl 0x8(%ebp)
80101b1f: e8 05 39 00 00 call 80105429 <wakeup>
80101b24: 83 c4 10 add $0x10,%esp
release(&icache.lock);
80101b27: 83 ec 0c sub $0xc,%esp
80101b2a: 68 40 22 11 80 push $0x80112240
80101b2f: e8 70 3b 00 00 call 801056a4 <release>
80101b34: 83 c4 10 add $0x10,%esp
}
80101b37: 90 nop
80101b38: c9 leave
80101b39: c3 ret
80101b3a <iput>:
// to it, free the inode (and its content) on disk.
// All calls to iput() must be inside a transaction in
// case it has to free the inode.
void
iput(struct inode *ip)
{
80101b3a: 55 push %ebp
80101b3b: 89 e5 mov %esp,%ebp
80101b3d: 83 ec 08 sub $0x8,%esp
acquire(&icache.lock);
80101b40: 83 ec 0c sub $0xc,%esp
80101b43: 68 40 22 11 80 push $0x80112240
80101b48: e8 f0 3a 00 00 call 8010563d <acquire>
80101b4d: 83 c4 10 add $0x10,%esp
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
80101b50: 8b 45 08 mov 0x8(%ebp),%eax
80101b53: 8b 40 08 mov 0x8(%eax),%eax
80101b56: 83 f8 01 cmp $0x1,%eax
80101b59: 0f 85 a9 00 00 00 jne 80101c08 <iput+0xce>
80101b5f: 8b 45 08 mov 0x8(%ebp),%eax
80101b62: 8b 40 0c mov 0xc(%eax),%eax
80101b65: 83 e0 02 and $0x2,%eax
80101b68: 85 c0 test %eax,%eax
80101b6a: 0f 84 98 00 00 00 je 80101c08 <iput+0xce>
80101b70: 8b 45 08 mov 0x8(%ebp),%eax
80101b73: 0f b7 40 16 movzwl 0x16(%eax),%eax
80101b77: 66 85 c0 test %ax,%ax
80101b7a: 0f 85 88 00 00 00 jne 80101c08 <iput+0xce>
// inode has no links and no other references: truncate and free.
if(ip->flags & I_BUSY)
80101b80: 8b 45 08 mov 0x8(%ebp),%eax
80101b83: 8b 40 0c mov 0xc(%eax),%eax
80101b86: 83 e0 01 and $0x1,%eax
80101b89: 85 c0 test %eax,%eax
80101b8b: 74 0d je 80101b9a <iput+0x60>
panic("iput busy");
80101b8d: 83 ec 0c sub $0xc,%esp
80101b90: 68 ca 8c 10 80 push $0x80108cca
80101b95: e8 cc e9 ff ff call 80100566 <panic>
ip->flags |= I_BUSY;
80101b9a: 8b 45 08 mov 0x8(%ebp),%eax
80101b9d: 8b 40 0c mov 0xc(%eax),%eax
80101ba0: 83 c8 01 or $0x1,%eax
80101ba3: 89 c2 mov %eax,%edx
80101ba5: 8b 45 08 mov 0x8(%ebp),%eax
80101ba8: 89 50 0c mov %edx,0xc(%eax)
release(&icache.lock);
80101bab: 83 ec 0c sub $0xc,%esp
80101bae: 68 40 22 11 80 push $0x80112240
80101bb3: e8 ec 3a 00 00 call 801056a4 <release>
80101bb8: 83 c4 10 add $0x10,%esp
itrunc(ip);
80101bbb: 83 ec 0c sub $0xc,%esp
80101bbe: ff 75 08 pushl 0x8(%ebp)
80101bc1: e8 a8 01 00 00 call 80101d6e <itrunc>
80101bc6: 83 c4 10 add $0x10,%esp
ip->type = 0;
80101bc9: 8b 45 08 mov 0x8(%ebp),%eax
80101bcc: 66 c7 40 10 00 00 movw $0x0,0x10(%eax)
iupdate(ip);
80101bd2: 83 ec 0c sub $0xc,%esp
80101bd5: ff 75 08 pushl 0x8(%ebp)
80101bd8: e8 b3 fb ff ff call 80101790 <iupdate>
80101bdd: 83 c4 10 add $0x10,%esp
acquire(&icache.lock);
80101be0: 83 ec 0c sub $0xc,%esp
80101be3: 68 40 22 11 80 push $0x80112240
80101be8: e8 50 3a 00 00 call 8010563d <acquire>
80101bed: 83 c4 10 add $0x10,%esp
ip->flags = 0;
80101bf0: 8b 45 08 mov 0x8(%ebp),%eax
80101bf3: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
wakeup(ip);
80101bfa: 83 ec 0c sub $0xc,%esp
80101bfd: ff 75 08 pushl 0x8(%ebp)
80101c00: e8 24 38 00 00 call 80105429 <wakeup>
80101c05: 83 c4 10 add $0x10,%esp
}
ip->ref--;
80101c08: 8b 45 08 mov 0x8(%ebp),%eax
80101c0b: 8b 40 08 mov 0x8(%eax),%eax
80101c0e: 8d 50 ff lea -0x1(%eax),%edx
80101c11: 8b 45 08 mov 0x8(%ebp),%eax
80101c14: 89 50 08 mov %edx,0x8(%eax)
release(&icache.lock);
80101c17: 83 ec 0c sub $0xc,%esp
80101c1a: 68 40 22 11 80 push $0x80112240
80101c1f: e8 80 3a 00 00 call 801056a4 <release>
80101c24: 83 c4 10 add $0x10,%esp
}
80101c27: 90 nop
80101c28: c9 leave
80101c29: c3 ret
80101c2a <iunlockput>:
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
80101c2a: 55 push %ebp
80101c2b: 89 e5 mov %esp,%ebp
80101c2d: 83 ec 08 sub $0x8,%esp
iunlock(ip);
80101c30: 83 ec 0c sub $0xc,%esp
80101c33: ff 75 08 pushl 0x8(%ebp)
80101c36: e8 8d fe ff ff call 80101ac8 <iunlock>
80101c3b: 83 c4 10 add $0x10,%esp
iput(ip);
80101c3e: 83 ec 0c sub $0xc,%esp
80101c41: ff 75 08 pushl 0x8(%ebp)
80101c44: e8 f1 fe ff ff call 80101b3a <iput>
80101c49: 83 c4 10 add $0x10,%esp
}
80101c4c: 90 nop
80101c4d: c9 leave
80101c4e: c3 ret
80101c4f <bmap>:
// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
80101c4f: 55 push %ebp
80101c50: 89 e5 mov %esp,%ebp
80101c52: 53 push %ebx
80101c53: 83 ec 14 sub $0x14,%esp
uint addr, *a;
struct buf *bp;
if(bn < NDIRECT){
80101c56: 83 7d 0c 0b cmpl $0xb,0xc(%ebp)
80101c5a: 77 42 ja 80101c9e <bmap+0x4f>
if((addr = ip->addrs[bn]) == 0)
80101c5c: 8b 45 08 mov 0x8(%ebp),%eax
80101c5f: 8b 55 0c mov 0xc(%ebp),%edx
80101c62: 83 c2 04 add $0x4,%edx
80101c65: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101c69: 89 45 f4 mov %eax,-0xc(%ebp)
80101c6c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101c70: 75 24 jne 80101c96 <bmap+0x47>
ip->addrs[bn] = addr = balloc(ip->dev);
80101c72: 8b 45 08 mov 0x8(%ebp),%eax
80101c75: 8b 00 mov (%eax),%eax
80101c77: 83 ec 0c sub $0xc,%esp
80101c7a: 50 push %eax
80101c7b: e8 9a f7 ff ff call 8010141a <balloc>
80101c80: 83 c4 10 add $0x10,%esp
80101c83: 89 45 f4 mov %eax,-0xc(%ebp)
80101c86: 8b 45 08 mov 0x8(%ebp),%eax
80101c89: 8b 55 0c mov 0xc(%ebp),%edx
80101c8c: 8d 4a 04 lea 0x4(%edx),%ecx
80101c8f: 8b 55 f4 mov -0xc(%ebp),%edx
80101c92: 89 54 88 0c mov %edx,0xc(%eax,%ecx,4)
return addr;
80101c96: 8b 45 f4 mov -0xc(%ebp),%eax
80101c99: e9 cb 00 00 00 jmp 80101d69 <bmap+0x11a>
}
bn -= NDIRECT;
80101c9e: 83 6d 0c 0c subl $0xc,0xc(%ebp)
if(bn < NINDIRECT){
80101ca2: 83 7d 0c 7f cmpl $0x7f,0xc(%ebp)
80101ca6: 0f 87 b0 00 00 00 ja 80101d5c <bmap+0x10d>
// Load indirect block, allocating if necessary.
if((addr = ip->addrs[NDIRECT]) == 0)
80101cac: 8b 45 08 mov 0x8(%ebp),%eax
80101caf: 8b 40 4c mov 0x4c(%eax),%eax
80101cb2: 89 45 f4 mov %eax,-0xc(%ebp)
80101cb5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101cb9: 75 1d jne 80101cd8 <bmap+0x89>
ip->addrs[NDIRECT] = addr = balloc(ip->dev);
80101cbb: 8b 45 08 mov 0x8(%ebp),%eax
80101cbe: 8b 00 mov (%eax),%eax
80101cc0: 83 ec 0c sub $0xc,%esp
80101cc3: 50 push %eax
80101cc4: e8 51 f7 ff ff call 8010141a <balloc>
80101cc9: 83 c4 10 add $0x10,%esp
80101ccc: 89 45 f4 mov %eax,-0xc(%ebp)
80101ccf: 8b 45 08 mov 0x8(%ebp),%eax
80101cd2: 8b 55 f4 mov -0xc(%ebp),%edx
80101cd5: 89 50 4c mov %edx,0x4c(%eax)
bp = bread(ip->dev, addr);
80101cd8: 8b 45 08 mov 0x8(%ebp),%eax
80101cdb: 8b 00 mov (%eax),%eax
80101cdd: 83 ec 08 sub $0x8,%esp
80101ce0: ff 75 f4 pushl -0xc(%ebp)
80101ce3: 50 push %eax
80101ce4: e8 cd e4 ff ff call 801001b6 <bread>
80101ce9: 83 c4 10 add $0x10,%esp
80101cec: 89 45 f0 mov %eax,-0x10(%ebp)
a = (uint*)bp->data;
80101cef: 8b 45 f0 mov -0x10(%ebp),%eax
80101cf2: 83 c0 18 add $0x18,%eax
80101cf5: 89 45 ec mov %eax,-0x14(%ebp)
if((addr = a[bn]) == 0){
80101cf8: 8b 45 0c mov 0xc(%ebp),%eax
80101cfb: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101d02: 8b 45 ec mov -0x14(%ebp),%eax
80101d05: 01 d0 add %edx,%eax
80101d07: 8b 00 mov (%eax),%eax
80101d09: 89 45 f4 mov %eax,-0xc(%ebp)
80101d0c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80101d10: 75 37 jne 80101d49 <bmap+0xfa>
a[bn] = addr = balloc(ip->dev);
80101d12: 8b 45 0c mov 0xc(%ebp),%eax
80101d15: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101d1c: 8b 45 ec mov -0x14(%ebp),%eax
80101d1f: 8d 1c 02 lea (%edx,%eax,1),%ebx
80101d22: 8b 45 08 mov 0x8(%ebp),%eax
80101d25: 8b 00 mov (%eax),%eax
80101d27: 83 ec 0c sub $0xc,%esp
80101d2a: 50 push %eax
80101d2b: e8 ea f6 ff ff call 8010141a <balloc>
80101d30: 83 c4 10 add $0x10,%esp
80101d33: 89 45 f4 mov %eax,-0xc(%ebp)
80101d36: 8b 45 f4 mov -0xc(%ebp),%eax
80101d39: 89 03 mov %eax,(%ebx)
log_write(bp);
80101d3b: 83 ec 0c sub $0xc,%esp
80101d3e: ff 75 f0 pushl -0x10(%ebp)
80101d41: e8 3f 1a 00 00 call 80103785 <log_write>
80101d46: 83 c4 10 add $0x10,%esp
}
brelse(bp);
80101d49: 83 ec 0c sub $0xc,%esp
80101d4c: ff 75 f0 pushl -0x10(%ebp)
80101d4f: e8 da e4 ff ff call 8010022e <brelse>
80101d54: 83 c4 10 add $0x10,%esp
return addr;
80101d57: 8b 45 f4 mov -0xc(%ebp),%eax
80101d5a: eb 0d jmp 80101d69 <bmap+0x11a>
}
panic("bmap: out of range");
80101d5c: 83 ec 0c sub $0xc,%esp
80101d5f: 68 d4 8c 10 80 push $0x80108cd4
80101d64: e8 fd e7 ff ff call 80100566 <panic>
}
80101d69: 8b 5d fc mov -0x4(%ebp),%ebx
80101d6c: c9 leave
80101d6d: c3 ret
80101d6e <itrunc>:
// to it (no directory entries referring to it)
// and has no in-memory reference to it (is
// not an open file or current directory).
static void
itrunc(struct inode *ip)
{
80101d6e: 55 push %ebp
80101d6f: 89 e5 mov %esp,%ebp
80101d71: 83 ec 18 sub $0x18,%esp
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101d74: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101d7b: eb 45 jmp 80101dc2 <itrunc+0x54>
if(ip->addrs[i]){
80101d7d: 8b 45 08 mov 0x8(%ebp),%eax
80101d80: 8b 55 f4 mov -0xc(%ebp),%edx
80101d83: 83 c2 04 add $0x4,%edx
80101d86: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101d8a: 85 c0 test %eax,%eax
80101d8c: 74 30 je 80101dbe <itrunc+0x50>
bfree(ip->dev, ip->addrs[i]);
80101d8e: 8b 45 08 mov 0x8(%ebp),%eax
80101d91: 8b 55 f4 mov -0xc(%ebp),%edx
80101d94: 83 c2 04 add $0x4,%edx
80101d97: 8b 44 90 0c mov 0xc(%eax,%edx,4),%eax
80101d9b: 8b 55 08 mov 0x8(%ebp),%edx
80101d9e: 8b 12 mov (%edx),%edx
80101da0: 83 ec 08 sub $0x8,%esp
80101da3: 50 push %eax
80101da4: 52 push %edx
80101da5: e8 bc f7 ff ff call 80101566 <bfree>
80101daa: 83 c4 10 add $0x10,%esp
ip->addrs[i] = 0;
80101dad: 8b 45 08 mov 0x8(%ebp),%eax
80101db0: 8b 55 f4 mov -0xc(%ebp),%edx
80101db3: 83 c2 04 add $0x4,%edx
80101db6: c7 44 90 0c 00 00 00 movl $0x0,0xc(%eax,%edx,4)
80101dbd: 00
{
int i, j;
struct buf *bp;
uint *a;
for(i = 0; i < NDIRECT; i++){
80101dbe: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80101dc2: 83 7d f4 0b cmpl $0xb,-0xc(%ebp)
80101dc6: 7e b5 jle 80101d7d <itrunc+0xf>
bfree(ip->dev, ip->addrs[i]);
ip->addrs[i] = 0;
}
}
if(ip->addrs[NDIRECT]){
80101dc8: 8b 45 08 mov 0x8(%ebp),%eax
80101dcb: 8b 40 4c mov 0x4c(%eax),%eax
80101dce: 85 c0 test %eax,%eax
80101dd0: 0f 84 a1 00 00 00 je 80101e77 <itrunc+0x109>
bp = bread(ip->dev, ip->addrs[NDIRECT]);
80101dd6: 8b 45 08 mov 0x8(%ebp),%eax
80101dd9: 8b 50 4c mov 0x4c(%eax),%edx
80101ddc: 8b 45 08 mov 0x8(%ebp),%eax
80101ddf: 8b 00 mov (%eax),%eax
80101de1: 83 ec 08 sub $0x8,%esp
80101de4: 52 push %edx
80101de5: 50 push %eax
80101de6: e8 cb e3 ff ff call 801001b6 <bread>
80101deb: 83 c4 10 add $0x10,%esp
80101dee: 89 45 ec mov %eax,-0x14(%ebp)
a = (uint*)bp->data;
80101df1: 8b 45 ec mov -0x14(%ebp),%eax
80101df4: 83 c0 18 add $0x18,%eax
80101df7: 89 45 e8 mov %eax,-0x18(%ebp)
for(j = 0; j < NINDIRECT; j++){
80101dfa: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80101e01: eb 3c jmp 80101e3f <itrunc+0xd1>
if(a[j])
80101e03: 8b 45 f0 mov -0x10(%ebp),%eax
80101e06: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101e0d: 8b 45 e8 mov -0x18(%ebp),%eax
80101e10: 01 d0 add %edx,%eax
80101e12: 8b 00 mov (%eax),%eax
80101e14: 85 c0 test %eax,%eax
80101e16: 74 23 je 80101e3b <itrunc+0xcd>
bfree(ip->dev, a[j]);
80101e18: 8b 45 f0 mov -0x10(%ebp),%eax
80101e1b: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80101e22: 8b 45 e8 mov -0x18(%ebp),%eax
80101e25: 01 d0 add %edx,%eax
80101e27: 8b 00 mov (%eax),%eax
80101e29: 8b 55 08 mov 0x8(%ebp),%edx
80101e2c: 8b 12 mov (%edx),%edx
80101e2e: 83 ec 08 sub $0x8,%esp
80101e31: 50 push %eax
80101e32: 52 push %edx
80101e33: e8 2e f7 ff ff call 80101566 <bfree>
80101e38: 83 c4 10 add $0x10,%esp
}
if(ip->addrs[NDIRECT]){
bp = bread(ip->dev, ip->addrs[NDIRECT]);
a = (uint*)bp->data;
for(j = 0; j < NINDIRECT; j++){
80101e3b: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80101e3f: 8b 45 f0 mov -0x10(%ebp),%eax
80101e42: 83 f8 7f cmp $0x7f,%eax
80101e45: 76 bc jbe 80101e03 <itrunc+0x95>
if(a[j])
bfree(ip->dev, a[j]);
}
brelse(bp);
80101e47: 83 ec 0c sub $0xc,%esp
80101e4a: ff 75 ec pushl -0x14(%ebp)
80101e4d: e8 dc e3 ff ff call 8010022e <brelse>
80101e52: 83 c4 10 add $0x10,%esp
bfree(ip->dev, ip->addrs[NDIRECT]);
80101e55: 8b 45 08 mov 0x8(%ebp),%eax
80101e58: 8b 40 4c mov 0x4c(%eax),%eax
80101e5b: 8b 55 08 mov 0x8(%ebp),%edx
80101e5e: 8b 12 mov (%edx),%edx
80101e60: 83 ec 08 sub $0x8,%esp
80101e63: 50 push %eax
80101e64: 52 push %edx
80101e65: e8 fc f6 ff ff call 80101566 <bfree>
80101e6a: 83 c4 10 add $0x10,%esp
ip->addrs[NDIRECT] = 0;
80101e6d: 8b 45 08 mov 0x8(%ebp),%eax
80101e70: c7 40 4c 00 00 00 00 movl $0x0,0x4c(%eax)
}
ip->size = 0;
80101e77: 8b 45 08 mov 0x8(%ebp),%eax
80101e7a: c7 40 18 00 00 00 00 movl $0x0,0x18(%eax)
iupdate(ip);
80101e81: 83 ec 0c sub $0xc,%esp
80101e84: ff 75 08 pushl 0x8(%ebp)
80101e87: e8 04 f9 ff ff call 80101790 <iupdate>
80101e8c: 83 c4 10 add $0x10,%esp
}
80101e8f: 90 nop
80101e90: c9 leave
80101e91: c3 ret
80101e92 <stati>:
// Copy stat information from inode.
void
stati(struct inode *ip, struct stat *st)
{
80101e92: 55 push %ebp
80101e93: 89 e5 mov %esp,%ebp
st->dev = ip->dev;
80101e95: 8b 45 08 mov 0x8(%ebp),%eax
80101e98: 8b 00 mov (%eax),%eax
80101e9a: 89 c2 mov %eax,%edx
80101e9c: 8b 45 0c mov 0xc(%ebp),%eax
80101e9f: 89 50 04 mov %edx,0x4(%eax)
st->ino = ip->inum;
80101ea2: 8b 45 08 mov 0x8(%ebp),%eax
80101ea5: 8b 50 04 mov 0x4(%eax),%edx
80101ea8: 8b 45 0c mov 0xc(%ebp),%eax
80101eab: 89 50 08 mov %edx,0x8(%eax)
st->type = ip->type;
80101eae: 8b 45 08 mov 0x8(%ebp),%eax
80101eb1: 0f b7 50 10 movzwl 0x10(%eax),%edx
80101eb5: 8b 45 0c mov 0xc(%ebp),%eax
80101eb8: 66 89 10 mov %dx,(%eax)
st->nlink = ip->nlink;
80101ebb: 8b 45 08 mov 0x8(%ebp),%eax
80101ebe: 0f b7 50 16 movzwl 0x16(%eax),%edx
80101ec2: 8b 45 0c mov 0xc(%ebp),%eax
80101ec5: 66 89 50 0c mov %dx,0xc(%eax)
st->size = ip->size;
80101ec9: 8b 45 08 mov 0x8(%ebp),%eax
80101ecc: 8b 50 18 mov 0x18(%eax),%edx
80101ecf: 8b 45 0c mov 0xc(%ebp),%eax
80101ed2: 89 50 10 mov %edx,0x10(%eax)
}
80101ed5: 90 nop
80101ed6: 5d pop %ebp
80101ed7: c3 ret
80101ed8 <readi>:
//PAGEBREAK!
// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
80101ed8: 55 push %ebp
80101ed9: 89 e5 mov %esp,%ebp
80101edb: 83 ec 18 sub $0x18,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80101ede: 8b 45 08 mov 0x8(%ebp),%eax
80101ee1: 0f b7 40 10 movzwl 0x10(%eax),%eax
80101ee5: 66 83 f8 03 cmp $0x3,%ax
80101ee9: 75 5c jne 80101f47 <readi+0x6f>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
80101eeb: 8b 45 08 mov 0x8(%ebp),%eax
80101eee: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101ef2: 66 85 c0 test %ax,%ax
80101ef5: 78 20 js 80101f17 <readi+0x3f>
80101ef7: 8b 45 08 mov 0x8(%ebp),%eax
80101efa: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101efe: 66 83 f8 09 cmp $0x9,%ax
80101f02: 7f 13 jg 80101f17 <readi+0x3f>
80101f04: 8b 45 08 mov 0x8(%ebp),%eax
80101f07: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f0b: 98 cwtl
80101f0c: 8b 04 c5 c0 21 11 80 mov -0x7feede40(,%eax,8),%eax
80101f13: 85 c0 test %eax,%eax
80101f15: 75 0a jne 80101f21 <readi+0x49>
return -1;
80101f17: b8 ff ff ff ff mov $0xffffffff,%eax
80101f1c: e9 0c 01 00 00 jmp 8010202d <readi+0x155>
return devsw[ip->major].read(ip, dst, n);
80101f21: 8b 45 08 mov 0x8(%ebp),%eax
80101f24: 0f b7 40 12 movzwl 0x12(%eax),%eax
80101f28: 98 cwtl
80101f29: 8b 04 c5 c0 21 11 80 mov -0x7feede40(,%eax,8),%eax
80101f30: 8b 55 14 mov 0x14(%ebp),%edx
80101f33: 83 ec 04 sub $0x4,%esp
80101f36: 52 push %edx
80101f37: ff 75 0c pushl 0xc(%ebp)
80101f3a: ff 75 08 pushl 0x8(%ebp)
80101f3d: ff d0 call *%eax
80101f3f: 83 c4 10 add $0x10,%esp
80101f42: e9 e6 00 00 00 jmp 8010202d <readi+0x155>
}
if(off > ip->size || off + n < off)
80101f47: 8b 45 08 mov 0x8(%ebp),%eax
80101f4a: 8b 40 18 mov 0x18(%eax),%eax
80101f4d: 3b 45 10 cmp 0x10(%ebp),%eax
80101f50: 72 0d jb 80101f5f <readi+0x87>
80101f52: 8b 55 10 mov 0x10(%ebp),%edx
80101f55: 8b 45 14 mov 0x14(%ebp),%eax
80101f58: 01 d0 add %edx,%eax
80101f5a: 3b 45 10 cmp 0x10(%ebp),%eax
80101f5d: 73 0a jae 80101f69 <readi+0x91>
return -1;
80101f5f: b8 ff ff ff ff mov $0xffffffff,%eax
80101f64: e9 c4 00 00 00 jmp 8010202d <readi+0x155>
if(off + n > ip->size)
80101f69: 8b 55 10 mov 0x10(%ebp),%edx
80101f6c: 8b 45 14 mov 0x14(%ebp),%eax
80101f6f: 01 c2 add %eax,%edx
80101f71: 8b 45 08 mov 0x8(%ebp),%eax
80101f74: 8b 40 18 mov 0x18(%eax),%eax
80101f77: 39 c2 cmp %eax,%edx
80101f79: 76 0c jbe 80101f87 <readi+0xaf>
n = ip->size - off;
80101f7b: 8b 45 08 mov 0x8(%ebp),%eax
80101f7e: 8b 40 18 mov 0x18(%eax),%eax
80101f81: 2b 45 10 sub 0x10(%ebp),%eax
80101f84: 89 45 14 mov %eax,0x14(%ebp)
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
80101f87: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80101f8e: e9 8b 00 00 00 jmp 8010201e <readi+0x146>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
80101f93: 8b 45 10 mov 0x10(%ebp),%eax
80101f96: c1 e8 09 shr $0x9,%eax
80101f99: 83 ec 08 sub $0x8,%esp
80101f9c: 50 push %eax
80101f9d: ff 75 08 pushl 0x8(%ebp)
80101fa0: e8 aa fc ff ff call 80101c4f <bmap>
80101fa5: 83 c4 10 add $0x10,%esp
80101fa8: 89 c2 mov %eax,%edx
80101faa: 8b 45 08 mov 0x8(%ebp),%eax
80101fad: 8b 00 mov (%eax),%eax
80101faf: 83 ec 08 sub $0x8,%esp
80101fb2: 52 push %edx
80101fb3: 50 push %eax
80101fb4: e8 fd e1 ff ff call 801001b6 <bread>
80101fb9: 83 c4 10 add $0x10,%esp
80101fbc: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80101fbf: 8b 45 10 mov 0x10(%ebp),%eax
80101fc2: 25 ff 01 00 00 and $0x1ff,%eax
80101fc7: ba 00 02 00 00 mov $0x200,%edx
80101fcc: 29 c2 sub %eax,%edx
80101fce: 8b 45 14 mov 0x14(%ebp),%eax
80101fd1: 2b 45 f4 sub -0xc(%ebp),%eax
80101fd4: 39 c2 cmp %eax,%edx
80101fd6: 0f 46 c2 cmovbe %edx,%eax
80101fd9: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dst, bp->data + off%BSIZE, m);
80101fdc: 8b 45 f0 mov -0x10(%ebp),%eax
80101fdf: 8d 50 18 lea 0x18(%eax),%edx
80101fe2: 8b 45 10 mov 0x10(%ebp),%eax
80101fe5: 25 ff 01 00 00 and $0x1ff,%eax
80101fea: 01 d0 add %edx,%eax
80101fec: 83 ec 04 sub $0x4,%esp
80101fef: ff 75 ec pushl -0x14(%ebp)
80101ff2: 50 push %eax
80101ff3: ff 75 0c pushl 0xc(%ebp)
80101ff6: e8 64 39 00 00 call 8010595f <memmove>
80101ffb: 83 c4 10 add $0x10,%esp
brelse(bp);
80101ffe: 83 ec 0c sub $0xc,%esp
80102001: ff 75 f0 pushl -0x10(%ebp)
80102004: e8 25 e2 ff ff call 8010022e <brelse>
80102009: 83 c4 10 add $0x10,%esp
if(off > ip->size || off + n < off)
return -1;
if(off + n > ip->size)
n = ip->size - off;
for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
8010200c: 8b 45 ec mov -0x14(%ebp),%eax
8010200f: 01 45 f4 add %eax,-0xc(%ebp)
80102012: 8b 45 ec mov -0x14(%ebp),%eax
80102015: 01 45 10 add %eax,0x10(%ebp)
80102018: 8b 45 ec mov -0x14(%ebp),%eax
8010201b: 01 45 0c add %eax,0xc(%ebp)
8010201e: 8b 45 f4 mov -0xc(%ebp),%eax
80102021: 3b 45 14 cmp 0x14(%ebp),%eax
80102024: 0f 82 69 ff ff ff jb 80101f93 <readi+0xbb>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
m = min(n - tot, BSIZE - off%BSIZE);
memmove(dst, bp->data + off%BSIZE, m);
brelse(bp);
}
return n;
8010202a: 8b 45 14 mov 0x14(%ebp),%eax
}
8010202d: c9 leave
8010202e: c3 ret
8010202f <writei>:
// PAGEBREAK!
// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
8010202f: 55 push %ebp
80102030: 89 e5 mov %esp,%ebp
80102032: 83 ec 18 sub $0x18,%esp
uint tot, m;
struct buf *bp;
if(ip->type == T_DEV){
80102035: 8b 45 08 mov 0x8(%ebp),%eax
80102038: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010203c: 66 83 f8 03 cmp $0x3,%ax
80102040: 75 5c jne 8010209e <writei+0x6f>
if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
80102042: 8b 45 08 mov 0x8(%ebp),%eax
80102045: 0f b7 40 12 movzwl 0x12(%eax),%eax
80102049: 66 85 c0 test %ax,%ax
8010204c: 78 20 js 8010206e <writei+0x3f>
8010204e: 8b 45 08 mov 0x8(%ebp),%eax
80102051: 0f b7 40 12 movzwl 0x12(%eax),%eax
80102055: 66 83 f8 09 cmp $0x9,%ax
80102059: 7f 13 jg 8010206e <writei+0x3f>
8010205b: 8b 45 08 mov 0x8(%ebp),%eax
8010205e: 0f b7 40 12 movzwl 0x12(%eax),%eax
80102062: 98 cwtl
80102063: 8b 04 c5 c4 21 11 80 mov -0x7feede3c(,%eax,8),%eax
8010206a: 85 c0 test %eax,%eax
8010206c: 75 0a jne 80102078 <writei+0x49>
return -1;
8010206e: b8 ff ff ff ff mov $0xffffffff,%eax
80102073: e9 3d 01 00 00 jmp 801021b5 <writei+0x186>
return devsw[ip->major].write(ip, src, n);
80102078: 8b 45 08 mov 0x8(%ebp),%eax
8010207b: 0f b7 40 12 movzwl 0x12(%eax),%eax
8010207f: 98 cwtl
80102080: 8b 04 c5 c4 21 11 80 mov -0x7feede3c(,%eax,8),%eax
80102087: 8b 55 14 mov 0x14(%ebp),%edx
8010208a: 83 ec 04 sub $0x4,%esp
8010208d: 52 push %edx
8010208e: ff 75 0c pushl 0xc(%ebp)
80102091: ff 75 08 pushl 0x8(%ebp)
80102094: ff d0 call *%eax
80102096: 83 c4 10 add $0x10,%esp
80102099: e9 17 01 00 00 jmp 801021b5 <writei+0x186>
}
if(off > ip->size || off + n < off)
8010209e: 8b 45 08 mov 0x8(%ebp),%eax
801020a1: 8b 40 18 mov 0x18(%eax),%eax
801020a4: 3b 45 10 cmp 0x10(%ebp),%eax
801020a7: 72 0d jb 801020b6 <writei+0x87>
801020a9: 8b 55 10 mov 0x10(%ebp),%edx
801020ac: 8b 45 14 mov 0x14(%ebp),%eax
801020af: 01 d0 add %edx,%eax
801020b1: 3b 45 10 cmp 0x10(%ebp),%eax
801020b4: 73 0a jae 801020c0 <writei+0x91>
return -1;
801020b6: b8 ff ff ff ff mov $0xffffffff,%eax
801020bb: e9 f5 00 00 00 jmp 801021b5 <writei+0x186>
if(off + n > MAXFILE*BSIZE)
801020c0: 8b 55 10 mov 0x10(%ebp),%edx
801020c3: 8b 45 14 mov 0x14(%ebp),%eax
801020c6: 01 d0 add %edx,%eax
801020c8: 3d 00 18 01 00 cmp $0x11800,%eax
801020cd: 76 0a jbe 801020d9 <writei+0xaa>
return -1;
801020cf: b8 ff ff ff ff mov $0xffffffff,%eax
801020d4: e9 dc 00 00 00 jmp 801021b5 <writei+0x186>
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
801020d9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801020e0: e9 99 00 00 00 jmp 8010217e <writei+0x14f>
bp = bread(ip->dev, bmap(ip, off/BSIZE));
801020e5: 8b 45 10 mov 0x10(%ebp),%eax
801020e8: c1 e8 09 shr $0x9,%eax
801020eb: 83 ec 08 sub $0x8,%esp
801020ee: 50 push %eax
801020ef: ff 75 08 pushl 0x8(%ebp)
801020f2: e8 58 fb ff ff call 80101c4f <bmap>
801020f7: 83 c4 10 add $0x10,%esp
801020fa: 89 c2 mov %eax,%edx
801020fc: 8b 45 08 mov 0x8(%ebp),%eax
801020ff: 8b 00 mov (%eax),%eax
80102101: 83 ec 08 sub $0x8,%esp
80102104: 52 push %edx
80102105: 50 push %eax
80102106: e8 ab e0 ff ff call 801001b6 <bread>
8010210b: 83 c4 10 add $0x10,%esp
8010210e: 89 45 f0 mov %eax,-0x10(%ebp)
m = min(n - tot, BSIZE - off%BSIZE);
80102111: 8b 45 10 mov 0x10(%ebp),%eax
80102114: 25 ff 01 00 00 and $0x1ff,%eax
80102119: ba 00 02 00 00 mov $0x200,%edx
8010211e: 29 c2 sub %eax,%edx
80102120: 8b 45 14 mov 0x14(%ebp),%eax
80102123: 2b 45 f4 sub -0xc(%ebp),%eax
80102126: 39 c2 cmp %eax,%edx
80102128: 0f 46 c2 cmovbe %edx,%eax
8010212b: 89 45 ec mov %eax,-0x14(%ebp)
memmove(bp->data + off%BSIZE, src, m);
8010212e: 8b 45 f0 mov -0x10(%ebp),%eax
80102131: 8d 50 18 lea 0x18(%eax),%edx
80102134: 8b 45 10 mov 0x10(%ebp),%eax
80102137: 25 ff 01 00 00 and $0x1ff,%eax
8010213c: 01 d0 add %edx,%eax
8010213e: 83 ec 04 sub $0x4,%esp
80102141: ff 75 ec pushl -0x14(%ebp)
80102144: ff 75 0c pushl 0xc(%ebp)
80102147: 50 push %eax
80102148: e8 12 38 00 00 call 8010595f <memmove>
8010214d: 83 c4 10 add $0x10,%esp
log_write(bp);
80102150: 83 ec 0c sub $0xc,%esp
80102153: ff 75 f0 pushl -0x10(%ebp)
80102156: e8 2a 16 00 00 call 80103785 <log_write>
8010215b: 83 c4 10 add $0x10,%esp
brelse(bp);
8010215e: 83 ec 0c sub $0xc,%esp
80102161: ff 75 f0 pushl -0x10(%ebp)
80102164: e8 c5 e0 ff ff call 8010022e <brelse>
80102169: 83 c4 10 add $0x10,%esp
if(off > ip->size || off + n < off)
return -1;
if(off + n > MAXFILE*BSIZE)
return -1;
for(tot=0; tot<n; tot+=m, off+=m, src+=m){
8010216c: 8b 45 ec mov -0x14(%ebp),%eax
8010216f: 01 45 f4 add %eax,-0xc(%ebp)
80102172: 8b 45 ec mov -0x14(%ebp),%eax
80102175: 01 45 10 add %eax,0x10(%ebp)
80102178: 8b 45 ec mov -0x14(%ebp),%eax
8010217b: 01 45 0c add %eax,0xc(%ebp)
8010217e: 8b 45 f4 mov -0xc(%ebp),%eax
80102181: 3b 45 14 cmp 0x14(%ebp),%eax
80102184: 0f 82 5b ff ff ff jb 801020e5 <writei+0xb6>
memmove(bp->data + off%BSIZE, src, m);
log_write(bp);
brelse(bp);
}
if(n > 0 && off > ip->size){
8010218a: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
8010218e: 74 22 je 801021b2 <writei+0x183>
80102190: 8b 45 08 mov 0x8(%ebp),%eax
80102193: 8b 40 18 mov 0x18(%eax),%eax
80102196: 3b 45 10 cmp 0x10(%ebp),%eax
80102199: 73 17 jae 801021b2 <writei+0x183>
ip->size = off;
8010219b: 8b 45 08 mov 0x8(%ebp),%eax
8010219e: 8b 55 10 mov 0x10(%ebp),%edx
801021a1: 89 50 18 mov %edx,0x18(%eax)
iupdate(ip);
801021a4: 83 ec 0c sub $0xc,%esp
801021a7: ff 75 08 pushl 0x8(%ebp)
801021aa: e8 e1 f5 ff ff call 80101790 <iupdate>
801021af: 83 c4 10 add $0x10,%esp
}
return n;
801021b2: 8b 45 14 mov 0x14(%ebp),%eax
}
801021b5: c9 leave
801021b6: c3 ret
801021b7 <namecmp>:
//PAGEBREAK!
// Directories
int
namecmp(const char *s, const char *t)
{
801021b7: 55 push %ebp
801021b8: 89 e5 mov %esp,%ebp
801021ba: 83 ec 08 sub $0x8,%esp
return strncmp(s, t, DIRSIZ);
801021bd: 83 ec 04 sub $0x4,%esp
801021c0: 6a 0e push $0xe
801021c2: ff 75 0c pushl 0xc(%ebp)
801021c5: ff 75 08 pushl 0x8(%ebp)
801021c8: e8 28 38 00 00 call 801059f5 <strncmp>
801021cd: 83 c4 10 add $0x10,%esp
}
801021d0: c9 leave
801021d1: c3 ret
801021d2 <dirlookup>:
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
801021d2: 55 push %ebp
801021d3: 89 e5 mov %esp,%ebp
801021d5: 83 ec 28 sub $0x28,%esp
uint off, inum;
struct dirent de;
if(dp->type != T_DIR)
801021d8: 8b 45 08 mov 0x8(%ebp),%eax
801021db: 0f b7 40 10 movzwl 0x10(%eax),%eax
801021df: 66 83 f8 01 cmp $0x1,%ax
801021e3: 74 0d je 801021f2 <dirlookup+0x20>
panic("dirlookup not DIR");
801021e5: 83 ec 0c sub $0xc,%esp
801021e8: 68 e7 8c 10 80 push $0x80108ce7
801021ed: e8 74 e3 ff ff call 80100566 <panic>
for(off = 0; off < dp->size; off += sizeof(de)){
801021f2: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801021f9: eb 7b jmp 80102276 <dirlookup+0xa4>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801021fb: 6a 10 push $0x10
801021fd: ff 75 f4 pushl -0xc(%ebp)
80102200: 8d 45 e0 lea -0x20(%ebp),%eax
80102203: 50 push %eax
80102204: ff 75 08 pushl 0x8(%ebp)
80102207: e8 cc fc ff ff call 80101ed8 <readi>
8010220c: 83 c4 10 add $0x10,%esp
8010220f: 83 f8 10 cmp $0x10,%eax
80102212: 74 0d je 80102221 <dirlookup+0x4f>
panic("dirlink read");
80102214: 83 ec 0c sub $0xc,%esp
80102217: 68 f9 8c 10 80 push $0x80108cf9
8010221c: e8 45 e3 ff ff call 80100566 <panic>
if(de.inum == 0)
80102221: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
80102225: 66 85 c0 test %ax,%ax
80102228: 74 47 je 80102271 <dirlookup+0x9f>
continue;
if(namecmp(name, de.name) == 0){
8010222a: 83 ec 08 sub $0x8,%esp
8010222d: 8d 45 e0 lea -0x20(%ebp),%eax
80102230: 83 c0 02 add $0x2,%eax
80102233: 50 push %eax
80102234: ff 75 0c pushl 0xc(%ebp)
80102237: e8 7b ff ff ff call 801021b7 <namecmp>
8010223c: 83 c4 10 add $0x10,%esp
8010223f: 85 c0 test %eax,%eax
80102241: 75 2f jne 80102272 <dirlookup+0xa0>
// entry matches path element
if(poff)
80102243: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80102247: 74 08 je 80102251 <dirlookup+0x7f>
*poff = off;
80102249: 8b 45 10 mov 0x10(%ebp),%eax
8010224c: 8b 55 f4 mov -0xc(%ebp),%edx
8010224f: 89 10 mov %edx,(%eax)
inum = de.inum;
80102251: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
80102255: 0f b7 c0 movzwl %ax,%eax
80102258: 89 45 f0 mov %eax,-0x10(%ebp)
return iget(dp->dev, inum);
8010225b: 8b 45 08 mov 0x8(%ebp),%eax
8010225e: 8b 00 mov (%eax),%eax
80102260: 83 ec 08 sub $0x8,%esp
80102263: ff 75 f0 pushl -0x10(%ebp)
80102266: 50 push %eax
80102267: e8 e5 f5 ff ff call 80101851 <iget>
8010226c: 83 c4 10 add $0x10,%esp
8010226f: eb 19 jmp 8010228a <dirlookup+0xb8>
for(off = 0; off < dp->size; off += sizeof(de)){
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
if(de.inum == 0)
continue;
80102271: 90 nop
struct dirent de;
if(dp->type != T_DIR)
panic("dirlookup not DIR");
for(off = 0; off < dp->size; off += sizeof(de)){
80102272: 83 45 f4 10 addl $0x10,-0xc(%ebp)
80102276: 8b 45 08 mov 0x8(%ebp),%eax
80102279: 8b 40 18 mov 0x18(%eax),%eax
8010227c: 3b 45 f4 cmp -0xc(%ebp),%eax
8010227f: 0f 87 76 ff ff ff ja 801021fb <dirlookup+0x29>
inum = de.inum;
return iget(dp->dev, inum);
}
}
return 0;
80102285: b8 00 00 00 00 mov $0x0,%eax
}
8010228a: c9 leave
8010228b: c3 ret
8010228c <dirlink>:
// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
8010228c: 55 push %ebp
8010228d: 89 e5 mov %esp,%ebp
8010228f: 83 ec 28 sub $0x28,%esp
int off;
struct dirent de;
struct inode *ip;
// Check that name is not present.
if((ip = dirlookup(dp, name, 0)) != 0){
80102292: 83 ec 04 sub $0x4,%esp
80102295: 6a 00 push $0x0
80102297: ff 75 0c pushl 0xc(%ebp)
8010229a: ff 75 08 pushl 0x8(%ebp)
8010229d: e8 30 ff ff ff call 801021d2 <dirlookup>
801022a2: 83 c4 10 add $0x10,%esp
801022a5: 89 45 f0 mov %eax,-0x10(%ebp)
801022a8: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801022ac: 74 18 je 801022c6 <dirlink+0x3a>
iput(ip);
801022ae: 83 ec 0c sub $0xc,%esp
801022b1: ff 75 f0 pushl -0x10(%ebp)
801022b4: e8 81 f8 ff ff call 80101b3a <iput>
801022b9: 83 c4 10 add $0x10,%esp
return -1;
801022bc: b8 ff ff ff ff mov $0xffffffff,%eax
801022c1: e9 9c 00 00 00 jmp 80102362 <dirlink+0xd6>
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
801022c6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801022cd: eb 39 jmp 80102308 <dirlink+0x7c>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801022cf: 8b 45 f4 mov -0xc(%ebp),%eax
801022d2: 6a 10 push $0x10
801022d4: 50 push %eax
801022d5: 8d 45 e0 lea -0x20(%ebp),%eax
801022d8: 50 push %eax
801022d9: ff 75 08 pushl 0x8(%ebp)
801022dc: e8 f7 fb ff ff call 80101ed8 <readi>
801022e1: 83 c4 10 add $0x10,%esp
801022e4: 83 f8 10 cmp $0x10,%eax
801022e7: 74 0d je 801022f6 <dirlink+0x6a>
panic("dirlink read");
801022e9: 83 ec 0c sub $0xc,%esp
801022ec: 68 f9 8c 10 80 push $0x80108cf9
801022f1: e8 70 e2 ff ff call 80100566 <panic>
if(de.inum == 0)
801022f6: 0f b7 45 e0 movzwl -0x20(%ebp),%eax
801022fa: 66 85 c0 test %ax,%ax
801022fd: 74 18 je 80102317 <dirlink+0x8b>
iput(ip);
return -1;
}
// Look for an empty dirent.
for(off = 0; off < dp->size; off += sizeof(de)){
801022ff: 8b 45 f4 mov -0xc(%ebp),%eax
80102302: 83 c0 10 add $0x10,%eax
80102305: 89 45 f4 mov %eax,-0xc(%ebp)
80102308: 8b 45 08 mov 0x8(%ebp),%eax
8010230b: 8b 50 18 mov 0x18(%eax),%edx
8010230e: 8b 45 f4 mov -0xc(%ebp),%eax
80102311: 39 c2 cmp %eax,%edx
80102313: 77 ba ja 801022cf <dirlink+0x43>
80102315: eb 01 jmp 80102318 <dirlink+0x8c>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("dirlink read");
if(de.inum == 0)
break;
80102317: 90 nop
}
strncpy(de.name, name, DIRSIZ);
80102318: 83 ec 04 sub $0x4,%esp
8010231b: 6a 0e push $0xe
8010231d: ff 75 0c pushl 0xc(%ebp)
80102320: 8d 45 e0 lea -0x20(%ebp),%eax
80102323: 83 c0 02 add $0x2,%eax
80102326: 50 push %eax
80102327: e8 1f 37 00 00 call 80105a4b <strncpy>
8010232c: 83 c4 10 add $0x10,%esp
de.inum = inum;
8010232f: 8b 45 10 mov 0x10(%ebp),%eax
80102332: 66 89 45 e0 mov %ax,-0x20(%ebp)
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80102336: 8b 45 f4 mov -0xc(%ebp),%eax
80102339: 6a 10 push $0x10
8010233b: 50 push %eax
8010233c: 8d 45 e0 lea -0x20(%ebp),%eax
8010233f: 50 push %eax
80102340: ff 75 08 pushl 0x8(%ebp)
80102343: e8 e7 fc ff ff call 8010202f <writei>
80102348: 83 c4 10 add $0x10,%esp
8010234b: 83 f8 10 cmp $0x10,%eax
8010234e: 74 0d je 8010235d <dirlink+0xd1>
panic("dirlink");
80102350: 83 ec 0c sub $0xc,%esp
80102353: 68 06 8d 10 80 push $0x80108d06
80102358: e8 09 e2 ff ff call 80100566 <panic>
return 0;
8010235d: b8 00 00 00 00 mov $0x0,%eax
}
80102362: c9 leave
80102363: c3 ret
80102364 <skipelem>:
// skipelem("a", name) = "", setting name = "a"
// skipelem("", name) = skipelem("////", name) = 0
//
static char*
skipelem(char *path, char *name)
{
80102364: 55 push %ebp
80102365: 89 e5 mov %esp,%ebp
80102367: 83 ec 18 sub $0x18,%esp
char *s;
int len;
while(*path == '/')
8010236a: eb 04 jmp 80102370 <skipelem+0xc>
path++;
8010236c: 83 45 08 01 addl $0x1,0x8(%ebp)
skipelem(char *path, char *name)
{
char *s;
int len;
while(*path == '/')
80102370: 8b 45 08 mov 0x8(%ebp),%eax
80102373: 0f b6 00 movzbl (%eax),%eax
80102376: 3c 2f cmp $0x2f,%al
80102378: 74 f2 je 8010236c <skipelem+0x8>
path++;
if(*path == 0)
8010237a: 8b 45 08 mov 0x8(%ebp),%eax
8010237d: 0f b6 00 movzbl (%eax),%eax
80102380: 84 c0 test %al,%al
80102382: 75 07 jne 8010238b <skipelem+0x27>
return 0;
80102384: b8 00 00 00 00 mov $0x0,%eax
80102389: eb 7b jmp 80102406 <skipelem+0xa2>
s = path;
8010238b: 8b 45 08 mov 0x8(%ebp),%eax
8010238e: 89 45 f4 mov %eax,-0xc(%ebp)
while(*path != '/' && *path != 0)
80102391: eb 04 jmp 80102397 <skipelem+0x33>
path++;
80102393: 83 45 08 01 addl $0x1,0x8(%ebp)
while(*path == '/')
path++;
if(*path == 0)
return 0;
s = path;
while(*path != '/' && *path != 0)
80102397: 8b 45 08 mov 0x8(%ebp),%eax
8010239a: 0f b6 00 movzbl (%eax),%eax
8010239d: 3c 2f cmp $0x2f,%al
8010239f: 74 0a je 801023ab <skipelem+0x47>
801023a1: 8b 45 08 mov 0x8(%ebp),%eax
801023a4: 0f b6 00 movzbl (%eax),%eax
801023a7: 84 c0 test %al,%al
801023a9: 75 e8 jne 80102393 <skipelem+0x2f>
path++;
len = path - s;
801023ab: 8b 55 08 mov 0x8(%ebp),%edx
801023ae: 8b 45 f4 mov -0xc(%ebp),%eax
801023b1: 29 c2 sub %eax,%edx
801023b3: 89 d0 mov %edx,%eax
801023b5: 89 45 f0 mov %eax,-0x10(%ebp)
if(len >= DIRSIZ)
801023b8: 83 7d f0 0d cmpl $0xd,-0x10(%ebp)
801023bc: 7e 15 jle 801023d3 <skipelem+0x6f>
memmove(name, s, DIRSIZ);
801023be: 83 ec 04 sub $0x4,%esp
801023c1: 6a 0e push $0xe
801023c3: ff 75 f4 pushl -0xc(%ebp)
801023c6: ff 75 0c pushl 0xc(%ebp)
801023c9: e8 91 35 00 00 call 8010595f <memmove>
801023ce: 83 c4 10 add $0x10,%esp
801023d1: eb 26 jmp 801023f9 <skipelem+0x95>
else {
memmove(name, s, len);
801023d3: 8b 45 f0 mov -0x10(%ebp),%eax
801023d6: 83 ec 04 sub $0x4,%esp
801023d9: 50 push %eax
801023da: ff 75 f4 pushl -0xc(%ebp)
801023dd: ff 75 0c pushl 0xc(%ebp)
801023e0: e8 7a 35 00 00 call 8010595f <memmove>
801023e5: 83 c4 10 add $0x10,%esp
name[len] = 0;
801023e8: 8b 55 f0 mov -0x10(%ebp),%edx
801023eb: 8b 45 0c mov 0xc(%ebp),%eax
801023ee: 01 d0 add %edx,%eax
801023f0: c6 00 00 movb $0x0,(%eax)
}
while(*path == '/')
801023f3: eb 04 jmp 801023f9 <skipelem+0x95>
path++;
801023f5: 83 45 08 01 addl $0x1,0x8(%ebp)
memmove(name, s, DIRSIZ);
else {
memmove(name, s, len);
name[len] = 0;
}
while(*path == '/')
801023f9: 8b 45 08 mov 0x8(%ebp),%eax
801023fc: 0f b6 00 movzbl (%eax),%eax
801023ff: 3c 2f cmp $0x2f,%al
80102401: 74 f2 je 801023f5 <skipelem+0x91>
path++;
return path;
80102403: 8b 45 08 mov 0x8(%ebp),%eax
}
80102406: c9 leave
80102407: c3 ret
80102408 <namex>:
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
// Must be called inside a transaction since it calls iput().
static struct inode*
namex(char *path, int nameiparent, char *name)
{
80102408: 55 push %ebp
80102409: 89 e5 mov %esp,%ebp
8010240b: 83 ec 18 sub $0x18,%esp
struct inode *ip, *next;
if(*path == '/')
8010240e: 8b 45 08 mov 0x8(%ebp),%eax
80102411: 0f b6 00 movzbl (%eax),%eax
80102414: 3c 2f cmp $0x2f,%al
80102416: 75 17 jne 8010242f <namex+0x27>
ip = iget(ROOTDEV, ROOTINO);
80102418: 83 ec 08 sub $0x8,%esp
8010241b: 6a 01 push $0x1
8010241d: 6a 01 push $0x1
8010241f: e8 2d f4 ff ff call 80101851 <iget>
80102424: 83 c4 10 add $0x10,%esp
80102427: 89 45 f4 mov %eax,-0xc(%ebp)
8010242a: e9 bb 00 00 00 jmp 801024ea <namex+0xe2>
else
ip = idup(proc->cwd);
8010242f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80102435: 8b 40 68 mov 0x68(%eax),%eax
80102438: 83 ec 0c sub $0xc,%esp
8010243b: 50 push %eax
8010243c: e8 ef f4 ff ff call 80101930 <idup>
80102441: 83 c4 10 add $0x10,%esp
80102444: 89 45 f4 mov %eax,-0xc(%ebp)
while((path = skipelem(path, name)) != 0){
80102447: e9 9e 00 00 00 jmp 801024ea <namex+0xe2>
ilock(ip);
8010244c: 83 ec 0c sub $0xc,%esp
8010244f: ff 75 f4 pushl -0xc(%ebp)
80102452: e8 13 f5 ff ff call 8010196a <ilock>
80102457: 83 c4 10 add $0x10,%esp
if(ip->type != T_DIR){
8010245a: 8b 45 f4 mov -0xc(%ebp),%eax
8010245d: 0f b7 40 10 movzwl 0x10(%eax),%eax
80102461: 66 83 f8 01 cmp $0x1,%ax
80102465: 74 18 je 8010247f <namex+0x77>
iunlockput(ip);
80102467: 83 ec 0c sub $0xc,%esp
8010246a: ff 75 f4 pushl -0xc(%ebp)
8010246d: e8 b8 f7 ff ff call 80101c2a <iunlockput>
80102472: 83 c4 10 add $0x10,%esp
return 0;
80102475: b8 00 00 00 00 mov $0x0,%eax
8010247a: e9 a7 00 00 00 jmp 80102526 <namex+0x11e>
}
if(nameiparent && *path == '\0'){
8010247f: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80102483: 74 20 je 801024a5 <namex+0x9d>
80102485: 8b 45 08 mov 0x8(%ebp),%eax
80102488: 0f b6 00 movzbl (%eax),%eax
8010248b: 84 c0 test %al,%al
8010248d: 75 16 jne 801024a5 <namex+0x9d>
// Stop one level early.
iunlock(ip);
8010248f: 83 ec 0c sub $0xc,%esp
80102492: ff 75 f4 pushl -0xc(%ebp)
80102495: e8 2e f6 ff ff call 80101ac8 <iunlock>
8010249a: 83 c4 10 add $0x10,%esp
return ip;
8010249d: 8b 45 f4 mov -0xc(%ebp),%eax
801024a0: e9 81 00 00 00 jmp 80102526 <namex+0x11e>
}
if((next = dirlookup(ip, name, 0)) == 0){
801024a5: 83 ec 04 sub $0x4,%esp
801024a8: 6a 00 push $0x0
801024aa: ff 75 10 pushl 0x10(%ebp)
801024ad: ff 75 f4 pushl -0xc(%ebp)
801024b0: e8 1d fd ff ff call 801021d2 <dirlookup>
801024b5: 83 c4 10 add $0x10,%esp
801024b8: 89 45 f0 mov %eax,-0x10(%ebp)
801024bb: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801024bf: 75 15 jne 801024d6 <namex+0xce>
iunlockput(ip);
801024c1: 83 ec 0c sub $0xc,%esp
801024c4: ff 75 f4 pushl -0xc(%ebp)
801024c7: e8 5e f7 ff ff call 80101c2a <iunlockput>
801024cc: 83 c4 10 add $0x10,%esp
return 0;
801024cf: b8 00 00 00 00 mov $0x0,%eax
801024d4: eb 50 jmp 80102526 <namex+0x11e>
}
iunlockput(ip);
801024d6: 83 ec 0c sub $0xc,%esp
801024d9: ff 75 f4 pushl -0xc(%ebp)
801024dc: e8 49 f7 ff ff call 80101c2a <iunlockput>
801024e1: 83 c4 10 add $0x10,%esp
ip = next;
801024e4: 8b 45 f0 mov -0x10(%ebp),%eax
801024e7: 89 45 f4 mov %eax,-0xc(%ebp)
if(*path == '/')
ip = iget(ROOTDEV, ROOTINO);
else
ip = idup(proc->cwd);
while((path = skipelem(path, name)) != 0){
801024ea: 83 ec 08 sub $0x8,%esp
801024ed: ff 75 10 pushl 0x10(%ebp)
801024f0: ff 75 08 pushl 0x8(%ebp)
801024f3: e8 6c fe ff ff call 80102364 <skipelem>
801024f8: 83 c4 10 add $0x10,%esp
801024fb: 89 45 08 mov %eax,0x8(%ebp)
801024fe: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80102502: 0f 85 44 ff ff ff jne 8010244c <namex+0x44>
return 0;
}
iunlockput(ip);
ip = next;
}
if(nameiparent){
80102508: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
8010250c: 74 15 je 80102523 <namex+0x11b>
iput(ip);
8010250e: 83 ec 0c sub $0xc,%esp
80102511: ff 75 f4 pushl -0xc(%ebp)
80102514: e8 21 f6 ff ff call 80101b3a <iput>
80102519: 83 c4 10 add $0x10,%esp
return 0;
8010251c: b8 00 00 00 00 mov $0x0,%eax
80102521: eb 03 jmp 80102526 <namex+0x11e>
}
return ip;
80102523: 8b 45 f4 mov -0xc(%ebp),%eax
}
80102526: c9 leave
80102527: c3 ret
80102528 <namei>:
struct inode*
namei(char *path)
{
80102528: 55 push %ebp
80102529: 89 e5 mov %esp,%ebp
8010252b: 83 ec 18 sub $0x18,%esp
char name[DIRSIZ];
return namex(path, 0, name);
8010252e: 83 ec 04 sub $0x4,%esp
80102531: 8d 45 ea lea -0x16(%ebp),%eax
80102534: 50 push %eax
80102535: 6a 00 push $0x0
80102537: ff 75 08 pushl 0x8(%ebp)
8010253a: e8 c9 fe ff ff call 80102408 <namex>
8010253f: 83 c4 10 add $0x10,%esp
}
80102542: c9 leave
80102543: c3 ret
80102544 <nameiparent>:
struct inode*
nameiparent(char *path, char *name)
{
80102544: 55 push %ebp
80102545: 89 e5 mov %esp,%ebp
80102547: 83 ec 08 sub $0x8,%esp
return namex(path, 1, name);
8010254a: 83 ec 04 sub $0x4,%esp
8010254d: ff 75 0c pushl 0xc(%ebp)
80102550: 6a 01 push $0x1
80102552: ff 75 08 pushl 0x8(%ebp)
80102555: e8 ae fe ff ff call 80102408 <namex>
8010255a: 83 c4 10 add $0x10,%esp
}
8010255d: c9 leave
8010255e: c3 ret
8010255f <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
8010255f: 55 push %ebp
80102560: 89 e5 mov %esp,%ebp
80102562: 83 ec 14 sub $0x14,%esp
80102565: 8b 45 08 mov 0x8(%ebp),%eax
80102568: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
8010256c: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102570: 89 c2 mov %eax,%edx
80102572: ec in (%dx),%al
80102573: 88 45 ff mov %al,-0x1(%ebp)
return data;
80102576: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
8010257a: c9 leave
8010257b: c3 ret
8010257c <insl>:
static inline void
insl(int port, void *addr, int cnt)
{
8010257c: 55 push %ebp
8010257d: 89 e5 mov %esp,%ebp
8010257f: 57 push %edi
80102580: 53 push %ebx
asm volatile("cld; rep insl" :
80102581: 8b 55 08 mov 0x8(%ebp),%edx
80102584: 8b 4d 0c mov 0xc(%ebp),%ecx
80102587: 8b 45 10 mov 0x10(%ebp),%eax
8010258a: 89 cb mov %ecx,%ebx
8010258c: 89 df mov %ebx,%edi
8010258e: 89 c1 mov %eax,%ecx
80102590: fc cld
80102591: f3 6d rep insl (%dx),%es:(%edi)
80102593: 89 c8 mov %ecx,%eax
80102595: 89 fb mov %edi,%ebx
80102597: 89 5d 0c mov %ebx,0xc(%ebp)
8010259a: 89 45 10 mov %eax,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"memory", "cc");
}
8010259d: 90 nop
8010259e: 5b pop %ebx
8010259f: 5f pop %edi
801025a0: 5d pop %ebp
801025a1: c3 ret
801025a2 <outb>:
static inline void
outb(ushort port, uchar data)
{
801025a2: 55 push %ebp
801025a3: 89 e5 mov %esp,%ebp
801025a5: 83 ec 08 sub $0x8,%esp
801025a8: 8b 55 08 mov 0x8(%ebp),%edx
801025ab: 8b 45 0c mov 0xc(%ebp),%eax
801025ae: 66 89 55 fc mov %dx,-0x4(%ebp)
801025b2: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801025b5: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801025b9: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801025bd: ee out %al,(%dx)
}
801025be: 90 nop
801025bf: c9 leave
801025c0: c3 ret
801025c1 <outsl>:
asm volatile("out %0,%1" : : "a" (data), "d" (port));
}
static inline void
outsl(int port, const void *addr, int cnt)
{
801025c1: 55 push %ebp
801025c2: 89 e5 mov %esp,%ebp
801025c4: 56 push %esi
801025c5: 53 push %ebx
asm volatile("cld; rep outsl" :
801025c6: 8b 55 08 mov 0x8(%ebp),%edx
801025c9: 8b 4d 0c mov 0xc(%ebp),%ecx
801025cc: 8b 45 10 mov 0x10(%ebp),%eax
801025cf: 89 cb mov %ecx,%ebx
801025d1: 89 de mov %ebx,%esi
801025d3: 89 c1 mov %eax,%ecx
801025d5: fc cld
801025d6: f3 6f rep outsl %ds:(%esi),(%dx)
801025d8: 89 c8 mov %ecx,%eax
801025da: 89 f3 mov %esi,%ebx
801025dc: 89 5d 0c mov %ebx,0xc(%ebp)
801025df: 89 45 10 mov %eax,0x10(%ebp)
"=S" (addr), "=c" (cnt) :
"d" (port), "0" (addr), "1" (cnt) :
"cc");
}
801025e2: 90 nop
801025e3: 5b pop %ebx
801025e4: 5e pop %esi
801025e5: 5d pop %ebp
801025e6: c3 ret
801025e7 <idewait>:
static void idestart(struct buf*);
// Wait for IDE disk to become ready.
static int
idewait(int checkerr)
{
801025e7: 55 push %ebp
801025e8: 89 e5 mov %esp,%ebp
801025ea: 83 ec 10 sub $0x10,%esp
int r;
while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY)
801025ed: 90 nop
801025ee: 68 f7 01 00 00 push $0x1f7
801025f3: e8 67 ff ff ff call 8010255f <inb>
801025f8: 83 c4 04 add $0x4,%esp
801025fb: 0f b6 c0 movzbl %al,%eax
801025fe: 89 45 fc mov %eax,-0x4(%ebp)
80102601: 8b 45 fc mov -0x4(%ebp),%eax
80102604: 25 c0 00 00 00 and $0xc0,%eax
80102609: 83 f8 40 cmp $0x40,%eax
8010260c: 75 e0 jne 801025ee <idewait+0x7>
;
if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
8010260e: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80102612: 74 11 je 80102625 <idewait+0x3e>
80102614: 8b 45 fc mov -0x4(%ebp),%eax
80102617: 83 e0 21 and $0x21,%eax
8010261a: 85 c0 test %eax,%eax
8010261c: 74 07 je 80102625 <idewait+0x3e>
return -1;
8010261e: b8 ff ff ff ff mov $0xffffffff,%eax
80102623: eb 05 jmp 8010262a <idewait+0x43>
return 0;
80102625: b8 00 00 00 00 mov $0x0,%eax
}
8010262a: c9 leave
8010262b: c3 ret
8010262c <ideinit>:
void
ideinit(void)
{
8010262c: 55 push %ebp
8010262d: 89 e5 mov %esp,%ebp
8010262f: 83 ec 18 sub $0x18,%esp
int i;
initlock(&idelock, "ide");
80102632: 83 ec 08 sub $0x8,%esp
80102635: 68 0e 8d 10 80 push $0x80108d0e
8010263a: 68 00 c6 10 80 push $0x8010c600
8010263f: e8 d7 2f 00 00 call 8010561b <initlock>
80102644: 83 c4 10 add $0x10,%esp
picenable(IRQ_IDE);
80102647: 83 ec 0c sub $0xc,%esp
8010264a: 6a 0e push $0xe
8010264c: e8 da 18 00 00 call 80103f2b <picenable>
80102651: 83 c4 10 add $0x10,%esp
ioapicenable(IRQ_IDE, ncpu - 1);
80102654: a1 40 39 11 80 mov 0x80113940,%eax
80102659: 83 e8 01 sub $0x1,%eax
8010265c: 83 ec 08 sub $0x8,%esp
8010265f: 50 push %eax
80102660: 6a 0e push $0xe
80102662: e8 73 04 00 00 call 80102ada <ioapicenable>
80102667: 83 c4 10 add $0x10,%esp
idewait(0);
8010266a: 83 ec 0c sub $0xc,%esp
8010266d: 6a 00 push $0x0
8010266f: e8 73 ff ff ff call 801025e7 <idewait>
80102674: 83 c4 10 add $0x10,%esp
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
80102677: 83 ec 08 sub $0x8,%esp
8010267a: 68 f0 00 00 00 push $0xf0
8010267f: 68 f6 01 00 00 push $0x1f6
80102684: e8 19 ff ff ff call 801025a2 <outb>
80102689: 83 c4 10 add $0x10,%esp
for(i=0; i<1000; i++){
8010268c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80102693: eb 24 jmp 801026b9 <ideinit+0x8d>
if(inb(0x1f7) != 0){
80102695: 83 ec 0c sub $0xc,%esp
80102698: 68 f7 01 00 00 push $0x1f7
8010269d: e8 bd fe ff ff call 8010255f <inb>
801026a2: 83 c4 10 add $0x10,%esp
801026a5: 84 c0 test %al,%al
801026a7: 74 0c je 801026b5 <ideinit+0x89>
havedisk1 = 1;
801026a9: c7 05 38 c6 10 80 01 movl $0x1,0x8010c638
801026b0: 00 00 00
break;
801026b3: eb 0d jmp 801026c2 <ideinit+0x96>
ioapicenable(IRQ_IDE, ncpu - 1);
idewait(0);
// Check if disk 1 is present
outb(0x1f6, 0xe0 | (1<<4));
for(i=0; i<1000; i++){
801026b5: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801026b9: 81 7d f4 e7 03 00 00 cmpl $0x3e7,-0xc(%ebp)
801026c0: 7e d3 jle 80102695 <ideinit+0x69>
break;
}
}
// Switch back to disk 0.
outb(0x1f6, 0xe0 | (0<<4));
801026c2: 83 ec 08 sub $0x8,%esp
801026c5: 68 e0 00 00 00 push $0xe0
801026ca: 68 f6 01 00 00 push $0x1f6
801026cf: e8 ce fe ff ff call 801025a2 <outb>
801026d4: 83 c4 10 add $0x10,%esp
}
801026d7: 90 nop
801026d8: c9 leave
801026d9: c3 ret
801026da <idestart>:
// Start the request for b. Caller must hold idelock.
static void
idestart(struct buf *b)
{
801026da: 55 push %ebp
801026db: 89 e5 mov %esp,%ebp
801026dd: 83 ec 18 sub $0x18,%esp
if(b == 0)
801026e0: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801026e4: 75 0d jne 801026f3 <idestart+0x19>
panic("idestart");
801026e6: 83 ec 0c sub $0xc,%esp
801026e9: 68 12 8d 10 80 push $0x80108d12
801026ee: e8 73 de ff ff call 80100566 <panic>
if(b->blockno >= FSSIZE)
801026f3: 8b 45 08 mov 0x8(%ebp),%eax
801026f6: 8b 40 08 mov 0x8(%eax),%eax
801026f9: 3d e7 03 00 00 cmp $0x3e7,%eax
801026fe: 76 0d jbe 8010270d <idestart+0x33>
panic("incorrect blockno");
80102700: 83 ec 0c sub $0xc,%esp
80102703: 68 1b 8d 10 80 push $0x80108d1b
80102708: e8 59 de ff ff call 80100566 <panic>
int sector_per_block = BSIZE/SECTOR_SIZE;
8010270d: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
int sector = b->blockno * sector_per_block;
80102714: 8b 45 08 mov 0x8(%ebp),%eax
80102717: 8b 50 08 mov 0x8(%eax),%edx
8010271a: 8b 45 f4 mov -0xc(%ebp),%eax
8010271d: 0f af c2 imul %edx,%eax
80102720: 89 45 f0 mov %eax,-0x10(%ebp)
if (sector_per_block > 7) panic("idestart");
80102723: 83 7d f4 07 cmpl $0x7,-0xc(%ebp)
80102727: 7e 0d jle 80102736 <idestart+0x5c>
80102729: 83 ec 0c sub $0xc,%esp
8010272c: 68 12 8d 10 80 push $0x80108d12
80102731: e8 30 de ff ff call 80100566 <panic>
idewait(0);
80102736: 83 ec 0c sub $0xc,%esp
80102739: 6a 00 push $0x0
8010273b: e8 a7 fe ff ff call 801025e7 <idewait>
80102740: 83 c4 10 add $0x10,%esp
outb(0x3f6, 0); // generate interrupt
80102743: 83 ec 08 sub $0x8,%esp
80102746: 6a 00 push $0x0
80102748: 68 f6 03 00 00 push $0x3f6
8010274d: e8 50 fe ff ff call 801025a2 <outb>
80102752: 83 c4 10 add $0x10,%esp
outb(0x1f2, sector_per_block); // number of sectors
80102755: 8b 45 f4 mov -0xc(%ebp),%eax
80102758: 0f b6 c0 movzbl %al,%eax
8010275b: 83 ec 08 sub $0x8,%esp
8010275e: 50 push %eax
8010275f: 68 f2 01 00 00 push $0x1f2
80102764: e8 39 fe ff ff call 801025a2 <outb>
80102769: 83 c4 10 add $0x10,%esp
outb(0x1f3, sector & 0xff);
8010276c: 8b 45 f0 mov -0x10(%ebp),%eax
8010276f: 0f b6 c0 movzbl %al,%eax
80102772: 83 ec 08 sub $0x8,%esp
80102775: 50 push %eax
80102776: 68 f3 01 00 00 push $0x1f3
8010277b: e8 22 fe ff ff call 801025a2 <outb>
80102780: 83 c4 10 add $0x10,%esp
outb(0x1f4, (sector >> 8) & 0xff);
80102783: 8b 45 f0 mov -0x10(%ebp),%eax
80102786: c1 f8 08 sar $0x8,%eax
80102789: 0f b6 c0 movzbl %al,%eax
8010278c: 83 ec 08 sub $0x8,%esp
8010278f: 50 push %eax
80102790: 68 f4 01 00 00 push $0x1f4
80102795: e8 08 fe ff ff call 801025a2 <outb>
8010279a: 83 c4 10 add $0x10,%esp
outb(0x1f5, (sector >> 16) & 0xff);
8010279d: 8b 45 f0 mov -0x10(%ebp),%eax
801027a0: c1 f8 10 sar $0x10,%eax
801027a3: 0f b6 c0 movzbl %al,%eax
801027a6: 83 ec 08 sub $0x8,%esp
801027a9: 50 push %eax
801027aa: 68 f5 01 00 00 push $0x1f5
801027af: e8 ee fd ff ff call 801025a2 <outb>
801027b4: 83 c4 10 add $0x10,%esp
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
801027b7: 8b 45 08 mov 0x8(%ebp),%eax
801027ba: 8b 40 04 mov 0x4(%eax),%eax
801027bd: 83 e0 01 and $0x1,%eax
801027c0: c1 e0 04 shl $0x4,%eax
801027c3: 89 c2 mov %eax,%edx
801027c5: 8b 45 f0 mov -0x10(%ebp),%eax
801027c8: c1 f8 18 sar $0x18,%eax
801027cb: 83 e0 0f and $0xf,%eax
801027ce: 09 d0 or %edx,%eax
801027d0: 83 c8 e0 or $0xffffffe0,%eax
801027d3: 0f b6 c0 movzbl %al,%eax
801027d6: 83 ec 08 sub $0x8,%esp
801027d9: 50 push %eax
801027da: 68 f6 01 00 00 push $0x1f6
801027df: e8 be fd ff ff call 801025a2 <outb>
801027e4: 83 c4 10 add $0x10,%esp
if(b->flags & B_DIRTY){
801027e7: 8b 45 08 mov 0x8(%ebp),%eax
801027ea: 8b 00 mov (%eax),%eax
801027ec: 83 e0 04 and $0x4,%eax
801027ef: 85 c0 test %eax,%eax
801027f1: 74 30 je 80102823 <idestart+0x149>
outb(0x1f7, IDE_CMD_WRITE);
801027f3: 83 ec 08 sub $0x8,%esp
801027f6: 6a 30 push $0x30
801027f8: 68 f7 01 00 00 push $0x1f7
801027fd: e8 a0 fd ff ff call 801025a2 <outb>
80102802: 83 c4 10 add $0x10,%esp
outsl(0x1f0, b->data, BSIZE/4);
80102805: 8b 45 08 mov 0x8(%ebp),%eax
80102808: 83 c0 18 add $0x18,%eax
8010280b: 83 ec 04 sub $0x4,%esp
8010280e: 68 80 00 00 00 push $0x80
80102813: 50 push %eax
80102814: 68 f0 01 00 00 push $0x1f0
80102819: e8 a3 fd ff ff call 801025c1 <outsl>
8010281e: 83 c4 10 add $0x10,%esp
} else {
outb(0x1f7, IDE_CMD_READ);
}
}
80102821: eb 12 jmp 80102835 <idestart+0x15b>
outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f));
if(b->flags & B_DIRTY){
outb(0x1f7, IDE_CMD_WRITE);
outsl(0x1f0, b->data, BSIZE/4);
} else {
outb(0x1f7, IDE_CMD_READ);
80102823: 83 ec 08 sub $0x8,%esp
80102826: 6a 20 push $0x20
80102828: 68 f7 01 00 00 push $0x1f7
8010282d: e8 70 fd ff ff call 801025a2 <outb>
80102832: 83 c4 10 add $0x10,%esp
}
}
80102835: 90 nop
80102836: c9 leave
80102837: c3 ret
80102838 <ideintr>:
// Interrupt handler.
void
ideintr(void)
{
80102838: 55 push %ebp
80102839: 89 e5 mov %esp,%ebp
8010283b: 83 ec 18 sub $0x18,%esp
struct buf *b;
// First queued buffer is the active request.
acquire(&idelock);
8010283e: 83 ec 0c sub $0xc,%esp
80102841: 68 00 c6 10 80 push $0x8010c600
80102846: e8 f2 2d 00 00 call 8010563d <acquire>
8010284b: 83 c4 10 add $0x10,%esp
if((b = idequeue) == 0){
8010284e: a1 34 c6 10 80 mov 0x8010c634,%eax
80102853: 89 45 f4 mov %eax,-0xc(%ebp)
80102856: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010285a: 75 15 jne 80102871 <ideintr+0x39>
release(&idelock);
8010285c: 83 ec 0c sub $0xc,%esp
8010285f: 68 00 c6 10 80 push $0x8010c600
80102864: e8 3b 2e 00 00 call 801056a4 <release>
80102869: 83 c4 10 add $0x10,%esp
// cprintf("spurious IDE interrupt\n");
return;
8010286c: e9 9a 00 00 00 jmp 8010290b <ideintr+0xd3>
}
idequeue = b->qnext;
80102871: 8b 45 f4 mov -0xc(%ebp),%eax
80102874: 8b 40 14 mov 0x14(%eax),%eax
80102877: a3 34 c6 10 80 mov %eax,0x8010c634
// Read data if needed.
if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
8010287c: 8b 45 f4 mov -0xc(%ebp),%eax
8010287f: 8b 00 mov (%eax),%eax
80102881: 83 e0 04 and $0x4,%eax
80102884: 85 c0 test %eax,%eax
80102886: 75 2d jne 801028b5 <ideintr+0x7d>
80102888: 83 ec 0c sub $0xc,%esp
8010288b: 6a 01 push $0x1
8010288d: e8 55 fd ff ff call 801025e7 <idewait>
80102892: 83 c4 10 add $0x10,%esp
80102895: 85 c0 test %eax,%eax
80102897: 78 1c js 801028b5 <ideintr+0x7d>
insl(0x1f0, b->data, BSIZE/4);
80102899: 8b 45 f4 mov -0xc(%ebp),%eax
8010289c: 83 c0 18 add $0x18,%eax
8010289f: 83 ec 04 sub $0x4,%esp
801028a2: 68 80 00 00 00 push $0x80
801028a7: 50 push %eax
801028a8: 68 f0 01 00 00 push $0x1f0
801028ad: e8 ca fc ff ff call 8010257c <insl>
801028b2: 83 c4 10 add $0x10,%esp
// Wake process waiting for this buf.
b->flags |= B_VALID;
801028b5: 8b 45 f4 mov -0xc(%ebp),%eax
801028b8: 8b 00 mov (%eax),%eax
801028ba: 83 c8 02 or $0x2,%eax
801028bd: 89 c2 mov %eax,%edx
801028bf: 8b 45 f4 mov -0xc(%ebp),%eax
801028c2: 89 10 mov %edx,(%eax)
b->flags &= ~B_DIRTY;
801028c4: 8b 45 f4 mov -0xc(%ebp),%eax
801028c7: 8b 00 mov (%eax),%eax
801028c9: 83 e0 fb and $0xfffffffb,%eax
801028cc: 89 c2 mov %eax,%edx
801028ce: 8b 45 f4 mov -0xc(%ebp),%eax
801028d1: 89 10 mov %edx,(%eax)
wakeup(b);
801028d3: 83 ec 0c sub $0xc,%esp
801028d6: ff 75 f4 pushl -0xc(%ebp)
801028d9: e8 4b 2b 00 00 call 80105429 <wakeup>
801028de: 83 c4 10 add $0x10,%esp
// Start disk on next buf in queue.
if(idequeue != 0)
801028e1: a1 34 c6 10 80 mov 0x8010c634,%eax
801028e6: 85 c0 test %eax,%eax
801028e8: 74 11 je 801028fb <ideintr+0xc3>
idestart(idequeue);
801028ea: a1 34 c6 10 80 mov 0x8010c634,%eax
801028ef: 83 ec 0c sub $0xc,%esp
801028f2: 50 push %eax
801028f3: e8 e2 fd ff ff call 801026da <idestart>
801028f8: 83 c4 10 add $0x10,%esp
release(&idelock);
801028fb: 83 ec 0c sub $0xc,%esp
801028fe: 68 00 c6 10 80 push $0x8010c600
80102903: e8 9c 2d 00 00 call 801056a4 <release>
80102908: 83 c4 10 add $0x10,%esp
}
8010290b: c9 leave
8010290c: c3 ret
8010290d <iderw>:
// Sync buf with disk.
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
8010290d: 55 push %ebp
8010290e: 89 e5 mov %esp,%ebp
80102910: 83 ec 18 sub $0x18,%esp
struct buf **pp;
if(!(b->flags & B_BUSY))
80102913: 8b 45 08 mov 0x8(%ebp),%eax
80102916: 8b 00 mov (%eax),%eax
80102918: 83 e0 01 and $0x1,%eax
8010291b: 85 c0 test %eax,%eax
8010291d: 75 0d jne 8010292c <iderw+0x1f>
panic("iderw: buf not busy");
8010291f: 83 ec 0c sub $0xc,%esp
80102922: 68 2d 8d 10 80 push $0x80108d2d
80102927: e8 3a dc ff ff call 80100566 <panic>
if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
8010292c: 8b 45 08 mov 0x8(%ebp),%eax
8010292f: 8b 00 mov (%eax),%eax
80102931: 83 e0 06 and $0x6,%eax
80102934: 83 f8 02 cmp $0x2,%eax
80102937: 75 0d jne 80102946 <iderw+0x39>
panic("iderw: nothing to do");
80102939: 83 ec 0c sub $0xc,%esp
8010293c: 68 41 8d 10 80 push $0x80108d41
80102941: e8 20 dc ff ff call 80100566 <panic>
if(b->dev != 0 && !havedisk1)
80102946: 8b 45 08 mov 0x8(%ebp),%eax
80102949: 8b 40 04 mov 0x4(%eax),%eax
8010294c: 85 c0 test %eax,%eax
8010294e: 74 16 je 80102966 <iderw+0x59>
80102950: a1 38 c6 10 80 mov 0x8010c638,%eax
80102955: 85 c0 test %eax,%eax
80102957: 75 0d jne 80102966 <iderw+0x59>
panic("iderw: ide disk 1 not present");
80102959: 83 ec 0c sub $0xc,%esp
8010295c: 68 56 8d 10 80 push $0x80108d56
80102961: e8 00 dc ff ff call 80100566 <panic>
acquire(&idelock); //DOC:acquire-lock
80102966: 83 ec 0c sub $0xc,%esp
80102969: 68 00 c6 10 80 push $0x8010c600
8010296e: e8 ca 2c 00 00 call 8010563d <acquire>
80102973: 83 c4 10 add $0x10,%esp
// Append b to idequeue.
b->qnext = 0;
80102976: 8b 45 08 mov 0x8(%ebp),%eax
80102979: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
for(pp=&idequeue; *pp; pp=&(*pp)->qnext) //DOC:insert-queue
80102980: c7 45 f4 34 c6 10 80 movl $0x8010c634,-0xc(%ebp)
80102987: eb 0b jmp 80102994 <iderw+0x87>
80102989: 8b 45 f4 mov -0xc(%ebp),%eax
8010298c: 8b 00 mov (%eax),%eax
8010298e: 83 c0 14 add $0x14,%eax
80102991: 89 45 f4 mov %eax,-0xc(%ebp)
80102994: 8b 45 f4 mov -0xc(%ebp),%eax
80102997: 8b 00 mov (%eax),%eax
80102999: 85 c0 test %eax,%eax
8010299b: 75 ec jne 80102989 <iderw+0x7c>
;
*pp = b;
8010299d: 8b 45 f4 mov -0xc(%ebp),%eax
801029a0: 8b 55 08 mov 0x8(%ebp),%edx
801029a3: 89 10 mov %edx,(%eax)
// Start disk if necessary.
if(idequeue == b)
801029a5: a1 34 c6 10 80 mov 0x8010c634,%eax
801029aa: 3b 45 08 cmp 0x8(%ebp),%eax
801029ad: 75 23 jne 801029d2 <iderw+0xc5>
idestart(b);
801029af: 83 ec 0c sub $0xc,%esp
801029b2: ff 75 08 pushl 0x8(%ebp)
801029b5: e8 20 fd ff ff call 801026da <idestart>
801029ba: 83 c4 10 add $0x10,%esp
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
801029bd: eb 13 jmp 801029d2 <iderw+0xc5>
sleep(b, &idelock);
801029bf: 83 ec 08 sub $0x8,%esp
801029c2: 68 00 c6 10 80 push $0x8010c600
801029c7: ff 75 08 pushl 0x8(%ebp)
801029ca: e8 6c 29 00 00 call 8010533b <sleep>
801029cf: 83 c4 10 add $0x10,%esp
// Start disk if necessary.
if(idequeue == b)
idestart(b);
// Wait for request to finish.
while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){
801029d2: 8b 45 08 mov 0x8(%ebp),%eax
801029d5: 8b 00 mov (%eax),%eax
801029d7: 83 e0 06 and $0x6,%eax
801029da: 83 f8 02 cmp $0x2,%eax
801029dd: 75 e0 jne 801029bf <iderw+0xb2>
sleep(b, &idelock);
}
release(&idelock);
801029df: 83 ec 0c sub $0xc,%esp
801029e2: 68 00 c6 10 80 push $0x8010c600
801029e7: e8 b8 2c 00 00 call 801056a4 <release>
801029ec: 83 c4 10 add $0x10,%esp
}
801029ef: 90 nop
801029f0: c9 leave
801029f1: c3 ret
801029f2 <ioapicread>:
uint data;
};
static uint
ioapicread(int reg)
{
801029f2: 55 push %ebp
801029f3: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
801029f5: a1 14 32 11 80 mov 0x80113214,%eax
801029fa: 8b 55 08 mov 0x8(%ebp),%edx
801029fd: 89 10 mov %edx,(%eax)
return ioapic->data;
801029ff: a1 14 32 11 80 mov 0x80113214,%eax
80102a04: 8b 40 10 mov 0x10(%eax),%eax
}
80102a07: 5d pop %ebp
80102a08: c3 ret
80102a09 <ioapicwrite>:
static void
ioapicwrite(int reg, uint data)
{
80102a09: 55 push %ebp
80102a0a: 89 e5 mov %esp,%ebp
ioapic->reg = reg;
80102a0c: a1 14 32 11 80 mov 0x80113214,%eax
80102a11: 8b 55 08 mov 0x8(%ebp),%edx
80102a14: 89 10 mov %edx,(%eax)
ioapic->data = data;
80102a16: a1 14 32 11 80 mov 0x80113214,%eax
80102a1b: 8b 55 0c mov 0xc(%ebp),%edx
80102a1e: 89 50 10 mov %edx,0x10(%eax)
}
80102a21: 90 nop
80102a22: 5d pop %ebp
80102a23: c3 ret
80102a24 <ioapicinit>:
void
ioapicinit(void)
{
80102a24: 55 push %ebp
80102a25: 89 e5 mov %esp,%ebp
80102a27: 83 ec 18 sub $0x18,%esp
int i, id, maxintr;
if(!ismp)
80102a2a: a1 44 33 11 80 mov 0x80113344,%eax
80102a2f: 85 c0 test %eax,%eax
80102a31: 0f 84 a0 00 00 00 je 80102ad7 <ioapicinit+0xb3>
return;
ioapic = (volatile struct ioapic*)IOAPIC;
80102a37: c7 05 14 32 11 80 00 movl $0xfec00000,0x80113214
80102a3e: 00 c0 fe
maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
80102a41: 6a 01 push $0x1
80102a43: e8 aa ff ff ff call 801029f2 <ioapicread>
80102a48: 83 c4 04 add $0x4,%esp
80102a4b: c1 e8 10 shr $0x10,%eax
80102a4e: 25 ff 00 00 00 and $0xff,%eax
80102a53: 89 45 f0 mov %eax,-0x10(%ebp)
id = ioapicread(REG_ID) >> 24;
80102a56: 6a 00 push $0x0
80102a58: e8 95 ff ff ff call 801029f2 <ioapicread>
80102a5d: 83 c4 04 add $0x4,%esp
80102a60: c1 e8 18 shr $0x18,%eax
80102a63: 89 45 ec mov %eax,-0x14(%ebp)
if(id != ioapicid)
80102a66: 0f b6 05 40 33 11 80 movzbl 0x80113340,%eax
80102a6d: 0f b6 c0 movzbl %al,%eax
80102a70: 3b 45 ec cmp -0x14(%ebp),%eax
80102a73: 74 10 je 80102a85 <ioapicinit+0x61>
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
80102a75: 83 ec 0c sub $0xc,%esp
80102a78: 68 74 8d 10 80 push $0x80108d74
80102a7d: e8 44 d9 ff ff call 801003c6 <cprintf>
80102a82: 83 c4 10 add $0x10,%esp
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
80102a85: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80102a8c: eb 3f jmp 80102acd <ioapicinit+0xa9>
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
80102a8e: 8b 45 f4 mov -0xc(%ebp),%eax
80102a91: 83 c0 20 add $0x20,%eax
80102a94: 0d 00 00 01 00 or $0x10000,%eax
80102a99: 89 c2 mov %eax,%edx
80102a9b: 8b 45 f4 mov -0xc(%ebp),%eax
80102a9e: 83 c0 08 add $0x8,%eax
80102aa1: 01 c0 add %eax,%eax
80102aa3: 83 ec 08 sub $0x8,%esp
80102aa6: 52 push %edx
80102aa7: 50 push %eax
80102aa8: e8 5c ff ff ff call 80102a09 <ioapicwrite>
80102aad: 83 c4 10 add $0x10,%esp
ioapicwrite(REG_TABLE+2*i+1, 0);
80102ab0: 8b 45 f4 mov -0xc(%ebp),%eax
80102ab3: 83 c0 08 add $0x8,%eax
80102ab6: 01 c0 add %eax,%eax
80102ab8: 83 c0 01 add $0x1,%eax
80102abb: 83 ec 08 sub $0x8,%esp
80102abe: 6a 00 push $0x0
80102ac0: 50 push %eax
80102ac1: e8 43 ff ff ff call 80102a09 <ioapicwrite>
80102ac6: 83 c4 10 add $0x10,%esp
if(id != ioapicid)
cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
// Mark all interrupts edge-triggered, active high, disabled,
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
80102ac9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80102acd: 8b 45 f4 mov -0xc(%ebp),%eax
80102ad0: 3b 45 f0 cmp -0x10(%ebp),%eax
80102ad3: 7e b9 jle 80102a8e <ioapicinit+0x6a>
80102ad5: eb 01 jmp 80102ad8 <ioapicinit+0xb4>
ioapicinit(void)
{
int i, id, maxintr;
if(!ismp)
return;
80102ad7: 90 nop
// and not routed to any CPUs.
for(i = 0; i <= maxintr; i++){
ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
ioapicwrite(REG_TABLE+2*i+1, 0);
}
}
80102ad8: c9 leave
80102ad9: c3 ret
80102ada <ioapicenable>:
void
ioapicenable(int irq, int cpunum)
{
80102ada: 55 push %ebp
80102adb: 89 e5 mov %esp,%ebp
if(!ismp)
80102add: a1 44 33 11 80 mov 0x80113344,%eax
80102ae2: 85 c0 test %eax,%eax
80102ae4: 74 39 je 80102b1f <ioapicenable+0x45>
return;
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
80102ae6: 8b 45 08 mov 0x8(%ebp),%eax
80102ae9: 83 c0 20 add $0x20,%eax
80102aec: 89 c2 mov %eax,%edx
80102aee: 8b 45 08 mov 0x8(%ebp),%eax
80102af1: 83 c0 08 add $0x8,%eax
80102af4: 01 c0 add %eax,%eax
80102af6: 52 push %edx
80102af7: 50 push %eax
80102af8: e8 0c ff ff ff call 80102a09 <ioapicwrite>
80102afd: 83 c4 08 add $0x8,%esp
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
80102b00: 8b 45 0c mov 0xc(%ebp),%eax
80102b03: c1 e0 18 shl $0x18,%eax
80102b06: 89 c2 mov %eax,%edx
80102b08: 8b 45 08 mov 0x8(%ebp),%eax
80102b0b: 83 c0 08 add $0x8,%eax
80102b0e: 01 c0 add %eax,%eax
80102b10: 83 c0 01 add $0x1,%eax
80102b13: 52 push %edx
80102b14: 50 push %eax
80102b15: e8 ef fe ff ff call 80102a09 <ioapicwrite>
80102b1a: 83 c4 08 add $0x8,%esp
80102b1d: eb 01 jmp 80102b20 <ioapicenable+0x46>
void
ioapicenable(int irq, int cpunum)
{
if(!ismp)
return;
80102b1f: 90 nop
// Mark interrupt edge-triggered, active high,
// enabled, and routed to the given cpunum,
// which happens to be that cpu's APIC ID.
ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
}
80102b20: c9 leave
80102b21: c3 ret
80102b22 <v2p>:
#define KERNBASE 0x80000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
80102b22: 55 push %ebp
80102b23: 89 e5 mov %esp,%ebp
80102b25: 8b 45 08 mov 0x8(%ebp),%eax
80102b28: 05 00 00 00 80 add $0x80000000,%eax
80102b2d: 5d pop %ebp
80102b2e: c3 ret
80102b2f <kinit1>:
// the pages mapped by entrypgdir on free list.
// 2. main() calls kinit2() with the rest of the physical pages
// after installing a full page table that maps them on all cores.
void
kinit1(void *vstart, void *vend)
{
80102b2f: 55 push %ebp
80102b30: 89 e5 mov %esp,%ebp
80102b32: 83 ec 08 sub $0x8,%esp
initlock(&kmem.lock, "kmem");
80102b35: 83 ec 08 sub $0x8,%esp
80102b38: 68 a6 8d 10 80 push $0x80108da6
80102b3d: 68 20 32 11 80 push $0x80113220
80102b42: e8 d4 2a 00 00 call 8010561b <initlock>
80102b47: 83 c4 10 add $0x10,%esp
kmem.use_lock = 0;
80102b4a: c7 05 54 32 11 80 00 movl $0x0,0x80113254
80102b51: 00 00 00
freerange(vstart, vend);
80102b54: 83 ec 08 sub $0x8,%esp
80102b57: ff 75 0c pushl 0xc(%ebp)
80102b5a: ff 75 08 pushl 0x8(%ebp)
80102b5d: e8 2a 00 00 00 call 80102b8c <freerange>
80102b62: 83 c4 10 add $0x10,%esp
}
80102b65: 90 nop
80102b66: c9 leave
80102b67: c3 ret
80102b68 <kinit2>:
void
kinit2(void *vstart, void *vend)
{
80102b68: 55 push %ebp
80102b69: 89 e5 mov %esp,%ebp
80102b6b: 83 ec 08 sub $0x8,%esp
freerange(vstart, vend);
80102b6e: 83 ec 08 sub $0x8,%esp
80102b71: ff 75 0c pushl 0xc(%ebp)
80102b74: ff 75 08 pushl 0x8(%ebp)
80102b77: e8 10 00 00 00 call 80102b8c <freerange>
80102b7c: 83 c4 10 add $0x10,%esp
kmem.use_lock = 1;
80102b7f: c7 05 54 32 11 80 01 movl $0x1,0x80113254
80102b86: 00 00 00
}
80102b89: 90 nop
80102b8a: c9 leave
80102b8b: c3 ret
80102b8c <freerange>:
void
freerange(void *vstart, void *vend)
{
80102b8c: 55 push %ebp
80102b8d: 89 e5 mov %esp,%ebp
80102b8f: 83 ec 18 sub $0x18,%esp
char *p;
p = (char*)PGROUNDUP((uint)vstart);
80102b92: 8b 45 08 mov 0x8(%ebp),%eax
80102b95: 05 ff 0f 00 00 add $0xfff,%eax
80102b9a: 25 00 f0 ff ff and $0xfffff000,%eax
80102b9f: 89 45 f4 mov %eax,-0xc(%ebp)
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102ba2: eb 15 jmp 80102bb9 <freerange+0x2d>
kfree(p);
80102ba4: 83 ec 0c sub $0xc,%esp
80102ba7: ff 75 f4 pushl -0xc(%ebp)
80102baa: e8 1a 00 00 00 call 80102bc9 <kfree>
80102baf: 83 c4 10 add $0x10,%esp
void
freerange(void *vstart, void *vend)
{
char *p;
p = (char*)PGROUNDUP((uint)vstart);
for(; p + PGSIZE <= (char*)vend; p += PGSIZE)
80102bb2: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80102bb9: 8b 45 f4 mov -0xc(%ebp),%eax
80102bbc: 05 00 10 00 00 add $0x1000,%eax
80102bc1: 3b 45 0c cmp 0xc(%ebp),%eax
80102bc4: 76 de jbe 80102ba4 <freerange+0x18>
kfree(p);
}
80102bc6: 90 nop
80102bc7: c9 leave
80102bc8: c3 ret
80102bc9 <kfree>:
// which normally should have been returned by a
// call to kalloc(). (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v)
{
80102bc9: 55 push %ebp
80102bca: 89 e5 mov %esp,%ebp
80102bcc: 83 ec 18 sub $0x18,%esp
struct run *r;
if((uint)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
80102bcf: 8b 45 08 mov 0x8(%ebp),%eax
80102bd2: 25 ff 0f 00 00 and $0xfff,%eax
80102bd7: 85 c0 test %eax,%eax
80102bd9: 75 1b jne 80102bf6 <kfree+0x2d>
80102bdb: 81 7d 08 3c 63 11 80 cmpl $0x8011633c,0x8(%ebp)
80102be2: 72 12 jb 80102bf6 <kfree+0x2d>
80102be4: ff 75 08 pushl 0x8(%ebp)
80102be7: e8 36 ff ff ff call 80102b22 <v2p>
80102bec: 83 c4 04 add $0x4,%esp
80102bef: 3d ff ff ff 0d cmp $0xdffffff,%eax
80102bf4: 76 0d jbe 80102c03 <kfree+0x3a>
panic("kfree");
80102bf6: 83 ec 0c sub $0xc,%esp
80102bf9: 68 ab 8d 10 80 push $0x80108dab
80102bfe: e8 63 d9 ff ff call 80100566 <panic>
// Fill with junk to catch dangling refs.
memset(v, 1, PGSIZE);
80102c03: 83 ec 04 sub $0x4,%esp
80102c06: 68 00 10 00 00 push $0x1000
80102c0b: 6a 01 push $0x1
80102c0d: ff 75 08 pushl 0x8(%ebp)
80102c10: e8 8b 2c 00 00 call 801058a0 <memset>
80102c15: 83 c4 10 add $0x10,%esp
if(kmem.use_lock)
80102c18: a1 54 32 11 80 mov 0x80113254,%eax
80102c1d: 85 c0 test %eax,%eax
80102c1f: 74 10 je 80102c31 <kfree+0x68>
acquire(&kmem.lock);
80102c21: 83 ec 0c sub $0xc,%esp
80102c24: 68 20 32 11 80 push $0x80113220
80102c29: e8 0f 2a 00 00 call 8010563d <acquire>
80102c2e: 83 c4 10 add $0x10,%esp
r = (struct run*)v;
80102c31: 8b 45 08 mov 0x8(%ebp),%eax
80102c34: 89 45 f4 mov %eax,-0xc(%ebp)
r->next = kmem.freelist;
80102c37: 8b 15 58 32 11 80 mov 0x80113258,%edx
80102c3d: 8b 45 f4 mov -0xc(%ebp),%eax
80102c40: 89 10 mov %edx,(%eax)
kmem.freelist = r;
80102c42: 8b 45 f4 mov -0xc(%ebp),%eax
80102c45: a3 58 32 11 80 mov %eax,0x80113258
if(kmem.use_lock)
80102c4a: a1 54 32 11 80 mov 0x80113254,%eax
80102c4f: 85 c0 test %eax,%eax
80102c51: 74 10 je 80102c63 <kfree+0x9a>
release(&kmem.lock);
80102c53: 83 ec 0c sub $0xc,%esp
80102c56: 68 20 32 11 80 push $0x80113220
80102c5b: e8 44 2a 00 00 call 801056a4 <release>
80102c60: 83 c4 10 add $0x10,%esp
}
80102c63: 90 nop
80102c64: c9 leave
80102c65: c3 ret
80102c66 <kalloc>:
// Allocate one 4096-byte page of physical memory.
// Returns a pointer that the kernel can use.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(void)
{
80102c66: 55 push %ebp
80102c67: 89 e5 mov %esp,%ebp
80102c69: 83 ec 18 sub $0x18,%esp
struct run *r;
if(kmem.use_lock)
80102c6c: a1 54 32 11 80 mov 0x80113254,%eax
80102c71: 85 c0 test %eax,%eax
80102c73: 74 10 je 80102c85 <kalloc+0x1f>
acquire(&kmem.lock);
80102c75: 83 ec 0c sub $0xc,%esp
80102c78: 68 20 32 11 80 push $0x80113220
80102c7d: e8 bb 29 00 00 call 8010563d <acquire>
80102c82: 83 c4 10 add $0x10,%esp
r = kmem.freelist;
80102c85: a1 58 32 11 80 mov 0x80113258,%eax
80102c8a: 89 45 f4 mov %eax,-0xc(%ebp)
if(r)
80102c8d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80102c91: 74 0a je 80102c9d <kalloc+0x37>
kmem.freelist = r->next;
80102c93: 8b 45 f4 mov -0xc(%ebp),%eax
80102c96: 8b 00 mov (%eax),%eax
80102c98: a3 58 32 11 80 mov %eax,0x80113258
if(kmem.use_lock)
80102c9d: a1 54 32 11 80 mov 0x80113254,%eax
80102ca2: 85 c0 test %eax,%eax
80102ca4: 74 10 je 80102cb6 <kalloc+0x50>
release(&kmem.lock);
80102ca6: 83 ec 0c sub $0xc,%esp
80102ca9: 68 20 32 11 80 push $0x80113220
80102cae: e8 f1 29 00 00 call 801056a4 <release>
80102cb3: 83 c4 10 add $0x10,%esp
return (char*)r;
80102cb6: 8b 45 f4 mov -0xc(%ebp),%eax
}
80102cb9: c9 leave
80102cba: c3 ret
80102cbb <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102cbb: 55 push %ebp
80102cbc: 89 e5 mov %esp,%ebp
80102cbe: 83 ec 14 sub $0x14,%esp
80102cc1: 8b 45 08 mov 0x8(%ebp),%eax
80102cc4: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102cc8: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102ccc: 89 c2 mov %eax,%edx
80102cce: ec in (%dx),%al
80102ccf: 88 45 ff mov %al,-0x1(%ebp)
return data;
80102cd2: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80102cd6: c9 leave
80102cd7: c3 ret
80102cd8 <kbdgetc>:
#include "defs.h"
#include "kbd.h"
int
kbdgetc(void)
{
80102cd8: 55 push %ebp
80102cd9: 89 e5 mov %esp,%ebp
80102cdb: 83 ec 10 sub $0x10,%esp
static uchar *charcode[4] = {
normalmap, shiftmap, ctlmap, ctlmap
};
uint st, data, c;
st = inb(KBSTATP);
80102cde: 6a 64 push $0x64
80102ce0: e8 d6 ff ff ff call 80102cbb <inb>
80102ce5: 83 c4 04 add $0x4,%esp
80102ce8: 0f b6 c0 movzbl %al,%eax
80102ceb: 89 45 f4 mov %eax,-0xc(%ebp)
if((st & KBS_DIB) == 0)
80102cee: 8b 45 f4 mov -0xc(%ebp),%eax
80102cf1: 83 e0 01 and $0x1,%eax
80102cf4: 85 c0 test %eax,%eax
80102cf6: 75 0a jne 80102d02 <kbdgetc+0x2a>
return -1;
80102cf8: b8 ff ff ff ff mov $0xffffffff,%eax
80102cfd: e9 23 01 00 00 jmp 80102e25 <kbdgetc+0x14d>
data = inb(KBDATAP);
80102d02: 6a 60 push $0x60
80102d04: e8 b2 ff ff ff call 80102cbb <inb>
80102d09: 83 c4 04 add $0x4,%esp
80102d0c: 0f b6 c0 movzbl %al,%eax
80102d0f: 89 45 fc mov %eax,-0x4(%ebp)
if(data == 0xE0){
80102d12: 81 7d fc e0 00 00 00 cmpl $0xe0,-0x4(%ebp)
80102d19: 75 17 jne 80102d32 <kbdgetc+0x5a>
shift |= E0ESC;
80102d1b: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102d20: 83 c8 40 or $0x40,%eax
80102d23: a3 3c c6 10 80 mov %eax,0x8010c63c
return 0;
80102d28: b8 00 00 00 00 mov $0x0,%eax
80102d2d: e9 f3 00 00 00 jmp 80102e25 <kbdgetc+0x14d>
} else if(data & 0x80){
80102d32: 8b 45 fc mov -0x4(%ebp),%eax
80102d35: 25 80 00 00 00 and $0x80,%eax
80102d3a: 85 c0 test %eax,%eax
80102d3c: 74 45 je 80102d83 <kbdgetc+0xab>
// Key released
data = (shift & E0ESC ? data : data & 0x7F);
80102d3e: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102d43: 83 e0 40 and $0x40,%eax
80102d46: 85 c0 test %eax,%eax
80102d48: 75 08 jne 80102d52 <kbdgetc+0x7a>
80102d4a: 8b 45 fc mov -0x4(%ebp),%eax
80102d4d: 83 e0 7f and $0x7f,%eax
80102d50: eb 03 jmp 80102d55 <kbdgetc+0x7d>
80102d52: 8b 45 fc mov -0x4(%ebp),%eax
80102d55: 89 45 fc mov %eax,-0x4(%ebp)
shift &= ~(shiftcode[data] | E0ESC);
80102d58: 8b 45 fc mov -0x4(%ebp),%eax
80102d5b: 05 20 a0 10 80 add $0x8010a020,%eax
80102d60: 0f b6 00 movzbl (%eax),%eax
80102d63: 83 c8 40 or $0x40,%eax
80102d66: 0f b6 c0 movzbl %al,%eax
80102d69: f7 d0 not %eax
80102d6b: 89 c2 mov %eax,%edx
80102d6d: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102d72: 21 d0 and %edx,%eax
80102d74: a3 3c c6 10 80 mov %eax,0x8010c63c
return 0;
80102d79: b8 00 00 00 00 mov $0x0,%eax
80102d7e: e9 a2 00 00 00 jmp 80102e25 <kbdgetc+0x14d>
} else if(shift & E0ESC){
80102d83: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102d88: 83 e0 40 and $0x40,%eax
80102d8b: 85 c0 test %eax,%eax
80102d8d: 74 14 je 80102da3 <kbdgetc+0xcb>
// Last character was an E0 escape; or with 0x80
data |= 0x80;
80102d8f: 81 4d fc 80 00 00 00 orl $0x80,-0x4(%ebp)
shift &= ~E0ESC;
80102d96: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102d9b: 83 e0 bf and $0xffffffbf,%eax
80102d9e: a3 3c c6 10 80 mov %eax,0x8010c63c
}
shift |= shiftcode[data];
80102da3: 8b 45 fc mov -0x4(%ebp),%eax
80102da6: 05 20 a0 10 80 add $0x8010a020,%eax
80102dab: 0f b6 00 movzbl (%eax),%eax
80102dae: 0f b6 d0 movzbl %al,%edx
80102db1: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102db6: 09 d0 or %edx,%eax
80102db8: a3 3c c6 10 80 mov %eax,0x8010c63c
shift ^= togglecode[data];
80102dbd: 8b 45 fc mov -0x4(%ebp),%eax
80102dc0: 05 20 a1 10 80 add $0x8010a120,%eax
80102dc5: 0f b6 00 movzbl (%eax),%eax
80102dc8: 0f b6 d0 movzbl %al,%edx
80102dcb: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102dd0: 31 d0 xor %edx,%eax
80102dd2: a3 3c c6 10 80 mov %eax,0x8010c63c
c = charcode[shift & (CTL | SHIFT)][data];
80102dd7: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102ddc: 83 e0 03 and $0x3,%eax
80102ddf: 8b 14 85 20 a5 10 80 mov -0x7fef5ae0(,%eax,4),%edx
80102de6: 8b 45 fc mov -0x4(%ebp),%eax
80102de9: 01 d0 add %edx,%eax
80102deb: 0f b6 00 movzbl (%eax),%eax
80102dee: 0f b6 c0 movzbl %al,%eax
80102df1: 89 45 f8 mov %eax,-0x8(%ebp)
if(shift & CAPSLOCK){
80102df4: a1 3c c6 10 80 mov 0x8010c63c,%eax
80102df9: 83 e0 08 and $0x8,%eax
80102dfc: 85 c0 test %eax,%eax
80102dfe: 74 22 je 80102e22 <kbdgetc+0x14a>
if('a' <= c && c <= 'z')
80102e00: 83 7d f8 60 cmpl $0x60,-0x8(%ebp)
80102e04: 76 0c jbe 80102e12 <kbdgetc+0x13a>
80102e06: 83 7d f8 7a cmpl $0x7a,-0x8(%ebp)
80102e0a: 77 06 ja 80102e12 <kbdgetc+0x13a>
c += 'A' - 'a';
80102e0c: 83 6d f8 20 subl $0x20,-0x8(%ebp)
80102e10: eb 10 jmp 80102e22 <kbdgetc+0x14a>
else if('A' <= c && c <= 'Z')
80102e12: 83 7d f8 40 cmpl $0x40,-0x8(%ebp)
80102e16: 76 0a jbe 80102e22 <kbdgetc+0x14a>
80102e18: 83 7d f8 5a cmpl $0x5a,-0x8(%ebp)
80102e1c: 77 04 ja 80102e22 <kbdgetc+0x14a>
c += 'a' - 'A';
80102e1e: 83 45 f8 20 addl $0x20,-0x8(%ebp)
}
return c;
80102e22: 8b 45 f8 mov -0x8(%ebp),%eax
}
80102e25: c9 leave
80102e26: c3 ret
80102e27 <kbdintr>:
void
kbdintr(void)
{
80102e27: 55 push %ebp
80102e28: 89 e5 mov %esp,%ebp
80102e2a: 83 ec 08 sub $0x8,%esp
consoleintr(kbdgetc);
80102e2d: 83 ec 0c sub $0xc,%esp
80102e30: 68 d8 2c 10 80 push $0x80102cd8
80102e35: e8 bf d9 ff ff call 801007f9 <consoleintr>
80102e3a: 83 c4 10 add $0x10,%esp
}
80102e3d: 90 nop
80102e3e: c9 leave
80102e3f: c3 ret
80102e40 <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80102e40: 55 push %ebp
80102e41: 89 e5 mov %esp,%ebp
80102e43: 83 ec 14 sub $0x14,%esp
80102e46: 8b 45 08 mov 0x8(%ebp),%eax
80102e49: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80102e4d: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80102e51: 89 c2 mov %eax,%edx
80102e53: ec in (%dx),%al
80102e54: 88 45 ff mov %al,-0x1(%ebp)
return data;
80102e57: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80102e5b: c9 leave
80102e5c: c3 ret
80102e5d <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80102e5d: 55 push %ebp
80102e5e: 89 e5 mov %esp,%ebp
80102e60: 83 ec 08 sub $0x8,%esp
80102e63: 8b 55 08 mov 0x8(%ebp),%edx
80102e66: 8b 45 0c mov 0xc(%ebp),%eax
80102e69: 66 89 55 fc mov %dx,-0x4(%ebp)
80102e6d: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80102e70: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80102e74: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80102e78: ee out %al,(%dx)
}
80102e79: 90 nop
80102e7a: c9 leave
80102e7b: c3 ret
80102e7c <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
80102e7c: 55 push %ebp
80102e7d: 89 e5 mov %esp,%ebp
80102e7f: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80102e82: 9c pushf
80102e83: 58 pop %eax
80102e84: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
80102e87: 8b 45 fc mov -0x4(%ebp),%eax
}
80102e8a: c9 leave
80102e8b: c3 ret
80102e8c <lapicw>:
volatile uint *lapic; // Initialized in mp.c
static void
lapicw(int index, int value)
{
80102e8c: 55 push %ebp
80102e8d: 89 e5 mov %esp,%ebp
lapic[index] = value;
80102e8f: a1 5c 32 11 80 mov 0x8011325c,%eax
80102e94: 8b 55 08 mov 0x8(%ebp),%edx
80102e97: c1 e2 02 shl $0x2,%edx
80102e9a: 01 c2 add %eax,%edx
80102e9c: 8b 45 0c mov 0xc(%ebp),%eax
80102e9f: 89 02 mov %eax,(%edx)
lapic[ID]; // wait for write to finish, by reading
80102ea1: a1 5c 32 11 80 mov 0x8011325c,%eax
80102ea6: 83 c0 20 add $0x20,%eax
80102ea9: 8b 00 mov (%eax),%eax
}
80102eab: 90 nop
80102eac: 5d pop %ebp
80102ead: c3 ret
80102eae <lapicinit>:
//PAGEBREAK!
void
lapicinit(void)
{
80102eae: 55 push %ebp
80102eaf: 89 e5 mov %esp,%ebp
if(!lapic)
80102eb1: a1 5c 32 11 80 mov 0x8011325c,%eax
80102eb6: 85 c0 test %eax,%eax
80102eb8: 0f 84 0b 01 00 00 je 80102fc9 <lapicinit+0x11b>
return;
// Enable local APIC; set spurious interrupt vector.
lapicw(SVR, ENABLE | (T_IRQ0 + IRQ_SPURIOUS));
80102ebe: 68 3f 01 00 00 push $0x13f
80102ec3: 6a 3c push $0x3c
80102ec5: e8 c2 ff ff ff call 80102e8c <lapicw>
80102eca: 83 c4 08 add $0x8,%esp
// The timer repeatedly counts down at bus frequency
// from lapic[TICR] and then issues an interrupt.
// If xv6 cared more about precise timekeeping,
// TICR would be calibrated using an external time source.
lapicw(TDCR, X1);
80102ecd: 6a 0b push $0xb
80102ecf: 68 f8 00 00 00 push $0xf8
80102ed4: e8 b3 ff ff ff call 80102e8c <lapicw>
80102ed9: 83 c4 08 add $0x8,%esp
lapicw(TIMER, PERIODIC | (T_IRQ0 + IRQ_TIMER));
80102edc: 68 20 00 02 00 push $0x20020
80102ee1: 68 c8 00 00 00 push $0xc8
80102ee6: e8 a1 ff ff ff call 80102e8c <lapicw>
80102eeb: 83 c4 08 add $0x8,%esp
lapicw(TICR, 10000000);
80102eee: 68 80 96 98 00 push $0x989680
80102ef3: 68 e0 00 00 00 push $0xe0
80102ef8: e8 8f ff ff ff call 80102e8c <lapicw>
80102efd: 83 c4 08 add $0x8,%esp
// Disable logical interrupt lines.
lapicw(LINT0, MASKED);
80102f00: 68 00 00 01 00 push $0x10000
80102f05: 68 d4 00 00 00 push $0xd4
80102f0a: e8 7d ff ff ff call 80102e8c <lapicw>
80102f0f: 83 c4 08 add $0x8,%esp
lapicw(LINT1, MASKED);
80102f12: 68 00 00 01 00 push $0x10000
80102f17: 68 d8 00 00 00 push $0xd8
80102f1c: e8 6b ff ff ff call 80102e8c <lapicw>
80102f21: 83 c4 08 add $0x8,%esp
// Disable performance counter overflow interrupts
// on machines that provide that interrupt entry.
if(((lapic[VER]>>16) & 0xFF) >= 4)
80102f24: a1 5c 32 11 80 mov 0x8011325c,%eax
80102f29: 83 c0 30 add $0x30,%eax
80102f2c: 8b 00 mov (%eax),%eax
80102f2e: c1 e8 10 shr $0x10,%eax
80102f31: 0f b6 c0 movzbl %al,%eax
80102f34: 83 f8 03 cmp $0x3,%eax
80102f37: 76 12 jbe 80102f4b <lapicinit+0x9d>
lapicw(PCINT, MASKED);
80102f39: 68 00 00 01 00 push $0x10000
80102f3e: 68 d0 00 00 00 push $0xd0
80102f43: e8 44 ff ff ff call 80102e8c <lapicw>
80102f48: 83 c4 08 add $0x8,%esp
// Map error interrupt to IRQ_ERROR.
lapicw(ERROR, T_IRQ0 + IRQ_ERROR);
80102f4b: 6a 33 push $0x33
80102f4d: 68 dc 00 00 00 push $0xdc
80102f52: e8 35 ff ff ff call 80102e8c <lapicw>
80102f57: 83 c4 08 add $0x8,%esp
// Clear error status register (requires back-to-back writes).
lapicw(ESR, 0);
80102f5a: 6a 00 push $0x0
80102f5c: 68 a0 00 00 00 push $0xa0
80102f61: e8 26 ff ff ff call 80102e8c <lapicw>
80102f66: 83 c4 08 add $0x8,%esp
lapicw(ESR, 0);
80102f69: 6a 00 push $0x0
80102f6b: 68 a0 00 00 00 push $0xa0
80102f70: e8 17 ff ff ff call 80102e8c <lapicw>
80102f75: 83 c4 08 add $0x8,%esp
// Ack any outstanding interrupts.
lapicw(EOI, 0);
80102f78: 6a 00 push $0x0
80102f7a: 6a 2c push $0x2c
80102f7c: e8 0b ff ff ff call 80102e8c <lapicw>
80102f81: 83 c4 08 add $0x8,%esp
// Send an Init Level De-Assert to synchronise arbitration ID's.
lapicw(ICRHI, 0);
80102f84: 6a 00 push $0x0
80102f86: 68 c4 00 00 00 push $0xc4
80102f8b: e8 fc fe ff ff call 80102e8c <lapicw>
80102f90: 83 c4 08 add $0x8,%esp
lapicw(ICRLO, BCAST | INIT | LEVEL);
80102f93: 68 00 85 08 00 push $0x88500
80102f98: 68 c0 00 00 00 push $0xc0
80102f9d: e8 ea fe ff ff call 80102e8c <lapicw>
80102fa2: 83 c4 08 add $0x8,%esp
while(lapic[ICRLO] & DELIVS)
80102fa5: 90 nop
80102fa6: a1 5c 32 11 80 mov 0x8011325c,%eax
80102fab: 05 00 03 00 00 add $0x300,%eax
80102fb0: 8b 00 mov (%eax),%eax
80102fb2: 25 00 10 00 00 and $0x1000,%eax
80102fb7: 85 c0 test %eax,%eax
80102fb9: 75 eb jne 80102fa6 <lapicinit+0xf8>
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
80102fbb: 6a 00 push $0x0
80102fbd: 6a 20 push $0x20
80102fbf: e8 c8 fe ff ff call 80102e8c <lapicw>
80102fc4: 83 c4 08 add $0x8,%esp
80102fc7: eb 01 jmp 80102fca <lapicinit+0x11c>
void
lapicinit(void)
{
if(!lapic)
return;
80102fc9: 90 nop
while(lapic[ICRLO] & DELIVS)
;
// Enable interrupts on the APIC (but not on the processor).
lapicw(TPR, 0);
}
80102fca: c9 leave
80102fcb: c3 ret
80102fcc <cpunum>:
int
cpunum(void)
{
80102fcc: 55 push %ebp
80102fcd: 89 e5 mov %esp,%ebp
80102fcf: 83 ec 08 sub $0x8,%esp
// Cannot call cpu when interrupts are enabled:
// result not guaranteed to last long enough to be used!
// Would prefer to panic but even printing is chancy here:
// almost everything, including cprintf and panic, calls cpu,
// often indirectly through acquire and release.
if(readeflags()&FL_IF){
80102fd2: e8 a5 fe ff ff call 80102e7c <readeflags>
80102fd7: 25 00 02 00 00 and $0x200,%eax
80102fdc: 85 c0 test %eax,%eax
80102fde: 74 26 je 80103006 <cpunum+0x3a>
static int n;
if(n++ == 0)
80102fe0: a1 40 c6 10 80 mov 0x8010c640,%eax
80102fe5: 8d 50 01 lea 0x1(%eax),%edx
80102fe8: 89 15 40 c6 10 80 mov %edx,0x8010c640
80102fee: 85 c0 test %eax,%eax
80102ff0: 75 14 jne 80103006 <cpunum+0x3a>
cprintf("cpu called from %x with interrupts enabled\n",
80102ff2: 8b 45 04 mov 0x4(%ebp),%eax
80102ff5: 83 ec 08 sub $0x8,%esp
80102ff8: 50 push %eax
80102ff9: 68 b4 8d 10 80 push $0x80108db4
80102ffe: e8 c3 d3 ff ff call 801003c6 <cprintf>
80103003: 83 c4 10 add $0x10,%esp
__builtin_return_address(0));
}
if(lapic)
80103006: a1 5c 32 11 80 mov 0x8011325c,%eax
8010300b: 85 c0 test %eax,%eax
8010300d: 74 0f je 8010301e <cpunum+0x52>
return lapic[ID]>>24;
8010300f: a1 5c 32 11 80 mov 0x8011325c,%eax
80103014: 83 c0 20 add $0x20,%eax
80103017: 8b 00 mov (%eax),%eax
80103019: c1 e8 18 shr $0x18,%eax
8010301c: eb 05 jmp 80103023 <cpunum+0x57>
return 0;
8010301e: b8 00 00 00 00 mov $0x0,%eax
}
80103023: c9 leave
80103024: c3 ret
80103025 <lapiceoi>:
// Acknowledge interrupt.
void
lapiceoi(void)
{
80103025: 55 push %ebp
80103026: 89 e5 mov %esp,%ebp
if(lapic)
80103028: a1 5c 32 11 80 mov 0x8011325c,%eax
8010302d: 85 c0 test %eax,%eax
8010302f: 74 0c je 8010303d <lapiceoi+0x18>
lapicw(EOI, 0);
80103031: 6a 00 push $0x0
80103033: 6a 2c push $0x2c
80103035: e8 52 fe ff ff call 80102e8c <lapicw>
8010303a: 83 c4 08 add $0x8,%esp
}
8010303d: 90 nop
8010303e: c9 leave
8010303f: c3 ret
80103040 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
80103040: 55 push %ebp
80103041: 89 e5 mov %esp,%ebp
}
80103043: 90 nop
80103044: 5d pop %ebp
80103045: c3 ret
80103046 <lapicstartap>:
// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
80103046: 55 push %ebp
80103047: 89 e5 mov %esp,%ebp
80103049: 83 ec 14 sub $0x14,%esp
8010304c: 8b 45 08 mov 0x8(%ebp),%eax
8010304f: 88 45 ec mov %al,-0x14(%ebp)
ushort *wrv;
// "The BSP must initialize CMOS shutdown code to 0AH
// and the warm reset vector (DWORD based at 40:67) to point at
// the AP startup code prior to the [universal startup algorithm]."
outb(CMOS_PORT, 0xF); // offset 0xF is shutdown code
80103052: 6a 0f push $0xf
80103054: 6a 70 push $0x70
80103056: e8 02 fe ff ff call 80102e5d <outb>
8010305b: 83 c4 08 add $0x8,%esp
outb(CMOS_PORT+1, 0x0A);
8010305e: 6a 0a push $0xa
80103060: 6a 71 push $0x71
80103062: e8 f6 fd ff ff call 80102e5d <outb>
80103067: 83 c4 08 add $0x8,%esp
wrv = (ushort*)P2V((0x40<<4 | 0x67)); // Warm reset vector
8010306a: c7 45 f8 67 04 00 80 movl $0x80000467,-0x8(%ebp)
wrv[0] = 0;
80103071: 8b 45 f8 mov -0x8(%ebp),%eax
80103074: 66 c7 00 00 00 movw $0x0,(%eax)
wrv[1] = addr >> 4;
80103079: 8b 45 f8 mov -0x8(%ebp),%eax
8010307c: 83 c0 02 add $0x2,%eax
8010307f: 8b 55 0c mov 0xc(%ebp),%edx
80103082: c1 ea 04 shr $0x4,%edx
80103085: 66 89 10 mov %dx,(%eax)
// "Universal startup algorithm."
// Send INIT (level-triggered) interrupt to reset other CPU.
lapicw(ICRHI, apicid<<24);
80103088: 0f b6 45 ec movzbl -0x14(%ebp),%eax
8010308c: c1 e0 18 shl $0x18,%eax
8010308f: 50 push %eax
80103090: 68 c4 00 00 00 push $0xc4
80103095: e8 f2 fd ff ff call 80102e8c <lapicw>
8010309a: 83 c4 08 add $0x8,%esp
lapicw(ICRLO, INIT | LEVEL | ASSERT);
8010309d: 68 00 c5 00 00 push $0xc500
801030a2: 68 c0 00 00 00 push $0xc0
801030a7: e8 e0 fd ff ff call 80102e8c <lapicw>
801030ac: 83 c4 08 add $0x8,%esp
microdelay(200);
801030af: 68 c8 00 00 00 push $0xc8
801030b4: e8 87 ff ff ff call 80103040 <microdelay>
801030b9: 83 c4 04 add $0x4,%esp
lapicw(ICRLO, INIT | LEVEL);
801030bc: 68 00 85 00 00 push $0x8500
801030c1: 68 c0 00 00 00 push $0xc0
801030c6: e8 c1 fd ff ff call 80102e8c <lapicw>
801030cb: 83 c4 08 add $0x8,%esp
microdelay(100); // should be 10ms, but too slow in Bochs!
801030ce: 6a 64 push $0x64
801030d0: e8 6b ff ff ff call 80103040 <microdelay>
801030d5: 83 c4 04 add $0x4,%esp
// Send startup IPI (twice!) to enter code.
// Regular hardware is supposed to only accept a STARTUP
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
801030d8: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
801030df: eb 3d jmp 8010311e <lapicstartap+0xd8>
lapicw(ICRHI, apicid<<24);
801030e1: 0f b6 45 ec movzbl -0x14(%ebp),%eax
801030e5: c1 e0 18 shl $0x18,%eax
801030e8: 50 push %eax
801030e9: 68 c4 00 00 00 push $0xc4
801030ee: e8 99 fd ff ff call 80102e8c <lapicw>
801030f3: 83 c4 08 add $0x8,%esp
lapicw(ICRLO, STARTUP | (addr>>12));
801030f6: 8b 45 0c mov 0xc(%ebp),%eax
801030f9: c1 e8 0c shr $0xc,%eax
801030fc: 80 cc 06 or $0x6,%ah
801030ff: 50 push %eax
80103100: 68 c0 00 00 00 push $0xc0
80103105: e8 82 fd ff ff call 80102e8c <lapicw>
8010310a: 83 c4 08 add $0x8,%esp
microdelay(200);
8010310d: 68 c8 00 00 00 push $0xc8
80103112: e8 29 ff ff ff call 80103040 <microdelay>
80103117: 83 c4 04 add $0x4,%esp
// Send startup IPI (twice!) to enter code.
// Regular hardware is supposed to only accept a STARTUP
// when it is in the halted state due to an INIT. So the second
// should be ignored, but it is part of the official Intel algorithm.
// Bochs complains about the second one. Too bad for Bochs.
for(i = 0; i < 2; i++){
8010311a: 83 45 fc 01 addl $0x1,-0x4(%ebp)
8010311e: 83 7d fc 01 cmpl $0x1,-0x4(%ebp)
80103122: 7e bd jle 801030e1 <lapicstartap+0x9b>
lapicw(ICRHI, apicid<<24);
lapicw(ICRLO, STARTUP | (addr>>12));
microdelay(200);
}
}
80103124: 90 nop
80103125: c9 leave
80103126: c3 ret
80103127 <cmos_read>:
#define DAY 0x07
#define MONTH 0x08
#define YEAR 0x09
static uint cmos_read(uint reg)
{
80103127: 55 push %ebp
80103128: 89 e5 mov %esp,%ebp
outb(CMOS_PORT, reg);
8010312a: 8b 45 08 mov 0x8(%ebp),%eax
8010312d: 0f b6 c0 movzbl %al,%eax
80103130: 50 push %eax
80103131: 6a 70 push $0x70
80103133: e8 25 fd ff ff call 80102e5d <outb>
80103138: 83 c4 08 add $0x8,%esp
microdelay(200);
8010313b: 68 c8 00 00 00 push $0xc8
80103140: e8 fb fe ff ff call 80103040 <microdelay>
80103145: 83 c4 04 add $0x4,%esp
return inb(CMOS_RETURN);
80103148: 6a 71 push $0x71
8010314a: e8 f1 fc ff ff call 80102e40 <inb>
8010314f: 83 c4 04 add $0x4,%esp
80103152: 0f b6 c0 movzbl %al,%eax
}
80103155: c9 leave
80103156: c3 ret
80103157 <fill_rtcdate>:
static void fill_rtcdate(struct rtcdate *r)
{
80103157: 55 push %ebp
80103158: 89 e5 mov %esp,%ebp
r->second = cmos_read(SECS);
8010315a: 6a 00 push $0x0
8010315c: e8 c6 ff ff ff call 80103127 <cmos_read>
80103161: 83 c4 04 add $0x4,%esp
80103164: 89 c2 mov %eax,%edx
80103166: 8b 45 08 mov 0x8(%ebp),%eax
80103169: 89 10 mov %edx,(%eax)
r->minute = cmos_read(MINS);
8010316b: 6a 02 push $0x2
8010316d: e8 b5 ff ff ff call 80103127 <cmos_read>
80103172: 83 c4 04 add $0x4,%esp
80103175: 89 c2 mov %eax,%edx
80103177: 8b 45 08 mov 0x8(%ebp),%eax
8010317a: 89 50 04 mov %edx,0x4(%eax)
r->hour = cmos_read(HOURS);
8010317d: 6a 04 push $0x4
8010317f: e8 a3 ff ff ff call 80103127 <cmos_read>
80103184: 83 c4 04 add $0x4,%esp
80103187: 89 c2 mov %eax,%edx
80103189: 8b 45 08 mov 0x8(%ebp),%eax
8010318c: 89 50 08 mov %edx,0x8(%eax)
r->day = cmos_read(DAY);
8010318f: 6a 07 push $0x7
80103191: e8 91 ff ff ff call 80103127 <cmos_read>
80103196: 83 c4 04 add $0x4,%esp
80103199: 89 c2 mov %eax,%edx
8010319b: 8b 45 08 mov 0x8(%ebp),%eax
8010319e: 89 50 0c mov %edx,0xc(%eax)
r->month = cmos_read(MONTH);
801031a1: 6a 08 push $0x8
801031a3: e8 7f ff ff ff call 80103127 <cmos_read>
801031a8: 83 c4 04 add $0x4,%esp
801031ab: 89 c2 mov %eax,%edx
801031ad: 8b 45 08 mov 0x8(%ebp),%eax
801031b0: 89 50 10 mov %edx,0x10(%eax)
r->year = cmos_read(YEAR);
801031b3: 6a 09 push $0x9
801031b5: e8 6d ff ff ff call 80103127 <cmos_read>
801031ba: 83 c4 04 add $0x4,%esp
801031bd: 89 c2 mov %eax,%edx
801031bf: 8b 45 08 mov 0x8(%ebp),%eax
801031c2: 89 50 14 mov %edx,0x14(%eax)
}
801031c5: 90 nop
801031c6: c9 leave
801031c7: c3 ret
801031c8 <cmostime>:
// qemu seems to use 24-hour GWT and the values are BCD encoded
void cmostime(struct rtcdate *r)
{
801031c8: 55 push %ebp
801031c9: 89 e5 mov %esp,%ebp
801031cb: 83 ec 48 sub $0x48,%esp
struct rtcdate t1, t2;
int sb, bcd;
sb = cmos_read(CMOS_STATB);
801031ce: 6a 0b push $0xb
801031d0: e8 52 ff ff ff call 80103127 <cmos_read>
801031d5: 83 c4 04 add $0x4,%esp
801031d8: 89 45 f4 mov %eax,-0xc(%ebp)
bcd = (sb & (1 << 2)) == 0;
801031db: 8b 45 f4 mov -0xc(%ebp),%eax
801031de: 83 e0 04 and $0x4,%eax
801031e1: 85 c0 test %eax,%eax
801031e3: 0f 94 c0 sete %al
801031e6: 0f b6 c0 movzbl %al,%eax
801031e9: 89 45 f0 mov %eax,-0x10(%ebp)
// make sure CMOS doesn't modify time while we read it
for (;;) {
fill_rtcdate(&t1);
801031ec: 8d 45 d8 lea -0x28(%ebp),%eax
801031ef: 50 push %eax
801031f0: e8 62 ff ff ff call 80103157 <fill_rtcdate>
801031f5: 83 c4 04 add $0x4,%esp
if (cmos_read(CMOS_STATA) & CMOS_UIP)
801031f8: 6a 0a push $0xa
801031fa: e8 28 ff ff ff call 80103127 <cmos_read>
801031ff: 83 c4 04 add $0x4,%esp
80103202: 25 80 00 00 00 and $0x80,%eax
80103207: 85 c0 test %eax,%eax
80103209: 75 27 jne 80103232 <cmostime+0x6a>
continue;
fill_rtcdate(&t2);
8010320b: 8d 45 c0 lea -0x40(%ebp),%eax
8010320e: 50 push %eax
8010320f: e8 43 ff ff ff call 80103157 <fill_rtcdate>
80103214: 83 c4 04 add $0x4,%esp
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
80103217: 83 ec 04 sub $0x4,%esp
8010321a: 6a 18 push $0x18
8010321c: 8d 45 c0 lea -0x40(%ebp),%eax
8010321f: 50 push %eax
80103220: 8d 45 d8 lea -0x28(%ebp),%eax
80103223: 50 push %eax
80103224: e8 de 26 00 00 call 80105907 <memcmp>
80103229: 83 c4 10 add $0x10,%esp
8010322c: 85 c0 test %eax,%eax
8010322e: 74 05 je 80103235 <cmostime+0x6d>
80103230: eb ba jmp 801031ec <cmostime+0x24>
// make sure CMOS doesn't modify time while we read it
for (;;) {
fill_rtcdate(&t1);
if (cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
80103232: 90 nop
fill_rtcdate(&t2);
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
break;
}
80103233: eb b7 jmp 801031ec <cmostime+0x24>
fill_rtcdate(&t1);
if (cmos_read(CMOS_STATA) & CMOS_UIP)
continue;
fill_rtcdate(&t2);
if (memcmp(&t1, &t2, sizeof(t1)) == 0)
break;
80103235: 90 nop
}
// convert
if (bcd) {
80103236: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010323a: 0f 84 b4 00 00 00 je 801032f4 <cmostime+0x12c>
#define CONV(x) (t1.x = ((t1.x >> 4) * 10) + (t1.x & 0xf))
CONV(second);
80103240: 8b 45 d8 mov -0x28(%ebp),%eax
80103243: c1 e8 04 shr $0x4,%eax
80103246: 89 c2 mov %eax,%edx
80103248: 89 d0 mov %edx,%eax
8010324a: c1 e0 02 shl $0x2,%eax
8010324d: 01 d0 add %edx,%eax
8010324f: 01 c0 add %eax,%eax
80103251: 89 c2 mov %eax,%edx
80103253: 8b 45 d8 mov -0x28(%ebp),%eax
80103256: 83 e0 0f and $0xf,%eax
80103259: 01 d0 add %edx,%eax
8010325b: 89 45 d8 mov %eax,-0x28(%ebp)
CONV(minute);
8010325e: 8b 45 dc mov -0x24(%ebp),%eax
80103261: c1 e8 04 shr $0x4,%eax
80103264: 89 c2 mov %eax,%edx
80103266: 89 d0 mov %edx,%eax
80103268: c1 e0 02 shl $0x2,%eax
8010326b: 01 d0 add %edx,%eax
8010326d: 01 c0 add %eax,%eax
8010326f: 89 c2 mov %eax,%edx
80103271: 8b 45 dc mov -0x24(%ebp),%eax
80103274: 83 e0 0f and $0xf,%eax
80103277: 01 d0 add %edx,%eax
80103279: 89 45 dc mov %eax,-0x24(%ebp)
CONV(hour );
8010327c: 8b 45 e0 mov -0x20(%ebp),%eax
8010327f: c1 e8 04 shr $0x4,%eax
80103282: 89 c2 mov %eax,%edx
80103284: 89 d0 mov %edx,%eax
80103286: c1 e0 02 shl $0x2,%eax
80103289: 01 d0 add %edx,%eax
8010328b: 01 c0 add %eax,%eax
8010328d: 89 c2 mov %eax,%edx
8010328f: 8b 45 e0 mov -0x20(%ebp),%eax
80103292: 83 e0 0f and $0xf,%eax
80103295: 01 d0 add %edx,%eax
80103297: 89 45 e0 mov %eax,-0x20(%ebp)
CONV(day );
8010329a: 8b 45 e4 mov -0x1c(%ebp),%eax
8010329d: c1 e8 04 shr $0x4,%eax
801032a0: 89 c2 mov %eax,%edx
801032a2: 89 d0 mov %edx,%eax
801032a4: c1 e0 02 shl $0x2,%eax
801032a7: 01 d0 add %edx,%eax
801032a9: 01 c0 add %eax,%eax
801032ab: 89 c2 mov %eax,%edx
801032ad: 8b 45 e4 mov -0x1c(%ebp),%eax
801032b0: 83 e0 0f and $0xf,%eax
801032b3: 01 d0 add %edx,%eax
801032b5: 89 45 e4 mov %eax,-0x1c(%ebp)
CONV(month );
801032b8: 8b 45 e8 mov -0x18(%ebp),%eax
801032bb: c1 e8 04 shr $0x4,%eax
801032be: 89 c2 mov %eax,%edx
801032c0: 89 d0 mov %edx,%eax
801032c2: c1 e0 02 shl $0x2,%eax
801032c5: 01 d0 add %edx,%eax
801032c7: 01 c0 add %eax,%eax
801032c9: 89 c2 mov %eax,%edx
801032cb: 8b 45 e8 mov -0x18(%ebp),%eax
801032ce: 83 e0 0f and $0xf,%eax
801032d1: 01 d0 add %edx,%eax
801032d3: 89 45 e8 mov %eax,-0x18(%ebp)
CONV(year );
801032d6: 8b 45 ec mov -0x14(%ebp),%eax
801032d9: c1 e8 04 shr $0x4,%eax
801032dc: 89 c2 mov %eax,%edx
801032de: 89 d0 mov %edx,%eax
801032e0: c1 e0 02 shl $0x2,%eax
801032e3: 01 d0 add %edx,%eax
801032e5: 01 c0 add %eax,%eax
801032e7: 89 c2 mov %eax,%edx
801032e9: 8b 45 ec mov -0x14(%ebp),%eax
801032ec: 83 e0 0f and $0xf,%eax
801032ef: 01 d0 add %edx,%eax
801032f1: 89 45 ec mov %eax,-0x14(%ebp)
#undef CONV
}
*r = t1;
801032f4: 8b 45 08 mov 0x8(%ebp),%eax
801032f7: 8b 55 d8 mov -0x28(%ebp),%edx
801032fa: 89 10 mov %edx,(%eax)
801032fc: 8b 55 dc mov -0x24(%ebp),%edx
801032ff: 89 50 04 mov %edx,0x4(%eax)
80103302: 8b 55 e0 mov -0x20(%ebp),%edx
80103305: 89 50 08 mov %edx,0x8(%eax)
80103308: 8b 55 e4 mov -0x1c(%ebp),%edx
8010330b: 89 50 0c mov %edx,0xc(%eax)
8010330e: 8b 55 e8 mov -0x18(%ebp),%edx
80103311: 89 50 10 mov %edx,0x10(%eax)
80103314: 8b 55 ec mov -0x14(%ebp),%edx
80103317: 89 50 14 mov %edx,0x14(%eax)
r->year += 2000;
8010331a: 8b 45 08 mov 0x8(%ebp),%eax
8010331d: 8b 40 14 mov 0x14(%eax),%eax
80103320: 8d 90 d0 07 00 00 lea 0x7d0(%eax),%edx
80103326: 8b 45 08 mov 0x8(%ebp),%eax
80103329: 89 50 14 mov %edx,0x14(%eax)
}
8010332c: 90 nop
8010332d: c9 leave
8010332e: c3 ret
8010332f <initlog>:
static void recover_from_log(void);
static void commit();
void
initlog(int dev)
{
8010332f: 55 push %ebp
80103330: 89 e5 mov %esp,%ebp
80103332: 83 ec 28 sub $0x28,%esp
if (sizeof(struct logheader) >= BSIZE)
panic("initlog: too big logheader");
struct superblock sb;
initlock(&log.lock, "log");
80103335: 83 ec 08 sub $0x8,%esp
80103338: 68 e0 8d 10 80 push $0x80108de0
8010333d: 68 60 32 11 80 push $0x80113260
80103342: e8 d4 22 00 00 call 8010561b <initlock>
80103347: 83 c4 10 add $0x10,%esp
readsb(dev, &sb);
8010334a: 83 ec 08 sub $0x8,%esp
8010334d: 8d 45 dc lea -0x24(%ebp),%eax
80103350: 50 push %eax
80103351: ff 75 08 pushl 0x8(%ebp)
80103354: e8 2b e0 ff ff call 80101384 <readsb>
80103359: 83 c4 10 add $0x10,%esp
log.start = sb.logstart;
8010335c: 8b 45 ec mov -0x14(%ebp),%eax
8010335f: a3 94 32 11 80 mov %eax,0x80113294
log.size = sb.nlog;
80103364: 8b 45 e8 mov -0x18(%ebp),%eax
80103367: a3 98 32 11 80 mov %eax,0x80113298
log.dev = dev;
8010336c: 8b 45 08 mov 0x8(%ebp),%eax
8010336f: a3 a4 32 11 80 mov %eax,0x801132a4
recover_from_log();
80103374: e8 b2 01 00 00 call 8010352b <recover_from_log>
}
80103379: 90 nop
8010337a: c9 leave
8010337b: c3 ret
8010337c <install_trans>:
// Copy committed blocks from log to their home location
static void
install_trans(void)
{
8010337c: 55 push %ebp
8010337d: 89 e5 mov %esp,%ebp
8010337f: 83 ec 18 sub $0x18,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80103382: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103389: e9 95 00 00 00 jmp 80103423 <install_trans+0xa7>
struct buf *lbuf = bread(log.dev, log.start+tail+1); // read log block
8010338e: 8b 15 94 32 11 80 mov 0x80113294,%edx
80103394: 8b 45 f4 mov -0xc(%ebp),%eax
80103397: 01 d0 add %edx,%eax
80103399: 83 c0 01 add $0x1,%eax
8010339c: 89 c2 mov %eax,%edx
8010339e: a1 a4 32 11 80 mov 0x801132a4,%eax
801033a3: 83 ec 08 sub $0x8,%esp
801033a6: 52 push %edx
801033a7: 50 push %eax
801033a8: e8 09 ce ff ff call 801001b6 <bread>
801033ad: 83 c4 10 add $0x10,%esp
801033b0: 89 45 f0 mov %eax,-0x10(%ebp)
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
801033b3: 8b 45 f4 mov -0xc(%ebp),%eax
801033b6: 83 c0 10 add $0x10,%eax
801033b9: 8b 04 85 6c 32 11 80 mov -0x7feecd94(,%eax,4),%eax
801033c0: 89 c2 mov %eax,%edx
801033c2: a1 a4 32 11 80 mov 0x801132a4,%eax
801033c7: 83 ec 08 sub $0x8,%esp
801033ca: 52 push %edx
801033cb: 50 push %eax
801033cc: e8 e5 cd ff ff call 801001b6 <bread>
801033d1: 83 c4 10 add $0x10,%esp
801033d4: 89 45 ec mov %eax,-0x14(%ebp)
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
801033d7: 8b 45 f0 mov -0x10(%ebp),%eax
801033da: 8d 50 18 lea 0x18(%eax),%edx
801033dd: 8b 45 ec mov -0x14(%ebp),%eax
801033e0: 83 c0 18 add $0x18,%eax
801033e3: 83 ec 04 sub $0x4,%esp
801033e6: 68 00 02 00 00 push $0x200
801033eb: 52 push %edx
801033ec: 50 push %eax
801033ed: e8 6d 25 00 00 call 8010595f <memmove>
801033f2: 83 c4 10 add $0x10,%esp
bwrite(dbuf); // write dst to disk
801033f5: 83 ec 0c sub $0xc,%esp
801033f8: ff 75 ec pushl -0x14(%ebp)
801033fb: e8 ef cd ff ff call 801001ef <bwrite>
80103400: 83 c4 10 add $0x10,%esp
brelse(lbuf);
80103403: 83 ec 0c sub $0xc,%esp
80103406: ff 75 f0 pushl -0x10(%ebp)
80103409: e8 20 ce ff ff call 8010022e <brelse>
8010340e: 83 c4 10 add $0x10,%esp
brelse(dbuf);
80103411: 83 ec 0c sub $0xc,%esp
80103414: ff 75 ec pushl -0x14(%ebp)
80103417: e8 12 ce ff ff call 8010022e <brelse>
8010341c: 83 c4 10 add $0x10,%esp
static void
install_trans(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
8010341f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103423: a1 a8 32 11 80 mov 0x801132a8,%eax
80103428: 3b 45 f4 cmp -0xc(%ebp),%eax
8010342b: 0f 8f 5d ff ff ff jg 8010338e <install_trans+0x12>
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
brelse(lbuf);
brelse(dbuf);
}
}
80103431: 90 nop
80103432: c9 leave
80103433: c3 ret
80103434 <read_head>:
// Read the log header from disk into the in-memory log header
static void
read_head(void)
{
80103434: 55 push %ebp
80103435: 89 e5 mov %esp,%ebp
80103437: 83 ec 18 sub $0x18,%esp
struct buf *buf = bread(log.dev, log.start);
8010343a: a1 94 32 11 80 mov 0x80113294,%eax
8010343f: 89 c2 mov %eax,%edx
80103441: a1 a4 32 11 80 mov 0x801132a4,%eax
80103446: 83 ec 08 sub $0x8,%esp
80103449: 52 push %edx
8010344a: 50 push %eax
8010344b: e8 66 cd ff ff call 801001b6 <bread>
80103450: 83 c4 10 add $0x10,%esp
80103453: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *lh = (struct logheader *) (buf->data);
80103456: 8b 45 f0 mov -0x10(%ebp),%eax
80103459: 83 c0 18 add $0x18,%eax
8010345c: 89 45 ec mov %eax,-0x14(%ebp)
int i;
log.lh.n = lh->n;
8010345f: 8b 45 ec mov -0x14(%ebp),%eax
80103462: 8b 00 mov (%eax),%eax
80103464: a3 a8 32 11 80 mov %eax,0x801132a8
for (i = 0; i < log.lh.n; i++) {
80103469: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80103470: eb 1b jmp 8010348d <read_head+0x59>
log.lh.block[i] = lh->block[i];
80103472: 8b 45 ec mov -0x14(%ebp),%eax
80103475: 8b 55 f4 mov -0xc(%ebp),%edx
80103478: 8b 44 90 04 mov 0x4(%eax,%edx,4),%eax
8010347c: 8b 55 f4 mov -0xc(%ebp),%edx
8010347f: 83 c2 10 add $0x10,%edx
80103482: 89 04 95 6c 32 11 80 mov %eax,-0x7feecd94(,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *lh = (struct logheader *) (buf->data);
int i;
log.lh.n = lh->n;
for (i = 0; i < log.lh.n; i++) {
80103489: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010348d: a1 a8 32 11 80 mov 0x801132a8,%eax
80103492: 3b 45 f4 cmp -0xc(%ebp),%eax
80103495: 7f db jg 80103472 <read_head+0x3e>
log.lh.block[i] = lh->block[i];
}
brelse(buf);
80103497: 83 ec 0c sub $0xc,%esp
8010349a: ff 75 f0 pushl -0x10(%ebp)
8010349d: e8 8c cd ff ff call 8010022e <brelse>
801034a2: 83 c4 10 add $0x10,%esp
}
801034a5: 90 nop
801034a6: c9 leave
801034a7: c3 ret
801034a8 <write_head>:
// Write in-memory log header to disk.
// This is the true point at which the
// current transaction commits.
static void
write_head(void)
{
801034a8: 55 push %ebp
801034a9: 89 e5 mov %esp,%ebp
801034ab: 83 ec 18 sub $0x18,%esp
struct buf *buf = bread(log.dev, log.start);
801034ae: a1 94 32 11 80 mov 0x80113294,%eax
801034b3: 89 c2 mov %eax,%edx
801034b5: a1 a4 32 11 80 mov 0x801132a4,%eax
801034ba: 83 ec 08 sub $0x8,%esp
801034bd: 52 push %edx
801034be: 50 push %eax
801034bf: e8 f2 cc ff ff call 801001b6 <bread>
801034c4: 83 c4 10 add $0x10,%esp
801034c7: 89 45 f0 mov %eax,-0x10(%ebp)
struct logheader *hb = (struct logheader *) (buf->data);
801034ca: 8b 45 f0 mov -0x10(%ebp),%eax
801034cd: 83 c0 18 add $0x18,%eax
801034d0: 89 45 ec mov %eax,-0x14(%ebp)
int i;
hb->n = log.lh.n;
801034d3: 8b 15 a8 32 11 80 mov 0x801132a8,%edx
801034d9: 8b 45 ec mov -0x14(%ebp),%eax
801034dc: 89 10 mov %edx,(%eax)
for (i = 0; i < log.lh.n; i++) {
801034de: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801034e5: eb 1b jmp 80103502 <write_head+0x5a>
hb->block[i] = log.lh.block[i];
801034e7: 8b 45 f4 mov -0xc(%ebp),%eax
801034ea: 83 c0 10 add $0x10,%eax
801034ed: 8b 0c 85 6c 32 11 80 mov -0x7feecd94(,%eax,4),%ecx
801034f4: 8b 45 ec mov -0x14(%ebp),%eax
801034f7: 8b 55 f4 mov -0xc(%ebp),%edx
801034fa: 89 4c 90 04 mov %ecx,0x4(%eax,%edx,4)
{
struct buf *buf = bread(log.dev, log.start);
struct logheader *hb = (struct logheader *) (buf->data);
int i;
hb->n = log.lh.n;
for (i = 0; i < log.lh.n; i++) {
801034fe: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103502: a1 a8 32 11 80 mov 0x801132a8,%eax
80103507: 3b 45 f4 cmp -0xc(%ebp),%eax
8010350a: 7f db jg 801034e7 <write_head+0x3f>
hb->block[i] = log.lh.block[i];
}
bwrite(buf);
8010350c: 83 ec 0c sub $0xc,%esp
8010350f: ff 75 f0 pushl -0x10(%ebp)
80103512: e8 d8 cc ff ff call 801001ef <bwrite>
80103517: 83 c4 10 add $0x10,%esp
brelse(buf);
8010351a: 83 ec 0c sub $0xc,%esp
8010351d: ff 75 f0 pushl -0x10(%ebp)
80103520: e8 09 cd ff ff call 8010022e <brelse>
80103525: 83 c4 10 add $0x10,%esp
}
80103528: 90 nop
80103529: c9 leave
8010352a: c3 ret
8010352b <recover_from_log>:
static void
recover_from_log(void)
{
8010352b: 55 push %ebp
8010352c: 89 e5 mov %esp,%ebp
8010352e: 83 ec 08 sub $0x8,%esp
read_head();
80103531: e8 fe fe ff ff call 80103434 <read_head>
install_trans(); // if committed, copy from log to disk
80103536: e8 41 fe ff ff call 8010337c <install_trans>
log.lh.n = 0;
8010353b: c7 05 a8 32 11 80 00 movl $0x0,0x801132a8
80103542: 00 00 00
write_head(); // clear the log
80103545: e8 5e ff ff ff call 801034a8 <write_head>
}
8010354a: 90 nop
8010354b: c9 leave
8010354c: c3 ret
8010354d <begin_op>:
// called at the start of each FS system call.
void
begin_op(void)
{
8010354d: 55 push %ebp
8010354e: 89 e5 mov %esp,%ebp
80103550: 83 ec 08 sub $0x8,%esp
acquire(&log.lock);
80103553: 83 ec 0c sub $0xc,%esp
80103556: 68 60 32 11 80 push $0x80113260
8010355b: e8 dd 20 00 00 call 8010563d <acquire>
80103560: 83 c4 10 add $0x10,%esp
while(1){
if(log.committing){
80103563: a1 a0 32 11 80 mov 0x801132a0,%eax
80103568: 85 c0 test %eax,%eax
8010356a: 74 17 je 80103583 <begin_op+0x36>
sleep(&log, &log.lock);
8010356c: 83 ec 08 sub $0x8,%esp
8010356f: 68 60 32 11 80 push $0x80113260
80103574: 68 60 32 11 80 push $0x80113260
80103579: e8 bd 1d 00 00 call 8010533b <sleep>
8010357e: 83 c4 10 add $0x10,%esp
80103581: eb e0 jmp 80103563 <begin_op+0x16>
} else if(log.lh.n + (log.outstanding+1)*MAXOPBLOCKS > LOGSIZE){
80103583: 8b 0d a8 32 11 80 mov 0x801132a8,%ecx
80103589: a1 9c 32 11 80 mov 0x8011329c,%eax
8010358e: 8d 50 01 lea 0x1(%eax),%edx
80103591: 89 d0 mov %edx,%eax
80103593: c1 e0 02 shl $0x2,%eax
80103596: 01 d0 add %edx,%eax
80103598: 01 c0 add %eax,%eax
8010359a: 01 c8 add %ecx,%eax
8010359c: 83 f8 1e cmp $0x1e,%eax
8010359f: 7e 17 jle 801035b8 <begin_op+0x6b>
// this op might exhaust log space; wait for commit.
sleep(&log, &log.lock);
801035a1: 83 ec 08 sub $0x8,%esp
801035a4: 68 60 32 11 80 push $0x80113260
801035a9: 68 60 32 11 80 push $0x80113260
801035ae: e8 88 1d 00 00 call 8010533b <sleep>
801035b3: 83 c4 10 add $0x10,%esp
801035b6: eb ab jmp 80103563 <begin_op+0x16>
} else {
log.outstanding += 1;
801035b8: a1 9c 32 11 80 mov 0x8011329c,%eax
801035bd: 83 c0 01 add $0x1,%eax
801035c0: a3 9c 32 11 80 mov %eax,0x8011329c
release(&log.lock);
801035c5: 83 ec 0c sub $0xc,%esp
801035c8: 68 60 32 11 80 push $0x80113260
801035cd: e8 d2 20 00 00 call 801056a4 <release>
801035d2: 83 c4 10 add $0x10,%esp
break;
801035d5: 90 nop
}
}
}
801035d6: 90 nop
801035d7: c9 leave
801035d8: c3 ret
801035d9 <end_op>:
// called at the end of each FS system call.
// commits if this was the last outstanding operation.
void
end_op(void)
{
801035d9: 55 push %ebp
801035da: 89 e5 mov %esp,%ebp
801035dc: 83 ec 18 sub $0x18,%esp
int do_commit = 0;
801035df: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
acquire(&log.lock);
801035e6: 83 ec 0c sub $0xc,%esp
801035e9: 68 60 32 11 80 push $0x80113260
801035ee: e8 4a 20 00 00 call 8010563d <acquire>
801035f3: 83 c4 10 add $0x10,%esp
log.outstanding -= 1;
801035f6: a1 9c 32 11 80 mov 0x8011329c,%eax
801035fb: 83 e8 01 sub $0x1,%eax
801035fe: a3 9c 32 11 80 mov %eax,0x8011329c
if(log.committing)
80103603: a1 a0 32 11 80 mov 0x801132a0,%eax
80103608: 85 c0 test %eax,%eax
8010360a: 74 0d je 80103619 <end_op+0x40>
panic("log.committing");
8010360c: 83 ec 0c sub $0xc,%esp
8010360f: 68 e4 8d 10 80 push $0x80108de4
80103614: e8 4d cf ff ff call 80100566 <panic>
if(log.outstanding == 0){
80103619: a1 9c 32 11 80 mov 0x8011329c,%eax
8010361e: 85 c0 test %eax,%eax
80103620: 75 13 jne 80103635 <end_op+0x5c>
do_commit = 1;
80103622: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp)
log.committing = 1;
80103629: c7 05 a0 32 11 80 01 movl $0x1,0x801132a0
80103630: 00 00 00
80103633: eb 10 jmp 80103645 <end_op+0x6c>
} else {
// begin_op() may be waiting for log space.
wakeup(&log);
80103635: 83 ec 0c sub $0xc,%esp
80103638: 68 60 32 11 80 push $0x80113260
8010363d: e8 e7 1d 00 00 call 80105429 <wakeup>
80103642: 83 c4 10 add $0x10,%esp
}
release(&log.lock);
80103645: 83 ec 0c sub $0xc,%esp
80103648: 68 60 32 11 80 push $0x80113260
8010364d: e8 52 20 00 00 call 801056a4 <release>
80103652: 83 c4 10 add $0x10,%esp
if(do_commit){
80103655: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103659: 74 3f je 8010369a <end_op+0xc1>
// call commit w/o holding locks, since not allowed
// to sleep with locks.
commit();
8010365b: e8 f5 00 00 00 call 80103755 <commit>
acquire(&log.lock);
80103660: 83 ec 0c sub $0xc,%esp
80103663: 68 60 32 11 80 push $0x80113260
80103668: e8 d0 1f 00 00 call 8010563d <acquire>
8010366d: 83 c4 10 add $0x10,%esp
log.committing = 0;
80103670: c7 05 a0 32 11 80 00 movl $0x0,0x801132a0
80103677: 00 00 00
wakeup(&log);
8010367a: 83 ec 0c sub $0xc,%esp
8010367d: 68 60 32 11 80 push $0x80113260
80103682: e8 a2 1d 00 00 call 80105429 <wakeup>
80103687: 83 c4 10 add $0x10,%esp
release(&log.lock);
8010368a: 83 ec 0c sub $0xc,%esp
8010368d: 68 60 32 11 80 push $0x80113260
80103692: e8 0d 20 00 00 call 801056a4 <release>
80103697: 83 c4 10 add $0x10,%esp
}
}
8010369a: 90 nop
8010369b: c9 leave
8010369c: c3 ret
8010369d <write_log>:
// Copy modified blocks from cache to log.
static void
write_log(void)
{
8010369d: 55 push %ebp
8010369e: 89 e5 mov %esp,%ebp
801036a0: 83 ec 18 sub $0x18,%esp
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
801036a3: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801036aa: e9 95 00 00 00 jmp 80103744 <write_log+0xa7>
struct buf *to = bread(log.dev, log.start+tail+1); // log block
801036af: 8b 15 94 32 11 80 mov 0x80113294,%edx
801036b5: 8b 45 f4 mov -0xc(%ebp),%eax
801036b8: 01 d0 add %edx,%eax
801036ba: 83 c0 01 add $0x1,%eax
801036bd: 89 c2 mov %eax,%edx
801036bf: a1 a4 32 11 80 mov 0x801132a4,%eax
801036c4: 83 ec 08 sub $0x8,%esp
801036c7: 52 push %edx
801036c8: 50 push %eax
801036c9: e8 e8 ca ff ff call 801001b6 <bread>
801036ce: 83 c4 10 add $0x10,%esp
801036d1: 89 45 f0 mov %eax,-0x10(%ebp)
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
801036d4: 8b 45 f4 mov -0xc(%ebp),%eax
801036d7: 83 c0 10 add $0x10,%eax
801036da: 8b 04 85 6c 32 11 80 mov -0x7feecd94(,%eax,4),%eax
801036e1: 89 c2 mov %eax,%edx
801036e3: a1 a4 32 11 80 mov 0x801132a4,%eax
801036e8: 83 ec 08 sub $0x8,%esp
801036eb: 52 push %edx
801036ec: 50 push %eax
801036ed: e8 c4 ca ff ff call 801001b6 <bread>
801036f2: 83 c4 10 add $0x10,%esp
801036f5: 89 45 ec mov %eax,-0x14(%ebp)
memmove(to->data, from->data, BSIZE);
801036f8: 8b 45 ec mov -0x14(%ebp),%eax
801036fb: 8d 50 18 lea 0x18(%eax),%edx
801036fe: 8b 45 f0 mov -0x10(%ebp),%eax
80103701: 83 c0 18 add $0x18,%eax
80103704: 83 ec 04 sub $0x4,%esp
80103707: 68 00 02 00 00 push $0x200
8010370c: 52 push %edx
8010370d: 50 push %eax
8010370e: e8 4c 22 00 00 call 8010595f <memmove>
80103713: 83 c4 10 add $0x10,%esp
bwrite(to); // write the log
80103716: 83 ec 0c sub $0xc,%esp
80103719: ff 75 f0 pushl -0x10(%ebp)
8010371c: e8 ce ca ff ff call 801001ef <bwrite>
80103721: 83 c4 10 add $0x10,%esp
brelse(from);
80103724: 83 ec 0c sub $0xc,%esp
80103727: ff 75 ec pushl -0x14(%ebp)
8010372a: e8 ff ca ff ff call 8010022e <brelse>
8010372f: 83 c4 10 add $0x10,%esp
brelse(to);
80103732: 83 ec 0c sub $0xc,%esp
80103735: ff 75 f0 pushl -0x10(%ebp)
80103738: e8 f1 ca ff ff call 8010022e <brelse>
8010373d: 83 c4 10 add $0x10,%esp
static void
write_log(void)
{
int tail;
for (tail = 0; tail < log.lh.n; tail++) {
80103740: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103744: a1 a8 32 11 80 mov 0x801132a8,%eax
80103749: 3b 45 f4 cmp -0xc(%ebp),%eax
8010374c: 0f 8f 5d ff ff ff jg 801036af <write_log+0x12>
memmove(to->data, from->data, BSIZE);
bwrite(to); // write the log
brelse(from);
brelse(to);
}
}
80103752: 90 nop
80103753: c9 leave
80103754: c3 ret
80103755 <commit>:
static void
commit()
{
80103755: 55 push %ebp
80103756: 89 e5 mov %esp,%ebp
80103758: 83 ec 08 sub $0x8,%esp
if (log.lh.n > 0) {
8010375b: a1 a8 32 11 80 mov 0x801132a8,%eax
80103760: 85 c0 test %eax,%eax
80103762: 7e 1e jle 80103782 <commit+0x2d>
write_log(); // Write modified blocks from cache to log
80103764: e8 34 ff ff ff call 8010369d <write_log>
write_head(); // Write header to disk -- the real commit
80103769: e8 3a fd ff ff call 801034a8 <write_head>
install_trans(); // Now install writes to home locations
8010376e: e8 09 fc ff ff call 8010337c <install_trans>
log.lh.n = 0;
80103773: c7 05 a8 32 11 80 00 movl $0x0,0x801132a8
8010377a: 00 00 00
write_head(); // Erase the transaction from the log
8010377d: e8 26 fd ff ff call 801034a8 <write_head>
}
}
80103782: 90 nop
80103783: c9 leave
80103784: c3 ret
80103785 <log_write>:
// modify bp->data[]
// log_write(bp)
// brelse(bp)
void
log_write(struct buf *b)
{
80103785: 55 push %ebp
80103786: 89 e5 mov %esp,%ebp
80103788: 83 ec 18 sub $0x18,%esp
int i;
if (log.lh.n >= LOGSIZE || log.lh.n >= log.size - 1)
8010378b: a1 a8 32 11 80 mov 0x801132a8,%eax
80103790: 83 f8 1d cmp $0x1d,%eax
80103793: 7f 12 jg 801037a7 <log_write+0x22>
80103795: a1 a8 32 11 80 mov 0x801132a8,%eax
8010379a: 8b 15 98 32 11 80 mov 0x80113298,%edx
801037a0: 83 ea 01 sub $0x1,%edx
801037a3: 39 d0 cmp %edx,%eax
801037a5: 7c 0d jl 801037b4 <log_write+0x2f>
panic("too big a transaction");
801037a7: 83 ec 0c sub $0xc,%esp
801037aa: 68 f3 8d 10 80 push $0x80108df3
801037af: e8 b2 cd ff ff call 80100566 <panic>
if (log.outstanding < 1)
801037b4: a1 9c 32 11 80 mov 0x8011329c,%eax
801037b9: 85 c0 test %eax,%eax
801037bb: 7f 0d jg 801037ca <log_write+0x45>
panic("log_write outside of trans");
801037bd: 83 ec 0c sub $0xc,%esp
801037c0: 68 09 8e 10 80 push $0x80108e09
801037c5: e8 9c cd ff ff call 80100566 <panic>
acquire(&log.lock);
801037ca: 83 ec 0c sub $0xc,%esp
801037cd: 68 60 32 11 80 push $0x80113260
801037d2: e8 66 1e 00 00 call 8010563d <acquire>
801037d7: 83 c4 10 add $0x10,%esp
for (i = 0; i < log.lh.n; i++) {
801037da: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801037e1: eb 1d jmp 80103800 <log_write+0x7b>
if (log.lh.block[i] == b->blockno) // log absorbtion
801037e3: 8b 45 f4 mov -0xc(%ebp),%eax
801037e6: 83 c0 10 add $0x10,%eax
801037e9: 8b 04 85 6c 32 11 80 mov -0x7feecd94(,%eax,4),%eax
801037f0: 89 c2 mov %eax,%edx
801037f2: 8b 45 08 mov 0x8(%ebp),%eax
801037f5: 8b 40 08 mov 0x8(%eax),%eax
801037f8: 39 c2 cmp %eax,%edx
801037fa: 74 10 je 8010380c <log_write+0x87>
panic("too big a transaction");
if (log.outstanding < 1)
panic("log_write outside of trans");
acquire(&log.lock);
for (i = 0; i < log.lh.n; i++) {
801037fc: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80103800: a1 a8 32 11 80 mov 0x801132a8,%eax
80103805: 3b 45 f4 cmp -0xc(%ebp),%eax
80103808: 7f d9 jg 801037e3 <log_write+0x5e>
8010380a: eb 01 jmp 8010380d <log_write+0x88>
if (log.lh.block[i] == b->blockno) // log absorbtion
break;
8010380c: 90 nop
}
log.lh.block[i] = b->blockno;
8010380d: 8b 45 08 mov 0x8(%ebp),%eax
80103810: 8b 40 08 mov 0x8(%eax),%eax
80103813: 89 c2 mov %eax,%edx
80103815: 8b 45 f4 mov -0xc(%ebp),%eax
80103818: 83 c0 10 add $0x10,%eax
8010381b: 89 14 85 6c 32 11 80 mov %edx,-0x7feecd94(,%eax,4)
if (i == log.lh.n)
80103822: a1 a8 32 11 80 mov 0x801132a8,%eax
80103827: 3b 45 f4 cmp -0xc(%ebp),%eax
8010382a: 75 0d jne 80103839 <log_write+0xb4>
log.lh.n++;
8010382c: a1 a8 32 11 80 mov 0x801132a8,%eax
80103831: 83 c0 01 add $0x1,%eax
80103834: a3 a8 32 11 80 mov %eax,0x801132a8
b->flags |= B_DIRTY; // prevent eviction
80103839: 8b 45 08 mov 0x8(%ebp),%eax
8010383c: 8b 00 mov (%eax),%eax
8010383e: 83 c8 04 or $0x4,%eax
80103841: 89 c2 mov %eax,%edx
80103843: 8b 45 08 mov 0x8(%ebp),%eax
80103846: 89 10 mov %edx,(%eax)
release(&log.lock);
80103848: 83 ec 0c sub $0xc,%esp
8010384b: 68 60 32 11 80 push $0x80113260
80103850: e8 4f 1e 00 00 call 801056a4 <release>
80103855: 83 c4 10 add $0x10,%esp
}
80103858: 90 nop
80103859: c9 leave
8010385a: c3 ret
8010385b <v2p>:
8010385b: 55 push %ebp
8010385c: 89 e5 mov %esp,%ebp
8010385e: 8b 45 08 mov 0x8(%ebp),%eax
80103861: 05 00 00 00 80 add $0x80000000,%eax
80103866: 5d pop %ebp
80103867: c3 ret
80103868 <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80103868: 55 push %ebp
80103869: 89 e5 mov %esp,%ebp
8010386b: 8b 45 08 mov 0x8(%ebp),%eax
8010386e: 05 00 00 00 80 add $0x80000000,%eax
80103873: 5d pop %ebp
80103874: c3 ret
80103875 <xchg>:
asm volatile("sti");
}
static inline uint
xchg(volatile uint *addr, uint newval)
{
80103875: 55 push %ebp
80103876: 89 e5 mov %esp,%ebp
80103878: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
8010387b: 8b 55 08 mov 0x8(%ebp),%edx
8010387e: 8b 45 0c mov 0xc(%ebp),%eax
80103881: 8b 4d 08 mov 0x8(%ebp),%ecx
80103884: f0 87 02 lock xchg %eax,(%edx)
80103887: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
8010388a: 8b 45 fc mov -0x4(%ebp),%eax
}
8010388d: c9 leave
8010388e: c3 ret
8010388f <main>:
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
8010388f: 8d 4c 24 04 lea 0x4(%esp),%ecx
80103893: 83 e4 f0 and $0xfffffff0,%esp
80103896: ff 71 fc pushl -0x4(%ecx)
80103899: 55 push %ebp
8010389a: 89 e5 mov %esp,%ebp
8010389c: 51 push %ecx
8010389d: 83 ec 04 sub $0x4,%esp
kinit1(end, P2V(4*1024*1024)); // phys page allocator
801038a0: 83 ec 08 sub $0x8,%esp
801038a3: 68 00 00 40 80 push $0x80400000
801038a8: 68 3c 63 11 80 push $0x8011633c
801038ad: e8 7d f2 ff ff call 80102b2f <kinit1>
801038b2: 83 c4 10 add $0x10,%esp
kvmalloc(); // kernel page table
801038b5: e8 37 4b 00 00 call 801083f1 <kvmalloc>
mpinit(); // collect info about this machine
801038ba: e8 43 04 00 00 call 80103d02 <mpinit>
lapicinit();
801038bf: e8 ea f5 ff ff call 80102eae <lapicinit>
seginit(); // set up segments
801038c4: e8 d1 44 00 00 call 80107d9a <seginit>
cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
801038c9: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801038cf: 0f b6 00 movzbl (%eax),%eax
801038d2: 0f b6 c0 movzbl %al,%eax
801038d5: 83 ec 08 sub $0x8,%esp
801038d8: 50 push %eax
801038d9: 68 24 8e 10 80 push $0x80108e24
801038de: e8 e3 ca ff ff call 801003c6 <cprintf>
801038e3: 83 c4 10 add $0x10,%esp
picinit(); // interrupt controller
801038e6: e8 6d 06 00 00 call 80103f58 <picinit>
ioapicinit(); // another interrupt controller
801038eb: e8 34 f1 ff ff call 80102a24 <ioapicinit>
consoleinit(); // I/O devices & their interrupts
801038f0: e8 24 d2 ff ff call 80100b19 <consoleinit>
uartinit(); // serial port
801038f5: e8 fc 37 00 00 call 801070f6 <uartinit>
pinit(); // process table
801038fa: e8 69 0c 00 00 call 80104568 <pinit>
tvinit(); // trap vectors
801038ff: e8 bc 33 00 00 call 80106cc0 <tvinit>
binit(); // buffer cache
80103904: e8 2b c7 ff ff call 80100034 <binit>
fileinit(); // file table
80103909: e8 67 d6 ff ff call 80100f75 <fileinit>
ideinit(); // disk
8010390e: e8 19 ed ff ff call 8010262c <ideinit>
if(!ismp)
80103913: a1 44 33 11 80 mov 0x80113344,%eax
80103918: 85 c0 test %eax,%eax
8010391a: 75 05 jne 80103921 <main+0x92>
timerinit(); // uniprocessor timer
8010391c: e8 fc 32 00 00 call 80106c1d <timerinit>
startothers(); // start other processors
80103921: e8 7f 00 00 00 call 801039a5 <startothers>
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
80103926: 83 ec 08 sub $0x8,%esp
80103929: 68 00 00 00 8e push $0x8e000000
8010392e: 68 00 00 40 80 push $0x80400000
80103933: e8 30 f2 ff ff call 80102b68 <kinit2>
80103938: 83 c4 10 add $0x10,%esp
userinit(); // first user process
8010393b: e8 66 0d 00 00 call 801046a6 <userinit>
// Finish setting up this processor in mpmain.
mpmain();
80103940: e8 1a 00 00 00 call 8010395f <mpmain>
80103945 <mpenter>:
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
80103945: 55 push %ebp
80103946: 89 e5 mov %esp,%ebp
80103948: 83 ec 08 sub $0x8,%esp
switchkvm();
8010394b: e8 b9 4a 00 00 call 80108409 <switchkvm>
seginit();
80103950: e8 45 44 00 00 call 80107d9a <seginit>
lapicinit();
80103955: e8 54 f5 ff ff call 80102eae <lapicinit>
mpmain();
8010395a: e8 00 00 00 00 call 8010395f <mpmain>
8010395f <mpmain>:
}
// Common CPU setup code.
static void
mpmain(void)
{
8010395f: 55 push %ebp
80103960: 89 e5 mov %esp,%ebp
80103962: 83 ec 08 sub $0x8,%esp
cprintf("cpu%d: starting\n", cpu->id);
80103965: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010396b: 0f b6 00 movzbl (%eax),%eax
8010396e: 0f b6 c0 movzbl %al,%eax
80103971: 83 ec 08 sub $0x8,%esp
80103974: 50 push %eax
80103975: 68 3b 8e 10 80 push $0x80108e3b
8010397a: e8 47 ca ff ff call 801003c6 <cprintf>
8010397f: 83 c4 10 add $0x10,%esp
idtinit(); // load idt register
80103982: e8 af 34 00 00 call 80106e36 <idtinit>
xchg(&cpu->started, 1); // tell startothers() we're up
80103987: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010398d: 05 a8 00 00 00 add $0xa8,%eax
80103992: 83 ec 08 sub $0x8,%esp
80103995: 6a 01 push $0x1
80103997: 50 push %eax
80103998: e8 d8 fe ff ff call 80103875 <xchg>
8010399d: 83 c4 10 add $0x10,%esp
scheduler(); // start running processes
801039a0: e8 b2 12 00 00 call 80104c57 <scheduler>
801039a5 <startothers>:
pde_t entrypgdir[]; // For entry.S
// Start the non-boot (AP) processors.
static void
startothers(void)
{
801039a5: 55 push %ebp
801039a6: 89 e5 mov %esp,%ebp
801039a8: 53 push %ebx
801039a9: 83 ec 14 sub $0x14,%esp
char *stack;
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = p2v(0x7000);
801039ac: 68 00 70 00 00 push $0x7000
801039b1: e8 b2 fe ff ff call 80103868 <p2v>
801039b6: 83 c4 04 add $0x4,%esp
801039b9: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
801039bc: b8 8a 00 00 00 mov $0x8a,%eax
801039c1: 83 ec 04 sub $0x4,%esp
801039c4: 50 push %eax
801039c5: 68 0c c5 10 80 push $0x8010c50c
801039ca: ff 75 f0 pushl -0x10(%ebp)
801039cd: e8 8d 1f 00 00 call 8010595f <memmove>
801039d2: 83 c4 10 add $0x10,%esp
for(c = cpus; c < cpus+ncpu; c++){
801039d5: c7 45 f4 60 33 11 80 movl $0x80113360,-0xc(%ebp)
801039dc: e9 90 00 00 00 jmp 80103a71 <startothers+0xcc>
if(c == cpus+cpunum()) // We've started already.
801039e1: e8 e6 f5 ff ff call 80102fcc <cpunum>
801039e6: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
801039ec: 05 60 33 11 80 add $0x80113360,%eax
801039f1: 3b 45 f4 cmp -0xc(%ebp),%eax
801039f4: 74 73 je 80103a69 <startothers+0xc4>
continue;
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
801039f6: e8 6b f2 ff ff call 80102c66 <kalloc>
801039fb: 89 45 ec mov %eax,-0x14(%ebp)
*(void**)(code-4) = stack + KSTACKSIZE;
801039fe: 8b 45 f0 mov -0x10(%ebp),%eax
80103a01: 83 e8 04 sub $0x4,%eax
80103a04: 8b 55 ec mov -0x14(%ebp),%edx
80103a07: 81 c2 00 10 00 00 add $0x1000,%edx
80103a0d: 89 10 mov %edx,(%eax)
*(void**)(code-8) = mpenter;
80103a0f: 8b 45 f0 mov -0x10(%ebp),%eax
80103a12: 83 e8 08 sub $0x8,%eax
80103a15: c7 00 45 39 10 80 movl $0x80103945,(%eax)
*(int**)(code-12) = (void *) v2p(entrypgdir);
80103a1b: 8b 45 f0 mov -0x10(%ebp),%eax
80103a1e: 8d 58 f4 lea -0xc(%eax),%ebx
80103a21: 83 ec 0c sub $0xc,%esp
80103a24: 68 00 b0 10 80 push $0x8010b000
80103a29: e8 2d fe ff ff call 8010385b <v2p>
80103a2e: 83 c4 10 add $0x10,%esp
80103a31: 89 03 mov %eax,(%ebx)
lapicstartap(c->id, v2p(code));
80103a33: 83 ec 0c sub $0xc,%esp
80103a36: ff 75 f0 pushl -0x10(%ebp)
80103a39: e8 1d fe ff ff call 8010385b <v2p>
80103a3e: 83 c4 10 add $0x10,%esp
80103a41: 89 c2 mov %eax,%edx
80103a43: 8b 45 f4 mov -0xc(%ebp),%eax
80103a46: 0f b6 00 movzbl (%eax),%eax
80103a49: 0f b6 c0 movzbl %al,%eax
80103a4c: 83 ec 08 sub $0x8,%esp
80103a4f: 52 push %edx
80103a50: 50 push %eax
80103a51: e8 f0 f5 ff ff call 80103046 <lapicstartap>
80103a56: 83 c4 10 add $0x10,%esp
// wait for cpu to finish mpmain()
while(c->started == 0)
80103a59: 90 nop
80103a5a: 8b 45 f4 mov -0xc(%ebp),%eax
80103a5d: 8b 80 a8 00 00 00 mov 0xa8(%eax),%eax
80103a63: 85 c0 test %eax,%eax
80103a65: 74 f3 je 80103a5a <startothers+0xb5>
80103a67: eb 01 jmp 80103a6a <startothers+0xc5>
code = p2v(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
if(c == cpus+cpunum()) // We've started already.
continue;
80103a69: 90 nop
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = p2v(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
80103a6a: 81 45 f4 bc 00 00 00 addl $0xbc,-0xc(%ebp)
80103a71: a1 40 39 11 80 mov 0x80113940,%eax
80103a76: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103a7c: 05 60 33 11 80 add $0x80113360,%eax
80103a81: 3b 45 f4 cmp -0xc(%ebp),%eax
80103a84: 0f 87 57 ff ff ff ja 801039e1 <startothers+0x3c>
// wait for cpu to finish mpmain()
while(c->started == 0)
;
}
}
80103a8a: 90 nop
80103a8b: 8b 5d fc mov -0x4(%ebp),%ebx
80103a8e: c9 leave
80103a8f: c3 ret
80103a90 <p2v>:
80103a90: 55 push %ebp
80103a91: 89 e5 mov %esp,%ebp
80103a93: 8b 45 08 mov 0x8(%ebp),%eax
80103a96: 05 00 00 00 80 add $0x80000000,%eax
80103a9b: 5d pop %ebp
80103a9c: c3 ret
80103a9d <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
80103a9d: 55 push %ebp
80103a9e: 89 e5 mov %esp,%ebp
80103aa0: 83 ec 14 sub $0x14,%esp
80103aa3: 8b 45 08 mov 0x8(%ebp),%eax
80103aa6: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
80103aaa: 0f b7 45 ec movzwl -0x14(%ebp),%eax
80103aae: 89 c2 mov %eax,%edx
80103ab0: ec in (%dx),%al
80103ab1: 88 45 ff mov %al,-0x1(%ebp)
return data;
80103ab4: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
80103ab8: c9 leave
80103ab9: c3 ret
80103aba <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80103aba: 55 push %ebp
80103abb: 89 e5 mov %esp,%ebp
80103abd: 83 ec 08 sub $0x8,%esp
80103ac0: 8b 55 08 mov 0x8(%ebp),%edx
80103ac3: 8b 45 0c mov 0xc(%ebp),%eax
80103ac6: 66 89 55 fc mov %dx,-0x4(%ebp)
80103aca: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103acd: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80103ad1: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80103ad5: ee out %al,(%dx)
}
80103ad6: 90 nop
80103ad7: c9 leave
80103ad8: c3 ret
80103ad9 <mpbcpu>:
int ncpu;
uchar ioapicid;
int
mpbcpu(void)
{
80103ad9: 55 push %ebp
80103ada: 89 e5 mov %esp,%ebp
return bcpu-cpus;
80103adc: a1 44 c6 10 80 mov 0x8010c644,%eax
80103ae1: 89 c2 mov %eax,%edx
80103ae3: b8 60 33 11 80 mov $0x80113360,%eax
80103ae8: 29 c2 sub %eax,%edx
80103aea: 89 d0 mov %edx,%eax
80103aec: c1 f8 02 sar $0x2,%eax
80103aef: 69 c0 cf 46 7d 67 imul $0x677d46cf,%eax,%eax
}
80103af5: 5d pop %ebp
80103af6: c3 ret
80103af7 <sum>:
static uchar
sum(uchar *addr, int len)
{
80103af7: 55 push %ebp
80103af8: 89 e5 mov %esp,%ebp
80103afa: 83 ec 10 sub $0x10,%esp
int i, sum;
sum = 0;
80103afd: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
for(i=0; i<len; i++)
80103b04: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80103b0b: eb 15 jmp 80103b22 <sum+0x2b>
sum += addr[i];
80103b0d: 8b 55 fc mov -0x4(%ebp),%edx
80103b10: 8b 45 08 mov 0x8(%ebp),%eax
80103b13: 01 d0 add %edx,%eax
80103b15: 0f b6 00 movzbl (%eax),%eax
80103b18: 0f b6 c0 movzbl %al,%eax
80103b1b: 01 45 f8 add %eax,-0x8(%ebp)
sum(uchar *addr, int len)
{
int i, sum;
sum = 0;
for(i=0; i<len; i++)
80103b1e: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80103b22: 8b 45 fc mov -0x4(%ebp),%eax
80103b25: 3b 45 0c cmp 0xc(%ebp),%eax
80103b28: 7c e3 jl 80103b0d <sum+0x16>
sum += addr[i];
return sum;
80103b2a: 8b 45 f8 mov -0x8(%ebp),%eax
}
80103b2d: c9 leave
80103b2e: c3 ret
80103b2f <mpsearch1>:
// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uint a, int len)
{
80103b2f: 55 push %ebp
80103b30: 89 e5 mov %esp,%ebp
80103b32: 83 ec 18 sub $0x18,%esp
uchar *e, *p, *addr;
addr = p2v(a);
80103b35: ff 75 08 pushl 0x8(%ebp)
80103b38: e8 53 ff ff ff call 80103a90 <p2v>
80103b3d: 83 c4 04 add $0x4,%esp
80103b40: 89 45 f0 mov %eax,-0x10(%ebp)
e = addr+len;
80103b43: 8b 55 0c mov 0xc(%ebp),%edx
80103b46: 8b 45 f0 mov -0x10(%ebp),%eax
80103b49: 01 d0 add %edx,%eax
80103b4b: 89 45 ec mov %eax,-0x14(%ebp)
for(p = addr; p < e; p += sizeof(struct mp))
80103b4e: 8b 45 f0 mov -0x10(%ebp),%eax
80103b51: 89 45 f4 mov %eax,-0xc(%ebp)
80103b54: eb 36 jmp 80103b8c <mpsearch1+0x5d>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
80103b56: 83 ec 04 sub $0x4,%esp
80103b59: 6a 04 push $0x4
80103b5b: 68 4c 8e 10 80 push $0x80108e4c
80103b60: ff 75 f4 pushl -0xc(%ebp)
80103b63: e8 9f 1d 00 00 call 80105907 <memcmp>
80103b68: 83 c4 10 add $0x10,%esp
80103b6b: 85 c0 test %eax,%eax
80103b6d: 75 19 jne 80103b88 <mpsearch1+0x59>
80103b6f: 83 ec 08 sub $0x8,%esp
80103b72: 6a 10 push $0x10
80103b74: ff 75 f4 pushl -0xc(%ebp)
80103b77: e8 7b ff ff ff call 80103af7 <sum>
80103b7c: 83 c4 10 add $0x10,%esp
80103b7f: 84 c0 test %al,%al
80103b81: 75 05 jne 80103b88 <mpsearch1+0x59>
return (struct mp*)p;
80103b83: 8b 45 f4 mov -0xc(%ebp),%eax
80103b86: eb 11 jmp 80103b99 <mpsearch1+0x6a>
{
uchar *e, *p, *addr;
addr = p2v(a);
e = addr+len;
for(p = addr; p < e; p += sizeof(struct mp))
80103b88: 83 45 f4 10 addl $0x10,-0xc(%ebp)
80103b8c: 8b 45 f4 mov -0xc(%ebp),%eax
80103b8f: 3b 45 ec cmp -0x14(%ebp),%eax
80103b92: 72 c2 jb 80103b56 <mpsearch1+0x27>
if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
return (struct mp*)p;
return 0;
80103b94: b8 00 00 00 00 mov $0x0,%eax
}
80103b99: c9 leave
80103b9a: c3 ret
80103b9b <mpsearch>:
// 1) in the first KB of the EBDA;
// 2) in the last KB of system base memory;
// 3) in the BIOS ROM between 0xE0000 and 0xFFFFF.
static struct mp*
mpsearch(void)
{
80103b9b: 55 push %ebp
80103b9c: 89 e5 mov %esp,%ebp
80103b9e: 83 ec 18 sub $0x18,%esp
uchar *bda;
uint p;
struct mp *mp;
bda = (uchar *) P2V(0x400);
80103ba1: c7 45 f4 00 04 00 80 movl $0x80000400,-0xc(%ebp)
if((p = ((bda[0x0F]<<8)| bda[0x0E]) << 4)){
80103ba8: 8b 45 f4 mov -0xc(%ebp),%eax
80103bab: 83 c0 0f add $0xf,%eax
80103bae: 0f b6 00 movzbl (%eax),%eax
80103bb1: 0f b6 c0 movzbl %al,%eax
80103bb4: c1 e0 08 shl $0x8,%eax
80103bb7: 89 c2 mov %eax,%edx
80103bb9: 8b 45 f4 mov -0xc(%ebp),%eax
80103bbc: 83 c0 0e add $0xe,%eax
80103bbf: 0f b6 00 movzbl (%eax),%eax
80103bc2: 0f b6 c0 movzbl %al,%eax
80103bc5: 09 d0 or %edx,%eax
80103bc7: c1 e0 04 shl $0x4,%eax
80103bca: 89 45 f0 mov %eax,-0x10(%ebp)
80103bcd: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103bd1: 74 21 je 80103bf4 <mpsearch+0x59>
if((mp = mpsearch1(p, 1024)))
80103bd3: 83 ec 08 sub $0x8,%esp
80103bd6: 68 00 04 00 00 push $0x400
80103bdb: ff 75 f0 pushl -0x10(%ebp)
80103bde: e8 4c ff ff ff call 80103b2f <mpsearch1>
80103be3: 83 c4 10 add $0x10,%esp
80103be6: 89 45 ec mov %eax,-0x14(%ebp)
80103be9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103bed: 74 51 je 80103c40 <mpsearch+0xa5>
return mp;
80103bef: 8b 45 ec mov -0x14(%ebp),%eax
80103bf2: eb 61 jmp 80103c55 <mpsearch+0xba>
} else {
p = ((bda[0x14]<<8)|bda[0x13])*1024;
80103bf4: 8b 45 f4 mov -0xc(%ebp),%eax
80103bf7: 83 c0 14 add $0x14,%eax
80103bfa: 0f b6 00 movzbl (%eax),%eax
80103bfd: 0f b6 c0 movzbl %al,%eax
80103c00: c1 e0 08 shl $0x8,%eax
80103c03: 89 c2 mov %eax,%edx
80103c05: 8b 45 f4 mov -0xc(%ebp),%eax
80103c08: 83 c0 13 add $0x13,%eax
80103c0b: 0f b6 00 movzbl (%eax),%eax
80103c0e: 0f b6 c0 movzbl %al,%eax
80103c11: 09 d0 or %edx,%eax
80103c13: c1 e0 0a shl $0xa,%eax
80103c16: 89 45 f0 mov %eax,-0x10(%ebp)
if((mp = mpsearch1(p-1024, 1024)))
80103c19: 8b 45 f0 mov -0x10(%ebp),%eax
80103c1c: 2d 00 04 00 00 sub $0x400,%eax
80103c21: 83 ec 08 sub $0x8,%esp
80103c24: 68 00 04 00 00 push $0x400
80103c29: 50 push %eax
80103c2a: e8 00 ff ff ff call 80103b2f <mpsearch1>
80103c2f: 83 c4 10 add $0x10,%esp
80103c32: 89 45 ec mov %eax,-0x14(%ebp)
80103c35: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80103c39: 74 05 je 80103c40 <mpsearch+0xa5>
return mp;
80103c3b: 8b 45 ec mov -0x14(%ebp),%eax
80103c3e: eb 15 jmp 80103c55 <mpsearch+0xba>
}
return mpsearch1(0xF0000, 0x10000);
80103c40: 83 ec 08 sub $0x8,%esp
80103c43: 68 00 00 01 00 push $0x10000
80103c48: 68 00 00 0f 00 push $0xf0000
80103c4d: e8 dd fe ff ff call 80103b2f <mpsearch1>
80103c52: 83 c4 10 add $0x10,%esp
}
80103c55: c9 leave
80103c56: c3 ret
80103c57 <mpconfig>:
// Check for correct signature, calculate the checksum and,
// if correct, check the version.
// To do: check extended table checksum.
static struct mpconf*
mpconfig(struct mp **pmp)
{
80103c57: 55 push %ebp
80103c58: 89 e5 mov %esp,%ebp
80103c5a: 83 ec 18 sub $0x18,%esp
struct mpconf *conf;
struct mp *mp;
if((mp = mpsearch()) == 0 || mp->physaddr == 0)
80103c5d: e8 39 ff ff ff call 80103b9b <mpsearch>
80103c62: 89 45 f4 mov %eax,-0xc(%ebp)
80103c65: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80103c69: 74 0a je 80103c75 <mpconfig+0x1e>
80103c6b: 8b 45 f4 mov -0xc(%ebp),%eax
80103c6e: 8b 40 04 mov 0x4(%eax),%eax
80103c71: 85 c0 test %eax,%eax
80103c73: 75 0a jne 80103c7f <mpconfig+0x28>
return 0;
80103c75: b8 00 00 00 00 mov $0x0,%eax
80103c7a: e9 81 00 00 00 jmp 80103d00 <mpconfig+0xa9>
conf = (struct mpconf*) p2v((uint) mp->physaddr);
80103c7f: 8b 45 f4 mov -0xc(%ebp),%eax
80103c82: 8b 40 04 mov 0x4(%eax),%eax
80103c85: 83 ec 0c sub $0xc,%esp
80103c88: 50 push %eax
80103c89: e8 02 fe ff ff call 80103a90 <p2v>
80103c8e: 83 c4 10 add $0x10,%esp
80103c91: 89 45 f0 mov %eax,-0x10(%ebp)
if(memcmp(conf, "PCMP", 4) != 0)
80103c94: 83 ec 04 sub $0x4,%esp
80103c97: 6a 04 push $0x4
80103c99: 68 51 8e 10 80 push $0x80108e51
80103c9e: ff 75 f0 pushl -0x10(%ebp)
80103ca1: e8 61 1c 00 00 call 80105907 <memcmp>
80103ca6: 83 c4 10 add $0x10,%esp
80103ca9: 85 c0 test %eax,%eax
80103cab: 74 07 je 80103cb4 <mpconfig+0x5d>
return 0;
80103cad: b8 00 00 00 00 mov $0x0,%eax
80103cb2: eb 4c jmp 80103d00 <mpconfig+0xa9>
if(conf->version != 1 && conf->version != 4)
80103cb4: 8b 45 f0 mov -0x10(%ebp),%eax
80103cb7: 0f b6 40 06 movzbl 0x6(%eax),%eax
80103cbb: 3c 01 cmp $0x1,%al
80103cbd: 74 12 je 80103cd1 <mpconfig+0x7a>
80103cbf: 8b 45 f0 mov -0x10(%ebp),%eax
80103cc2: 0f b6 40 06 movzbl 0x6(%eax),%eax
80103cc6: 3c 04 cmp $0x4,%al
80103cc8: 74 07 je 80103cd1 <mpconfig+0x7a>
return 0;
80103cca: b8 00 00 00 00 mov $0x0,%eax
80103ccf: eb 2f jmp 80103d00 <mpconfig+0xa9>
if(sum((uchar*)conf, conf->length) != 0)
80103cd1: 8b 45 f0 mov -0x10(%ebp),%eax
80103cd4: 0f b7 40 04 movzwl 0x4(%eax),%eax
80103cd8: 0f b7 c0 movzwl %ax,%eax
80103cdb: 83 ec 08 sub $0x8,%esp
80103cde: 50 push %eax
80103cdf: ff 75 f0 pushl -0x10(%ebp)
80103ce2: e8 10 fe ff ff call 80103af7 <sum>
80103ce7: 83 c4 10 add $0x10,%esp
80103cea: 84 c0 test %al,%al
80103cec: 74 07 je 80103cf5 <mpconfig+0x9e>
return 0;
80103cee: b8 00 00 00 00 mov $0x0,%eax
80103cf3: eb 0b jmp 80103d00 <mpconfig+0xa9>
*pmp = mp;
80103cf5: 8b 45 08 mov 0x8(%ebp),%eax
80103cf8: 8b 55 f4 mov -0xc(%ebp),%edx
80103cfb: 89 10 mov %edx,(%eax)
return conf;
80103cfd: 8b 45 f0 mov -0x10(%ebp),%eax
}
80103d00: c9 leave
80103d01: c3 ret
80103d02 <mpinit>:
void
mpinit(void)
{
80103d02: 55 push %ebp
80103d03: 89 e5 mov %esp,%ebp
80103d05: 83 ec 28 sub $0x28,%esp
struct mp *mp;
struct mpconf *conf;
struct mpproc *proc;
struct mpioapic *ioapic;
bcpu = &cpus[0];
80103d08: c7 05 44 c6 10 80 60 movl $0x80113360,0x8010c644
80103d0f: 33 11 80
if((conf = mpconfig(&mp)) == 0)
80103d12: 83 ec 0c sub $0xc,%esp
80103d15: 8d 45 e0 lea -0x20(%ebp),%eax
80103d18: 50 push %eax
80103d19: e8 39 ff ff ff call 80103c57 <mpconfig>
80103d1e: 83 c4 10 add $0x10,%esp
80103d21: 89 45 f0 mov %eax,-0x10(%ebp)
80103d24: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80103d28: 0f 84 96 01 00 00 je 80103ec4 <mpinit+0x1c2>
return;
ismp = 1;
80103d2e: c7 05 44 33 11 80 01 movl $0x1,0x80113344
80103d35: 00 00 00
lapic = (uint*)conf->lapicaddr;
80103d38: 8b 45 f0 mov -0x10(%ebp),%eax
80103d3b: 8b 40 24 mov 0x24(%eax),%eax
80103d3e: a3 5c 32 11 80 mov %eax,0x8011325c
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103d43: 8b 45 f0 mov -0x10(%ebp),%eax
80103d46: 83 c0 2c add $0x2c,%eax
80103d49: 89 45 f4 mov %eax,-0xc(%ebp)
80103d4c: 8b 45 f0 mov -0x10(%ebp),%eax
80103d4f: 0f b7 40 04 movzwl 0x4(%eax),%eax
80103d53: 0f b7 d0 movzwl %ax,%edx
80103d56: 8b 45 f0 mov -0x10(%ebp),%eax
80103d59: 01 d0 add %edx,%eax
80103d5b: 89 45 ec mov %eax,-0x14(%ebp)
80103d5e: e9 f2 00 00 00 jmp 80103e55 <mpinit+0x153>
switch(*p){
80103d63: 8b 45 f4 mov -0xc(%ebp),%eax
80103d66: 0f b6 00 movzbl (%eax),%eax
80103d69: 0f b6 c0 movzbl %al,%eax
80103d6c: 83 f8 04 cmp $0x4,%eax
80103d6f: 0f 87 bc 00 00 00 ja 80103e31 <mpinit+0x12f>
80103d75: 8b 04 85 94 8e 10 80 mov -0x7fef716c(,%eax,4),%eax
80103d7c: ff e0 jmp *%eax
case MPPROC:
proc = (struct mpproc*)p;
80103d7e: 8b 45 f4 mov -0xc(%ebp),%eax
80103d81: 89 45 e8 mov %eax,-0x18(%ebp)
if(ncpu != proc->apicid){
80103d84: 8b 45 e8 mov -0x18(%ebp),%eax
80103d87: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103d8b: 0f b6 d0 movzbl %al,%edx
80103d8e: a1 40 39 11 80 mov 0x80113940,%eax
80103d93: 39 c2 cmp %eax,%edx
80103d95: 74 2b je 80103dc2 <mpinit+0xc0>
cprintf("mpinit: ncpu=%d apicid=%d\n", ncpu, proc->apicid);
80103d97: 8b 45 e8 mov -0x18(%ebp),%eax
80103d9a: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103d9e: 0f b6 d0 movzbl %al,%edx
80103da1: a1 40 39 11 80 mov 0x80113940,%eax
80103da6: 83 ec 04 sub $0x4,%esp
80103da9: 52 push %edx
80103daa: 50 push %eax
80103dab: 68 56 8e 10 80 push $0x80108e56
80103db0: e8 11 c6 ff ff call 801003c6 <cprintf>
80103db5: 83 c4 10 add $0x10,%esp
ismp = 0;
80103db8: c7 05 44 33 11 80 00 movl $0x0,0x80113344
80103dbf: 00 00 00
}
if(proc->flags & MPBOOT)
80103dc2: 8b 45 e8 mov -0x18(%ebp),%eax
80103dc5: 0f b6 40 03 movzbl 0x3(%eax),%eax
80103dc9: 0f b6 c0 movzbl %al,%eax
80103dcc: 83 e0 02 and $0x2,%eax
80103dcf: 85 c0 test %eax,%eax
80103dd1: 74 15 je 80103de8 <mpinit+0xe6>
bcpu = &cpus[ncpu];
80103dd3: a1 40 39 11 80 mov 0x80113940,%eax
80103dd8: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103dde: 05 60 33 11 80 add $0x80113360,%eax
80103de3: a3 44 c6 10 80 mov %eax,0x8010c644
cpus[ncpu].id = ncpu;
80103de8: a1 40 39 11 80 mov 0x80113940,%eax
80103ded: 8b 15 40 39 11 80 mov 0x80113940,%edx
80103df3: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80103df9: 05 60 33 11 80 add $0x80113360,%eax
80103dfe: 88 10 mov %dl,(%eax)
ncpu++;
80103e00: a1 40 39 11 80 mov 0x80113940,%eax
80103e05: 83 c0 01 add $0x1,%eax
80103e08: a3 40 39 11 80 mov %eax,0x80113940
p += sizeof(struct mpproc);
80103e0d: 83 45 f4 14 addl $0x14,-0xc(%ebp)
continue;
80103e11: eb 42 jmp 80103e55 <mpinit+0x153>
case MPIOAPIC:
ioapic = (struct mpioapic*)p;
80103e13: 8b 45 f4 mov -0xc(%ebp),%eax
80103e16: 89 45 e4 mov %eax,-0x1c(%ebp)
ioapicid = ioapic->apicno;
80103e19: 8b 45 e4 mov -0x1c(%ebp),%eax
80103e1c: 0f b6 40 01 movzbl 0x1(%eax),%eax
80103e20: a2 40 33 11 80 mov %al,0x80113340
p += sizeof(struct mpioapic);
80103e25: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
80103e29: eb 2a jmp 80103e55 <mpinit+0x153>
case MPBUS:
case MPIOINTR:
case MPLINTR:
p += 8;
80103e2b: 83 45 f4 08 addl $0x8,-0xc(%ebp)
continue;
80103e2f: eb 24 jmp 80103e55 <mpinit+0x153>
default:
cprintf("mpinit: unknown config type %x\n", *p);
80103e31: 8b 45 f4 mov -0xc(%ebp),%eax
80103e34: 0f b6 00 movzbl (%eax),%eax
80103e37: 0f b6 c0 movzbl %al,%eax
80103e3a: 83 ec 08 sub $0x8,%esp
80103e3d: 50 push %eax
80103e3e: 68 74 8e 10 80 push $0x80108e74
80103e43: e8 7e c5 ff ff call 801003c6 <cprintf>
80103e48: 83 c4 10 add $0x10,%esp
ismp = 0;
80103e4b: c7 05 44 33 11 80 00 movl $0x0,0x80113344
80103e52: 00 00 00
bcpu = &cpus[0];
if((conf = mpconfig(&mp)) == 0)
return;
ismp = 1;
lapic = (uint*)conf->lapicaddr;
for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
80103e55: 8b 45 f4 mov -0xc(%ebp),%eax
80103e58: 3b 45 ec cmp -0x14(%ebp),%eax
80103e5b: 0f 82 02 ff ff ff jb 80103d63 <mpinit+0x61>
default:
cprintf("mpinit: unknown config type %x\n", *p);
ismp = 0;
}
}
if(!ismp){
80103e61: a1 44 33 11 80 mov 0x80113344,%eax
80103e66: 85 c0 test %eax,%eax
80103e68: 75 1d jne 80103e87 <mpinit+0x185>
// Didn't like what we found; fall back to no MP.
ncpu = 1;
80103e6a: c7 05 40 39 11 80 01 movl $0x1,0x80113940
80103e71: 00 00 00
lapic = 0;
80103e74: c7 05 5c 32 11 80 00 movl $0x0,0x8011325c
80103e7b: 00 00 00
ioapicid = 0;
80103e7e: c6 05 40 33 11 80 00 movb $0x0,0x80113340
return;
80103e85: eb 3e jmp 80103ec5 <mpinit+0x1c3>
}
if(mp->imcrp){
80103e87: 8b 45 e0 mov -0x20(%ebp),%eax
80103e8a: 0f b6 40 0c movzbl 0xc(%eax),%eax
80103e8e: 84 c0 test %al,%al
80103e90: 74 33 je 80103ec5 <mpinit+0x1c3>
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
80103e92: 83 ec 08 sub $0x8,%esp
80103e95: 6a 70 push $0x70
80103e97: 6a 22 push $0x22
80103e99: e8 1c fc ff ff call 80103aba <outb>
80103e9e: 83 c4 10 add $0x10,%esp
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
80103ea1: 83 ec 0c sub $0xc,%esp
80103ea4: 6a 23 push $0x23
80103ea6: e8 f2 fb ff ff call 80103a9d <inb>
80103eab: 83 c4 10 add $0x10,%esp
80103eae: 83 c8 01 or $0x1,%eax
80103eb1: 0f b6 c0 movzbl %al,%eax
80103eb4: 83 ec 08 sub $0x8,%esp
80103eb7: 50 push %eax
80103eb8: 6a 23 push $0x23
80103eba: e8 fb fb ff ff call 80103aba <outb>
80103ebf: 83 c4 10 add $0x10,%esp
80103ec2: eb 01 jmp 80103ec5 <mpinit+0x1c3>
struct mpproc *proc;
struct mpioapic *ioapic;
bcpu = &cpus[0];
if((conf = mpconfig(&mp)) == 0)
return;
80103ec4: 90 nop
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
}
}
80103ec5: c9 leave
80103ec6: c3 ret
80103ec7 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80103ec7: 55 push %ebp
80103ec8: 89 e5 mov %esp,%ebp
80103eca: 83 ec 08 sub $0x8,%esp
80103ecd: 8b 55 08 mov 0x8(%ebp),%edx
80103ed0: 8b 45 0c mov 0xc(%ebp),%eax
80103ed3: 66 89 55 fc mov %dx,-0x4(%ebp)
80103ed7: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80103eda: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80103ede: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80103ee2: ee out %al,(%dx)
}
80103ee3: 90 nop
80103ee4: c9 leave
80103ee5: c3 ret
80103ee6 <picsetmask>:
// Initial IRQ mask has interrupt 2 enabled (for slave 8259A).
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);
static void
picsetmask(ushort mask)
{
80103ee6: 55 push %ebp
80103ee7: 89 e5 mov %esp,%ebp
80103ee9: 83 ec 04 sub $0x4,%esp
80103eec: 8b 45 08 mov 0x8(%ebp),%eax
80103eef: 66 89 45 fc mov %ax,-0x4(%ebp)
irqmask = mask;
80103ef3: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103ef7: 66 a3 00 c0 10 80 mov %ax,0x8010c000
outb(IO_PIC1+1, mask);
80103efd: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103f01: 0f b6 c0 movzbl %al,%eax
80103f04: 50 push %eax
80103f05: 6a 21 push $0x21
80103f07: e8 bb ff ff ff call 80103ec7 <outb>
80103f0c: 83 c4 08 add $0x8,%esp
outb(IO_PIC2+1, mask >> 8);
80103f0f: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80103f13: 66 c1 e8 08 shr $0x8,%ax
80103f17: 0f b6 c0 movzbl %al,%eax
80103f1a: 50 push %eax
80103f1b: 68 a1 00 00 00 push $0xa1
80103f20: e8 a2 ff ff ff call 80103ec7 <outb>
80103f25: 83 c4 08 add $0x8,%esp
}
80103f28: 90 nop
80103f29: c9 leave
80103f2a: c3 ret
80103f2b <picenable>:
void
picenable(int irq)
{
80103f2b: 55 push %ebp
80103f2c: 89 e5 mov %esp,%ebp
picsetmask(irqmask & ~(1<<irq));
80103f2e: 8b 45 08 mov 0x8(%ebp),%eax
80103f31: ba 01 00 00 00 mov $0x1,%edx
80103f36: 89 c1 mov %eax,%ecx
80103f38: d3 e2 shl %cl,%edx
80103f3a: 89 d0 mov %edx,%eax
80103f3c: f7 d0 not %eax
80103f3e: 89 c2 mov %eax,%edx
80103f40: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax
80103f47: 21 d0 and %edx,%eax
80103f49: 0f b7 c0 movzwl %ax,%eax
80103f4c: 50 push %eax
80103f4d: e8 94 ff ff ff call 80103ee6 <picsetmask>
80103f52: 83 c4 04 add $0x4,%esp
}
80103f55: 90 nop
80103f56: c9 leave
80103f57: c3 ret
80103f58 <picinit>:
// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
80103f58: 55 push %ebp
80103f59: 89 e5 mov %esp,%ebp
// mask all interrupts
outb(IO_PIC1+1, 0xFF);
80103f5b: 68 ff 00 00 00 push $0xff
80103f60: 6a 21 push $0x21
80103f62: e8 60 ff ff ff call 80103ec7 <outb>
80103f67: 83 c4 08 add $0x8,%esp
outb(IO_PIC2+1, 0xFF);
80103f6a: 68 ff 00 00 00 push $0xff
80103f6f: 68 a1 00 00 00 push $0xa1
80103f74: e8 4e ff ff ff call 80103ec7 <outb>
80103f79: 83 c4 08 add $0x8,%esp
// ICW1: 0001g0hi
// g: 0 = edge triggering, 1 = level triggering
// h: 0 = cascaded PICs, 1 = master only
// i: 0 = no ICW4, 1 = ICW4 required
outb(IO_PIC1, 0x11);
80103f7c: 6a 11 push $0x11
80103f7e: 6a 20 push $0x20
80103f80: e8 42 ff ff ff call 80103ec7 <outb>
80103f85: 83 c4 08 add $0x8,%esp
// ICW2: Vector offset
outb(IO_PIC1+1, T_IRQ0);
80103f88: 6a 20 push $0x20
80103f8a: 6a 21 push $0x21
80103f8c: e8 36 ff ff ff call 80103ec7 <outb>
80103f91: 83 c4 08 add $0x8,%esp
// ICW3: (master PIC) bit mask of IR lines connected to slaves
// (slave PIC) 3-bit # of slave's connection to master
outb(IO_PIC1+1, 1<<IRQ_SLAVE);
80103f94: 6a 04 push $0x4
80103f96: 6a 21 push $0x21
80103f98: e8 2a ff ff ff call 80103ec7 <outb>
80103f9d: 83 c4 08 add $0x8,%esp
// m: 0 = slave PIC, 1 = master PIC
// (ignored when b is 0, as the master/slave role
// can be hardwired).
// a: 1 = Automatic EOI mode
// p: 0 = MCS-80/85 mode, 1 = intel x86 mode
outb(IO_PIC1+1, 0x3);
80103fa0: 6a 03 push $0x3
80103fa2: 6a 21 push $0x21
80103fa4: e8 1e ff ff ff call 80103ec7 <outb>
80103fa9: 83 c4 08 add $0x8,%esp
// Set up slave (8259A-2)
outb(IO_PIC2, 0x11); // ICW1
80103fac: 6a 11 push $0x11
80103fae: 68 a0 00 00 00 push $0xa0
80103fb3: e8 0f ff ff ff call 80103ec7 <outb>
80103fb8: 83 c4 08 add $0x8,%esp
outb(IO_PIC2+1, T_IRQ0 + 8); // ICW2
80103fbb: 6a 28 push $0x28
80103fbd: 68 a1 00 00 00 push $0xa1
80103fc2: e8 00 ff ff ff call 80103ec7 <outb>
80103fc7: 83 c4 08 add $0x8,%esp
outb(IO_PIC2+1, IRQ_SLAVE); // ICW3
80103fca: 6a 02 push $0x2
80103fcc: 68 a1 00 00 00 push $0xa1
80103fd1: e8 f1 fe ff ff call 80103ec7 <outb>
80103fd6: 83 c4 08 add $0x8,%esp
// NB Automatic EOI mode doesn't tend to work on the slave.
// Linux source code says it's "to be investigated".
outb(IO_PIC2+1, 0x3); // ICW4
80103fd9: 6a 03 push $0x3
80103fdb: 68 a1 00 00 00 push $0xa1
80103fe0: e8 e2 fe ff ff call 80103ec7 <outb>
80103fe5: 83 c4 08 add $0x8,%esp
// OCW3: 0ef01prs
// ef: 0x = NOP, 10 = clear specific mask, 11 = set specific mask
// p: 0 = no polling, 1 = polling mode
// rs: 0x = NOP, 10 = read IRR, 11 = read ISR
outb(IO_PIC1, 0x68); // clear specific mask
80103fe8: 6a 68 push $0x68
80103fea: 6a 20 push $0x20
80103fec: e8 d6 fe ff ff call 80103ec7 <outb>
80103ff1: 83 c4 08 add $0x8,%esp
outb(IO_PIC1, 0x0a); // read IRR by default
80103ff4: 6a 0a push $0xa
80103ff6: 6a 20 push $0x20
80103ff8: e8 ca fe ff ff call 80103ec7 <outb>
80103ffd: 83 c4 08 add $0x8,%esp
outb(IO_PIC2, 0x68); // OCW3
80104000: 6a 68 push $0x68
80104002: 68 a0 00 00 00 push $0xa0
80104007: e8 bb fe ff ff call 80103ec7 <outb>
8010400c: 83 c4 08 add $0x8,%esp
outb(IO_PIC2, 0x0a); // OCW3
8010400f: 6a 0a push $0xa
80104011: 68 a0 00 00 00 push $0xa0
80104016: e8 ac fe ff ff call 80103ec7 <outb>
8010401b: 83 c4 08 add $0x8,%esp
if(irqmask != 0xFFFF)
8010401e: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax
80104025: 66 83 f8 ff cmp $0xffff,%ax
80104029: 74 13 je 8010403e <picinit+0xe6>
picsetmask(irqmask);
8010402b: 0f b7 05 00 c0 10 80 movzwl 0x8010c000,%eax
80104032: 0f b7 c0 movzwl %ax,%eax
80104035: 50 push %eax
80104036: e8 ab fe ff ff call 80103ee6 <picsetmask>
8010403b: 83 c4 04 add $0x4,%esp
}
8010403e: 90 nop
8010403f: c9 leave
80104040: c3 ret
80104041 <pipealloc>:
int writeopen; // write fd is still open
};
int
pipealloc(struct file **f0, struct file **f1)
{
80104041: 55 push %ebp
80104042: 89 e5 mov %esp,%ebp
80104044: 83 ec 18 sub $0x18,%esp
struct pipe *p;
p = 0;
80104047: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
*f0 = *f1 = 0;
8010404e: 8b 45 0c mov 0xc(%ebp),%eax
80104051: c7 00 00 00 00 00 movl $0x0,(%eax)
80104057: 8b 45 0c mov 0xc(%ebp),%eax
8010405a: 8b 10 mov (%eax),%edx
8010405c: 8b 45 08 mov 0x8(%ebp),%eax
8010405f: 89 10 mov %edx,(%eax)
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
80104061: e8 2d cf ff ff call 80100f93 <filealloc>
80104066: 89 c2 mov %eax,%edx
80104068: 8b 45 08 mov 0x8(%ebp),%eax
8010406b: 89 10 mov %edx,(%eax)
8010406d: 8b 45 08 mov 0x8(%ebp),%eax
80104070: 8b 00 mov (%eax),%eax
80104072: 85 c0 test %eax,%eax
80104074: 0f 84 cb 00 00 00 je 80104145 <pipealloc+0x104>
8010407a: e8 14 cf ff ff call 80100f93 <filealloc>
8010407f: 89 c2 mov %eax,%edx
80104081: 8b 45 0c mov 0xc(%ebp),%eax
80104084: 89 10 mov %edx,(%eax)
80104086: 8b 45 0c mov 0xc(%ebp),%eax
80104089: 8b 00 mov (%eax),%eax
8010408b: 85 c0 test %eax,%eax
8010408d: 0f 84 b2 00 00 00 je 80104145 <pipealloc+0x104>
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
80104093: e8 ce eb ff ff call 80102c66 <kalloc>
80104098: 89 45 f4 mov %eax,-0xc(%ebp)
8010409b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010409f: 0f 84 9f 00 00 00 je 80104144 <pipealloc+0x103>
goto bad;
p->readopen = 1;
801040a5: 8b 45 f4 mov -0xc(%ebp),%eax
801040a8: c7 80 3c 02 00 00 01 movl $0x1,0x23c(%eax)
801040af: 00 00 00
p->writeopen = 1;
801040b2: 8b 45 f4 mov -0xc(%ebp),%eax
801040b5: c7 80 40 02 00 00 01 movl $0x1,0x240(%eax)
801040bc: 00 00 00
p->nwrite = 0;
801040bf: 8b 45 f4 mov -0xc(%ebp),%eax
801040c2: c7 80 38 02 00 00 00 movl $0x0,0x238(%eax)
801040c9: 00 00 00
p->nread = 0;
801040cc: 8b 45 f4 mov -0xc(%ebp),%eax
801040cf: c7 80 34 02 00 00 00 movl $0x0,0x234(%eax)
801040d6: 00 00 00
initlock(&p->lock, "pipe");
801040d9: 8b 45 f4 mov -0xc(%ebp),%eax
801040dc: 83 ec 08 sub $0x8,%esp
801040df: 68 a8 8e 10 80 push $0x80108ea8
801040e4: 50 push %eax
801040e5: e8 31 15 00 00 call 8010561b <initlock>
801040ea: 83 c4 10 add $0x10,%esp
(*f0)->type = FD_PIPE;
801040ed: 8b 45 08 mov 0x8(%ebp),%eax
801040f0: 8b 00 mov (%eax),%eax
801040f2: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f0)->readable = 1;
801040f8: 8b 45 08 mov 0x8(%ebp),%eax
801040fb: 8b 00 mov (%eax),%eax
801040fd: c6 40 08 01 movb $0x1,0x8(%eax)
(*f0)->writable = 0;
80104101: 8b 45 08 mov 0x8(%ebp),%eax
80104104: 8b 00 mov (%eax),%eax
80104106: c6 40 09 00 movb $0x0,0x9(%eax)
(*f0)->pipe = p;
8010410a: 8b 45 08 mov 0x8(%ebp),%eax
8010410d: 8b 00 mov (%eax),%eax
8010410f: 8b 55 f4 mov -0xc(%ebp),%edx
80104112: 89 50 0c mov %edx,0xc(%eax)
(*f1)->type = FD_PIPE;
80104115: 8b 45 0c mov 0xc(%ebp),%eax
80104118: 8b 00 mov (%eax),%eax
8010411a: c7 00 01 00 00 00 movl $0x1,(%eax)
(*f1)->readable = 0;
80104120: 8b 45 0c mov 0xc(%ebp),%eax
80104123: 8b 00 mov (%eax),%eax
80104125: c6 40 08 00 movb $0x0,0x8(%eax)
(*f1)->writable = 1;
80104129: 8b 45 0c mov 0xc(%ebp),%eax
8010412c: 8b 00 mov (%eax),%eax
8010412e: c6 40 09 01 movb $0x1,0x9(%eax)
(*f1)->pipe = p;
80104132: 8b 45 0c mov 0xc(%ebp),%eax
80104135: 8b 00 mov (%eax),%eax
80104137: 8b 55 f4 mov -0xc(%ebp),%edx
8010413a: 89 50 0c mov %edx,0xc(%eax)
return 0;
8010413d: b8 00 00 00 00 mov $0x0,%eax
80104142: eb 4e jmp 80104192 <pipealloc+0x151>
p = 0;
*f0 = *f1 = 0;
if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
goto bad;
if((p = (struct pipe*)kalloc()) == 0)
goto bad;
80104144: 90 nop
(*f1)->pipe = p;
return 0;
//PAGEBREAK: 20
bad:
if(p)
80104145: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80104149: 74 0e je 80104159 <pipealloc+0x118>
kfree((char*)p);
8010414b: 83 ec 0c sub $0xc,%esp
8010414e: ff 75 f4 pushl -0xc(%ebp)
80104151: e8 73 ea ff ff call 80102bc9 <kfree>
80104156: 83 c4 10 add $0x10,%esp
if(*f0)
80104159: 8b 45 08 mov 0x8(%ebp),%eax
8010415c: 8b 00 mov (%eax),%eax
8010415e: 85 c0 test %eax,%eax
80104160: 74 11 je 80104173 <pipealloc+0x132>
fileclose(*f0);
80104162: 8b 45 08 mov 0x8(%ebp),%eax
80104165: 8b 00 mov (%eax),%eax
80104167: 83 ec 0c sub $0xc,%esp
8010416a: 50 push %eax
8010416b: e8 e1 ce ff ff call 80101051 <fileclose>
80104170: 83 c4 10 add $0x10,%esp
if(*f1)
80104173: 8b 45 0c mov 0xc(%ebp),%eax
80104176: 8b 00 mov (%eax),%eax
80104178: 85 c0 test %eax,%eax
8010417a: 74 11 je 8010418d <pipealloc+0x14c>
fileclose(*f1);
8010417c: 8b 45 0c mov 0xc(%ebp),%eax
8010417f: 8b 00 mov (%eax),%eax
80104181: 83 ec 0c sub $0xc,%esp
80104184: 50 push %eax
80104185: e8 c7 ce ff ff call 80101051 <fileclose>
8010418a: 83 c4 10 add $0x10,%esp
return -1;
8010418d: b8 ff ff ff ff mov $0xffffffff,%eax
}
80104192: c9 leave
80104193: c3 ret
80104194 <pipeclose>:
void
pipeclose(struct pipe *p, int writable)
{
80104194: 55 push %ebp
80104195: 89 e5 mov %esp,%ebp
80104197: 83 ec 08 sub $0x8,%esp
acquire(&p->lock);
8010419a: 8b 45 08 mov 0x8(%ebp),%eax
8010419d: 83 ec 0c sub $0xc,%esp
801041a0: 50 push %eax
801041a1: e8 97 14 00 00 call 8010563d <acquire>
801041a6: 83 c4 10 add $0x10,%esp
if(writable){
801041a9: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
801041ad: 74 23 je 801041d2 <pipeclose+0x3e>
p->writeopen = 0;
801041af: 8b 45 08 mov 0x8(%ebp),%eax
801041b2: c7 80 40 02 00 00 00 movl $0x0,0x240(%eax)
801041b9: 00 00 00
wakeup(&p->nread);
801041bc: 8b 45 08 mov 0x8(%ebp),%eax
801041bf: 05 34 02 00 00 add $0x234,%eax
801041c4: 83 ec 0c sub $0xc,%esp
801041c7: 50 push %eax
801041c8: e8 5c 12 00 00 call 80105429 <wakeup>
801041cd: 83 c4 10 add $0x10,%esp
801041d0: eb 21 jmp 801041f3 <pipeclose+0x5f>
} else {
p->readopen = 0;
801041d2: 8b 45 08 mov 0x8(%ebp),%eax
801041d5: c7 80 3c 02 00 00 00 movl $0x0,0x23c(%eax)
801041dc: 00 00 00
wakeup(&p->nwrite);
801041df: 8b 45 08 mov 0x8(%ebp),%eax
801041e2: 05 38 02 00 00 add $0x238,%eax
801041e7: 83 ec 0c sub $0xc,%esp
801041ea: 50 push %eax
801041eb: e8 39 12 00 00 call 80105429 <wakeup>
801041f0: 83 c4 10 add $0x10,%esp
}
if(p->readopen == 0 && p->writeopen == 0){
801041f3: 8b 45 08 mov 0x8(%ebp),%eax
801041f6: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
801041fc: 85 c0 test %eax,%eax
801041fe: 75 2c jne 8010422c <pipeclose+0x98>
80104200: 8b 45 08 mov 0x8(%ebp),%eax
80104203: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
80104209: 85 c0 test %eax,%eax
8010420b: 75 1f jne 8010422c <pipeclose+0x98>
release(&p->lock);
8010420d: 8b 45 08 mov 0x8(%ebp),%eax
80104210: 83 ec 0c sub $0xc,%esp
80104213: 50 push %eax
80104214: e8 8b 14 00 00 call 801056a4 <release>
80104219: 83 c4 10 add $0x10,%esp
kfree((char*)p);
8010421c: 83 ec 0c sub $0xc,%esp
8010421f: ff 75 08 pushl 0x8(%ebp)
80104222: e8 a2 e9 ff ff call 80102bc9 <kfree>
80104227: 83 c4 10 add $0x10,%esp
8010422a: eb 0f jmp 8010423b <pipeclose+0xa7>
} else
release(&p->lock);
8010422c: 8b 45 08 mov 0x8(%ebp),%eax
8010422f: 83 ec 0c sub $0xc,%esp
80104232: 50 push %eax
80104233: e8 6c 14 00 00 call 801056a4 <release>
80104238: 83 c4 10 add $0x10,%esp
}
8010423b: 90 nop
8010423c: c9 leave
8010423d: c3 ret
8010423e <pipewrite>:
//PAGEBREAK: 40
int
pipewrite(struct pipe *p, char *addr, int n)
{
8010423e: 55 push %ebp
8010423f: 89 e5 mov %esp,%ebp
80104241: 83 ec 18 sub $0x18,%esp
int i;
acquire(&p->lock);
80104244: 8b 45 08 mov 0x8(%ebp),%eax
80104247: 83 ec 0c sub $0xc,%esp
8010424a: 50 push %eax
8010424b: e8 ed 13 00 00 call 8010563d <acquire>
80104250: 83 c4 10 add $0x10,%esp
for(i = 0; i < n; i++){
80104253: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010425a: e9 ad 00 00 00 jmp 8010430c <pipewrite+0xce>
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
if(p->readopen == 0 || proc->killed){
8010425f: 8b 45 08 mov 0x8(%ebp),%eax
80104262: 8b 80 3c 02 00 00 mov 0x23c(%eax),%eax
80104268: 85 c0 test %eax,%eax
8010426a: 74 0d je 80104279 <pipewrite+0x3b>
8010426c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104272: 8b 40 24 mov 0x24(%eax),%eax
80104275: 85 c0 test %eax,%eax
80104277: 74 19 je 80104292 <pipewrite+0x54>
release(&p->lock);
80104279: 8b 45 08 mov 0x8(%ebp),%eax
8010427c: 83 ec 0c sub $0xc,%esp
8010427f: 50 push %eax
80104280: e8 1f 14 00 00 call 801056a4 <release>
80104285: 83 c4 10 add $0x10,%esp
return -1;
80104288: b8 ff ff ff ff mov $0xffffffff,%eax
8010428d: e9 a8 00 00 00 jmp 8010433a <pipewrite+0xfc>
}
wakeup(&p->nread);
80104292: 8b 45 08 mov 0x8(%ebp),%eax
80104295: 05 34 02 00 00 add $0x234,%eax
8010429a: 83 ec 0c sub $0xc,%esp
8010429d: 50 push %eax
8010429e: e8 86 11 00 00 call 80105429 <wakeup>
801042a3: 83 c4 10 add $0x10,%esp
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
801042a6: 8b 45 08 mov 0x8(%ebp),%eax
801042a9: 8b 55 08 mov 0x8(%ebp),%edx
801042ac: 81 c2 38 02 00 00 add $0x238,%edx
801042b2: 83 ec 08 sub $0x8,%esp
801042b5: 50 push %eax
801042b6: 52 push %edx
801042b7: e8 7f 10 00 00 call 8010533b <sleep>
801042bc: 83 c4 10 add $0x10,%esp
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
while(p->nwrite == p->nread + PIPESIZE){ //DOC: pipewrite-full
801042bf: 8b 45 08 mov 0x8(%ebp),%eax
801042c2: 8b 90 38 02 00 00 mov 0x238(%eax),%edx
801042c8: 8b 45 08 mov 0x8(%ebp),%eax
801042cb: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
801042d1: 05 00 02 00 00 add $0x200,%eax
801042d6: 39 c2 cmp %eax,%edx
801042d8: 74 85 je 8010425f <pipewrite+0x21>
return -1;
}
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
801042da: 8b 45 08 mov 0x8(%ebp),%eax
801042dd: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
801042e3: 8d 48 01 lea 0x1(%eax),%ecx
801042e6: 8b 55 08 mov 0x8(%ebp),%edx
801042e9: 89 8a 38 02 00 00 mov %ecx,0x238(%edx)
801042ef: 25 ff 01 00 00 and $0x1ff,%eax
801042f4: 89 c1 mov %eax,%ecx
801042f6: 8b 55 f4 mov -0xc(%ebp),%edx
801042f9: 8b 45 0c mov 0xc(%ebp),%eax
801042fc: 01 d0 add %edx,%eax
801042fe: 0f b6 10 movzbl (%eax),%edx
80104301: 8b 45 08 mov 0x8(%ebp),%eax
80104304: 88 54 08 34 mov %dl,0x34(%eax,%ecx,1)
pipewrite(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
for(i = 0; i < n; i++){
80104308: 83 45 f4 01 addl $0x1,-0xc(%ebp)
8010430c: 8b 45 f4 mov -0xc(%ebp),%eax
8010430f: 3b 45 10 cmp 0x10(%ebp),%eax
80104312: 7c ab jl 801042bf <pipewrite+0x81>
wakeup(&p->nread);
sleep(&p->nwrite, &p->lock); //DOC: pipewrite-sleep
}
p->data[p->nwrite++ % PIPESIZE] = addr[i];
}
wakeup(&p->nread); //DOC: pipewrite-wakeup1
80104314: 8b 45 08 mov 0x8(%ebp),%eax
80104317: 05 34 02 00 00 add $0x234,%eax
8010431c: 83 ec 0c sub $0xc,%esp
8010431f: 50 push %eax
80104320: e8 04 11 00 00 call 80105429 <wakeup>
80104325: 83 c4 10 add $0x10,%esp
release(&p->lock);
80104328: 8b 45 08 mov 0x8(%ebp),%eax
8010432b: 83 ec 0c sub $0xc,%esp
8010432e: 50 push %eax
8010432f: e8 70 13 00 00 call 801056a4 <release>
80104334: 83 c4 10 add $0x10,%esp
return n;
80104337: 8b 45 10 mov 0x10(%ebp),%eax
}
8010433a: c9 leave
8010433b: c3 ret
8010433c <piperead>:
int
piperead(struct pipe *p, char *addr, int n)
{
8010433c: 55 push %ebp
8010433d: 89 e5 mov %esp,%ebp
8010433f: 53 push %ebx
80104340: 83 ec 14 sub $0x14,%esp
int i;
acquire(&p->lock);
80104343: 8b 45 08 mov 0x8(%ebp),%eax
80104346: 83 ec 0c sub $0xc,%esp
80104349: 50 push %eax
8010434a: e8 ee 12 00 00 call 8010563d <acquire>
8010434f: 83 c4 10 add $0x10,%esp
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80104352: eb 3f jmp 80104393 <piperead+0x57>
if(proc->killed){
80104354: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010435a: 8b 40 24 mov 0x24(%eax),%eax
8010435d: 85 c0 test %eax,%eax
8010435f: 74 19 je 8010437a <piperead+0x3e>
release(&p->lock);
80104361: 8b 45 08 mov 0x8(%ebp),%eax
80104364: 83 ec 0c sub $0xc,%esp
80104367: 50 push %eax
80104368: e8 37 13 00 00 call 801056a4 <release>
8010436d: 83 c4 10 add $0x10,%esp
return -1;
80104370: b8 ff ff ff ff mov $0xffffffff,%eax
80104375: e9 bf 00 00 00 jmp 80104439 <piperead+0xfd>
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
8010437a: 8b 45 08 mov 0x8(%ebp),%eax
8010437d: 8b 55 08 mov 0x8(%ebp),%edx
80104380: 81 c2 34 02 00 00 add $0x234,%edx
80104386: 83 ec 08 sub $0x8,%esp
80104389: 50 push %eax
8010438a: 52 push %edx
8010438b: e8 ab 0f 00 00 call 8010533b <sleep>
80104390: 83 c4 10 add $0x10,%esp
piperead(struct pipe *p, char *addr, int n)
{
int i;
acquire(&p->lock);
while(p->nread == p->nwrite && p->writeopen){ //DOC: pipe-empty
80104393: 8b 45 08 mov 0x8(%ebp),%eax
80104396: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
8010439c: 8b 45 08 mov 0x8(%ebp),%eax
8010439f: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
801043a5: 39 c2 cmp %eax,%edx
801043a7: 75 0d jne 801043b6 <piperead+0x7a>
801043a9: 8b 45 08 mov 0x8(%ebp),%eax
801043ac: 8b 80 40 02 00 00 mov 0x240(%eax),%eax
801043b2: 85 c0 test %eax,%eax
801043b4: 75 9e jne 80104354 <piperead+0x18>
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
801043b6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801043bd: eb 49 jmp 80104408 <piperead+0xcc>
if(p->nread == p->nwrite)
801043bf: 8b 45 08 mov 0x8(%ebp),%eax
801043c2: 8b 90 34 02 00 00 mov 0x234(%eax),%edx
801043c8: 8b 45 08 mov 0x8(%ebp),%eax
801043cb: 8b 80 38 02 00 00 mov 0x238(%eax),%eax
801043d1: 39 c2 cmp %eax,%edx
801043d3: 74 3d je 80104412 <piperead+0xd6>
break;
addr[i] = p->data[p->nread++ % PIPESIZE];
801043d5: 8b 55 f4 mov -0xc(%ebp),%edx
801043d8: 8b 45 0c mov 0xc(%ebp),%eax
801043db: 8d 1c 02 lea (%edx,%eax,1),%ebx
801043de: 8b 45 08 mov 0x8(%ebp),%eax
801043e1: 8b 80 34 02 00 00 mov 0x234(%eax),%eax
801043e7: 8d 48 01 lea 0x1(%eax),%ecx
801043ea: 8b 55 08 mov 0x8(%ebp),%edx
801043ed: 89 8a 34 02 00 00 mov %ecx,0x234(%edx)
801043f3: 25 ff 01 00 00 and $0x1ff,%eax
801043f8: 89 c2 mov %eax,%edx
801043fa: 8b 45 08 mov 0x8(%ebp),%eax
801043fd: 0f b6 44 10 34 movzbl 0x34(%eax,%edx,1),%eax
80104402: 88 03 mov %al,(%ebx)
release(&p->lock);
return -1;
}
sleep(&p->nread, &p->lock); //DOC: piperead-sleep
}
for(i = 0; i < n; i++){ //DOC: piperead-copy
80104404: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80104408: 8b 45 f4 mov -0xc(%ebp),%eax
8010440b: 3b 45 10 cmp 0x10(%ebp),%eax
8010440e: 7c af jl 801043bf <piperead+0x83>
80104410: eb 01 jmp 80104413 <piperead+0xd7>
if(p->nread == p->nwrite)
break;
80104412: 90 nop
addr[i] = p->data[p->nread++ % PIPESIZE];
}
wakeup(&p->nwrite); //DOC: piperead-wakeup
80104413: 8b 45 08 mov 0x8(%ebp),%eax
80104416: 05 38 02 00 00 add $0x238,%eax
8010441b: 83 ec 0c sub $0xc,%esp
8010441e: 50 push %eax
8010441f: e8 05 10 00 00 call 80105429 <wakeup>
80104424: 83 c4 10 add $0x10,%esp
release(&p->lock);
80104427: 8b 45 08 mov 0x8(%ebp),%eax
8010442a: 83 ec 0c sub $0xc,%esp
8010442d: 50 push %eax
8010442e: e8 71 12 00 00 call 801056a4 <release>
80104433: 83 c4 10 add $0x10,%esp
return i;
80104436: 8b 45 f4 mov -0xc(%ebp),%eax
}
80104439: 8b 5d fc mov -0x4(%ebp),%ebx
8010443c: c9 leave
8010443d: c3 ret
8010443e <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
8010443e: 55 push %ebp
8010443f: 89 e5 mov %esp,%ebp
80104441: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
80104444: 9c pushf
80104445: 58 pop %eax
80104446: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
80104449: 8b 45 fc mov -0x4(%ebp),%eax
}
8010444c: c9 leave
8010444d: c3 ret
8010444e <sti>:
asm volatile("cli");
}
static inline void
sti(void)
{
8010444e: 55 push %ebp
8010444f: 89 e5 mov %esp,%ebp
asm volatile("sti");
80104451: fb sti
}
80104452: 90 nop
80104453: 5d pop %ebp
80104454: c3 ret
80104455 <random>:
#include "defs.h"
// Return a integer between 0 and ((2^32 - 1) / 2), which is 2147483647.
uint
random(void)
{
80104455: 55 push %ebp
80104456: 89 e5 mov %esp,%ebp
80104458: 83 ec 10 sub $0x10,%esp
// Take from http://stackoverflow.com/questions/1167253/implementation-of-rand
static unsigned int z1 = 12345, z2 = 12345, z3 = 12345, z4 = 12345;
unsigned int b;
b = ((z1 << 6) ^ z1) >> 13;
8010445b: a1 08 c0 10 80 mov 0x8010c008,%eax
80104460: c1 e0 06 shl $0x6,%eax
80104463: 89 c2 mov %eax,%edx
80104465: a1 08 c0 10 80 mov 0x8010c008,%eax
8010446a: 31 d0 xor %edx,%eax
8010446c: c1 e8 0d shr $0xd,%eax
8010446f: 89 45 fc mov %eax,-0x4(%ebp)
z1 = ((z1 & 4294967294U) << 18) ^ b;
80104472: a1 08 c0 10 80 mov 0x8010c008,%eax
80104477: 83 e0 fe and $0xfffffffe,%eax
8010447a: c1 e0 12 shl $0x12,%eax
8010447d: 33 45 fc xor -0x4(%ebp),%eax
80104480: a3 08 c0 10 80 mov %eax,0x8010c008
b = ((z2 << 2) ^ z2) >> 27;
80104485: a1 0c c0 10 80 mov 0x8010c00c,%eax
8010448a: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80104491: a1 0c c0 10 80 mov 0x8010c00c,%eax
80104496: 31 d0 xor %edx,%eax
80104498: c1 e8 1b shr $0x1b,%eax
8010449b: 89 45 fc mov %eax,-0x4(%ebp)
z2 = ((z2 & 4294967288U) << 2) ^ b;
8010449e: a1 0c c0 10 80 mov 0x8010c00c,%eax
801044a3: 83 e0 f8 and $0xfffffff8,%eax
801044a6: c1 e0 02 shl $0x2,%eax
801044a9: 33 45 fc xor -0x4(%ebp),%eax
801044ac: a3 0c c0 10 80 mov %eax,0x8010c00c
b = ((z3 << 13) ^ z3) >> 21;
801044b1: a1 10 c0 10 80 mov 0x8010c010,%eax
801044b6: c1 e0 0d shl $0xd,%eax
801044b9: 89 c2 mov %eax,%edx
801044bb: a1 10 c0 10 80 mov 0x8010c010,%eax
801044c0: 31 d0 xor %edx,%eax
801044c2: c1 e8 15 shr $0x15,%eax
801044c5: 89 45 fc mov %eax,-0x4(%ebp)
z3 = ((z3 & 4294967280U) << 7) ^ b;
801044c8: a1 10 c0 10 80 mov 0x8010c010,%eax
801044cd: 83 e0 f0 and $0xfffffff0,%eax
801044d0: c1 e0 07 shl $0x7,%eax
801044d3: 33 45 fc xor -0x4(%ebp),%eax
801044d6: a3 10 c0 10 80 mov %eax,0x8010c010
b = ((z4 << 3) ^ z4) >> 12;
801044db: a1 14 c0 10 80 mov 0x8010c014,%eax
801044e0: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
801044e7: a1 14 c0 10 80 mov 0x8010c014,%eax
801044ec: 31 d0 xor %edx,%eax
801044ee: c1 e8 0c shr $0xc,%eax
801044f1: 89 45 fc mov %eax,-0x4(%ebp)
z4 = ((z4 & 4294967168U) << 13) ^ b;
801044f4: a1 14 c0 10 80 mov 0x8010c014,%eax
801044f9: 83 e0 80 and $0xffffff80,%eax
801044fc: c1 e0 0d shl $0xd,%eax
801044ff: 33 45 fc xor -0x4(%ebp),%eax
80104502: a3 14 c0 10 80 mov %eax,0x8010c014
return (z1 ^ z2 ^ z3 ^ z4) / 2;
80104507: 8b 15 08 c0 10 80 mov 0x8010c008,%edx
8010450d: a1 0c c0 10 80 mov 0x8010c00c,%eax
80104512: 31 c2 xor %eax,%edx
80104514: a1 10 c0 10 80 mov 0x8010c010,%eax
80104519: 31 c2 xor %eax,%edx
8010451b: a1 14 c0 10 80 mov 0x8010c014,%eax
80104520: 31 d0 xor %edx,%eax
80104522: d1 e8 shr %eax
}
80104524: c9 leave
80104525: c3 ret
80104526 <randomrange>:
// Return a random integer between a given range.
int
randomrange(int lo, int hi)
{
80104526: 55 push %ebp
80104527: 89 e5 mov %esp,%ebp
80104529: 83 ec 10 sub $0x10,%esp
if (hi < lo) {
8010452c: 8b 45 0c mov 0xc(%ebp),%eax
8010452f: 3b 45 08 cmp 0x8(%ebp),%eax
80104532: 7d 12 jge 80104546 <randomrange+0x20>
int tmp = lo;
80104534: 8b 45 08 mov 0x8(%ebp),%eax
80104537: 89 45 fc mov %eax,-0x4(%ebp)
lo = hi;
8010453a: 8b 45 0c mov 0xc(%ebp),%eax
8010453d: 89 45 08 mov %eax,0x8(%ebp)
hi = tmp;
80104540: 8b 45 fc mov -0x4(%ebp),%eax
80104543: 89 45 0c mov %eax,0xc(%ebp)
}
int range = hi - lo + 1;
80104546: 8b 45 0c mov 0xc(%ebp),%eax
80104549: 2b 45 08 sub 0x8(%ebp),%eax
8010454c: 83 c0 01 add $0x1,%eax
8010454f: 89 45 f8 mov %eax,-0x8(%ebp)
return random() % (range) + lo;
80104552: e8 fe fe ff ff call 80104455 <random>
80104557: 8b 4d f8 mov -0x8(%ebp),%ecx
8010455a: ba 00 00 00 00 mov $0x0,%edx
8010455f: f7 f1 div %ecx
80104561: 8b 45 08 mov 0x8(%ebp),%eax
80104564: 01 d0 add %edx,%eax
}
80104566: c9 leave
80104567: c3 ret
80104568 <pinit>:
static void wakeup1(void *chan);
void
pinit(void)
{
80104568: 55 push %ebp
80104569: 89 e5 mov %esp,%ebp
8010456b: 83 ec 08 sub $0x8,%esp
initlock(&ptable.lock, "ptable");
8010456e: 83 ec 08 sub $0x8,%esp
80104571: 68 b0 8e 10 80 push $0x80108eb0
80104576: 68 60 39 11 80 push $0x80113960
8010457b: e8 9b 10 00 00 call 8010561b <initlock>
80104580: 83 c4 10 add $0x10,%esp
}
80104583: 90 nop
80104584: c9 leave
80104585: c3 ret
80104586 <allocproc>:
// If found, change state to EMBRYO and initialize
// state required to run in the kernel.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
80104586: 55 push %ebp
80104587: 89 e5 mov %esp,%ebp
80104589: 83 ec 18 sub $0x18,%esp
struct proc *p;
char *sp;
acquire(&ptable.lock);
8010458c: 83 ec 0c sub $0xc,%esp
8010458f: 68 60 39 11 80 push $0x80113960
80104594: e8 a4 10 00 00 call 8010563d <acquire>
80104599: 83 c4 10 add $0x10,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
8010459c: c7 45 f4 94 39 11 80 movl $0x80113994,-0xc(%ebp)
801045a3: eb 11 jmp 801045b6 <allocproc+0x30>
if(p->state == UNUSED)
801045a5: 8b 45 f4 mov -0xc(%ebp),%eax
801045a8: 8b 40 0c mov 0xc(%eax),%eax
801045ab: 85 c0 test %eax,%eax
801045ad: 74 2a je 801045d9 <allocproc+0x53>
{
struct proc *p;
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801045af: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
801045b6: 81 7d f4 94 5a 11 80 cmpl $0x80115a94,-0xc(%ebp)
801045bd: 72 e6 jb 801045a5 <allocproc+0x1f>
if(p->state == UNUSED)
goto found;
release(&ptable.lock);
801045bf: 83 ec 0c sub $0xc,%esp
801045c2: 68 60 39 11 80 push $0x80113960
801045c7: e8 d8 10 00 00 call 801056a4 <release>
801045cc: 83 c4 10 add $0x10,%esp
return 0;
801045cf: b8 00 00 00 00 mov $0x0,%eax
801045d4: e9 cb 00 00 00 jmp 801046a4 <allocproc+0x11e>
char *sp;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
if(p->state == UNUSED)
goto found;
801045d9: 90 nop
release(&ptable.lock);
return 0;
found:
p->state = EMBRYO;
801045da: 8b 45 f4 mov -0xc(%ebp),%eax
801045dd: c7 40 0c 01 00 00 00 movl $0x1,0xc(%eax)
p->queuetype = 0;
801045e4: 8b 45 f4 mov -0xc(%ebp),%eax
801045e7: c7 40 7c 00 00 00 00 movl $0x0,0x7c(%eax)
p->quantumsize = 0;
801045ee: 8b 45 f4 mov -0xc(%ebp),%eax
801045f1: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
801045f8: 00 00 00
p->pid = nextpid++;
801045fb: a1 04 c0 10 80 mov 0x8010c004,%eax
80104600: 8d 50 01 lea 0x1(%eax),%edx
80104603: 89 15 04 c0 10 80 mov %edx,0x8010c004
80104609: 8b 55 f4 mov -0xc(%ebp),%edx
8010460c: 89 42 10 mov %eax,0x10(%edx)
release(&ptable.lock);
8010460f: 83 ec 0c sub $0xc,%esp
80104612: 68 60 39 11 80 push $0x80113960
80104617: e8 88 10 00 00 call 801056a4 <release>
8010461c: 83 c4 10 add $0x10,%esp
// Allocate kernel stack.
if((p->kstack = kalloc()) == 0){
8010461f: e8 42 e6 ff ff call 80102c66 <kalloc>
80104624: 89 c2 mov %eax,%edx
80104626: 8b 45 f4 mov -0xc(%ebp),%eax
80104629: 89 50 08 mov %edx,0x8(%eax)
8010462c: 8b 45 f4 mov -0xc(%ebp),%eax
8010462f: 8b 40 08 mov 0x8(%eax),%eax
80104632: 85 c0 test %eax,%eax
80104634: 75 11 jne 80104647 <allocproc+0xc1>
p->state = UNUSED;
80104636: 8b 45 f4 mov -0xc(%ebp),%eax
80104639: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return 0;
80104640: b8 00 00 00 00 mov $0x0,%eax
80104645: eb 5d jmp 801046a4 <allocproc+0x11e>
}
sp = p->kstack + KSTACKSIZE;
80104647: 8b 45 f4 mov -0xc(%ebp),%eax
8010464a: 8b 40 08 mov 0x8(%eax),%eax
8010464d: 05 00 10 00 00 add $0x1000,%eax
80104652: 89 45 f0 mov %eax,-0x10(%ebp)
// Leave room for trap frame.
sp -= sizeof *p->tf;
80104655: 83 6d f0 4c subl $0x4c,-0x10(%ebp)
p->tf = (struct trapframe*)sp;
80104659: 8b 45 f4 mov -0xc(%ebp),%eax
8010465c: 8b 55 f0 mov -0x10(%ebp),%edx
8010465f: 89 50 18 mov %edx,0x18(%eax)
// Set up new context to start executing at forkret,
// which returns to trapret.
sp -= 4;
80104662: 83 6d f0 04 subl $0x4,-0x10(%ebp)
*(uint*)sp = (uint)trapret;
80104666: ba 7a 6c 10 80 mov $0x80106c7a,%edx
8010466b: 8b 45 f0 mov -0x10(%ebp),%eax
8010466e: 89 10 mov %edx,(%eax)
sp -= sizeof *p->context;
80104670: 83 6d f0 14 subl $0x14,-0x10(%ebp)
p->context = (struct context*)sp;
80104674: 8b 45 f4 mov -0xc(%ebp),%eax
80104677: 8b 55 f0 mov -0x10(%ebp),%edx
8010467a: 89 50 1c mov %edx,0x1c(%eax)
memset(p->context, 0, sizeof *p->context);
8010467d: 8b 45 f4 mov -0xc(%ebp),%eax
80104680: 8b 40 1c mov 0x1c(%eax),%eax
80104683: 83 ec 04 sub $0x4,%esp
80104686: 6a 14 push $0x14
80104688: 6a 00 push $0x0
8010468a: 50 push %eax
8010468b: e8 10 12 00 00 call 801058a0 <memset>
80104690: 83 c4 10 add $0x10,%esp
p->context->eip = (uint)forkret;
80104693: 8b 45 f4 mov -0xc(%ebp),%eax
80104696: 8b 40 1c mov 0x1c(%eax),%eax
80104699: ba f5 52 10 80 mov $0x801052f5,%edx
8010469e: 89 50 10 mov %edx,0x10(%eax)
return p;
801046a1: 8b 45 f4 mov -0xc(%ebp),%eax
}
801046a4: c9 leave
801046a5: c3 ret
801046a6 <userinit>:
//PAGEBREAK: 32
// Set up first user process.
void
userinit(void)
{
801046a6: 55 push %ebp
801046a7: 89 e5 mov %esp,%ebp
801046a9: 83 ec 18 sub $0x18,%esp
struct proc *p;
extern char _binary_initcode_start[], _binary_initcode_size[];
p = allocproc();
801046ac: e8 d5 fe ff ff call 80104586 <allocproc>
801046b1: 89 45 f4 mov %eax,-0xc(%ebp)
initproc = p;
801046b4: 8b 45 f4 mov -0xc(%ebp),%eax
801046b7: a3 48 c6 10 80 mov %eax,0x8010c648
if((p->pgdir = setupkvm()) == 0)
801046bc: e8 7e 3c 00 00 call 8010833f <setupkvm>
801046c1: 89 c2 mov %eax,%edx
801046c3: 8b 45 f4 mov -0xc(%ebp),%eax
801046c6: 89 50 04 mov %edx,0x4(%eax)
801046c9: 8b 45 f4 mov -0xc(%ebp),%eax
801046cc: 8b 40 04 mov 0x4(%eax),%eax
801046cf: 85 c0 test %eax,%eax
801046d1: 75 0d jne 801046e0 <userinit+0x3a>
panic("userinit: out of memory?");
801046d3: 83 ec 0c sub $0xc,%esp
801046d6: 68 b7 8e 10 80 push $0x80108eb7
801046db: e8 86 be ff ff call 80100566 <panic>
inituvm(p->pgdir, _binary_initcode_start, (int)_binary_initcode_size);
801046e0: ba 2c 00 00 00 mov $0x2c,%edx
801046e5: 8b 45 f4 mov -0xc(%ebp),%eax
801046e8: 8b 40 04 mov 0x4(%eax),%eax
801046eb: 83 ec 04 sub $0x4,%esp
801046ee: 52 push %edx
801046ef: 68 e0 c4 10 80 push $0x8010c4e0
801046f4: 50 push %eax
801046f5: e8 9f 3e 00 00 call 80108599 <inituvm>
801046fa: 83 c4 10 add $0x10,%esp
p->sz = PGSIZE;
801046fd: 8b 45 f4 mov -0xc(%ebp),%eax
80104700: c7 00 00 10 00 00 movl $0x1000,(%eax)
memset(p->tf, 0, sizeof(*p->tf));
80104706: 8b 45 f4 mov -0xc(%ebp),%eax
80104709: 8b 40 18 mov 0x18(%eax),%eax
8010470c: 83 ec 04 sub $0x4,%esp
8010470f: 6a 4c push $0x4c
80104711: 6a 00 push $0x0
80104713: 50 push %eax
80104714: e8 87 11 00 00 call 801058a0 <memset>
80104719: 83 c4 10 add $0x10,%esp
p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
8010471c: 8b 45 f4 mov -0xc(%ebp),%eax
8010471f: 8b 40 18 mov 0x18(%eax),%eax
80104722: 66 c7 40 3c 23 00 movw $0x23,0x3c(%eax)
p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
80104728: 8b 45 f4 mov -0xc(%ebp),%eax
8010472b: 8b 40 18 mov 0x18(%eax),%eax
8010472e: 66 c7 40 2c 2b 00 movw $0x2b,0x2c(%eax)
p->tf->es = p->tf->ds;
80104734: 8b 45 f4 mov -0xc(%ebp),%eax
80104737: 8b 40 18 mov 0x18(%eax),%eax
8010473a: 8b 55 f4 mov -0xc(%ebp),%edx
8010473d: 8b 52 18 mov 0x18(%edx),%edx
80104740: 0f b7 52 2c movzwl 0x2c(%edx),%edx
80104744: 66 89 50 28 mov %dx,0x28(%eax)
p->tf->ss = p->tf->ds;
80104748: 8b 45 f4 mov -0xc(%ebp),%eax
8010474b: 8b 40 18 mov 0x18(%eax),%eax
8010474e: 8b 55 f4 mov -0xc(%ebp),%edx
80104751: 8b 52 18 mov 0x18(%edx),%edx
80104754: 0f b7 52 2c movzwl 0x2c(%edx),%edx
80104758: 66 89 50 48 mov %dx,0x48(%eax)
p->tf->eflags = FL_IF;
8010475c: 8b 45 f4 mov -0xc(%ebp),%eax
8010475f: 8b 40 18 mov 0x18(%eax),%eax
80104762: c7 40 40 00 02 00 00 movl $0x200,0x40(%eax)
p->tf->esp = PGSIZE;
80104769: 8b 45 f4 mov -0xc(%ebp),%eax
8010476c: 8b 40 18 mov 0x18(%eax),%eax
8010476f: c7 40 44 00 10 00 00 movl $0x1000,0x44(%eax)
p->tf->eip = 0; // beginning of initcode.S
80104776: 8b 45 f4 mov -0xc(%ebp),%eax
80104779: 8b 40 18 mov 0x18(%eax),%eax
8010477c: c7 40 38 00 00 00 00 movl $0x0,0x38(%eax)
safestrcpy(p->name, "initcode", sizeof(p->name));
80104783: 8b 45 f4 mov -0xc(%ebp),%eax
80104786: 83 c0 6c add $0x6c,%eax
80104789: 83 ec 04 sub $0x4,%esp
8010478c: 6a 10 push $0x10
8010478e: 68 d0 8e 10 80 push $0x80108ed0
80104793: 50 push %eax
80104794: e8 0a 13 00 00 call 80105aa3 <safestrcpy>
80104799: 83 c4 10 add $0x10,%esp
p->cwd = namei("/");
8010479c: 83 ec 0c sub $0xc,%esp
8010479f: 68 d9 8e 10 80 push $0x80108ed9
801047a4: e8 7f dd ff ff call 80102528 <namei>
801047a9: 83 c4 10 add $0x10,%esp
801047ac: 89 c2 mov %eax,%edx
801047ae: 8b 45 f4 mov -0xc(%ebp),%eax
801047b1: 89 50 68 mov %edx,0x68(%eax)
p->state = RUNNABLE;
801047b4: 8b 45 f4 mov -0xc(%ebp),%eax
801047b7: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
}
801047be: 90 nop
801047bf: c9 leave
801047c0: c3 ret
801047c1 <growproc>:
// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
801047c1: 55 push %ebp
801047c2: 89 e5 mov %esp,%ebp
801047c4: 83 ec 18 sub $0x18,%esp
uint sz;
sz = proc->sz;
801047c7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047cd: 8b 00 mov (%eax),%eax
801047cf: 89 45 f4 mov %eax,-0xc(%ebp)
if(n > 0){
801047d2: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
801047d6: 7e 31 jle 80104809 <growproc+0x48>
if((sz = allocuvm(proc->pgdir, sz, sz + n)) == 0)
801047d8: 8b 55 08 mov 0x8(%ebp),%edx
801047db: 8b 45 f4 mov -0xc(%ebp),%eax
801047de: 01 c2 add %eax,%edx
801047e0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801047e6: 8b 40 04 mov 0x4(%eax),%eax
801047e9: 83 ec 04 sub $0x4,%esp
801047ec: 52 push %edx
801047ed: ff 75 f4 pushl -0xc(%ebp)
801047f0: 50 push %eax
801047f1: e8 f0 3e 00 00 call 801086e6 <allocuvm>
801047f6: 83 c4 10 add $0x10,%esp
801047f9: 89 45 f4 mov %eax,-0xc(%ebp)
801047fc: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80104800: 75 3e jne 80104840 <growproc+0x7f>
return -1;
80104802: b8 ff ff ff ff mov $0xffffffff,%eax
80104807: eb 59 jmp 80104862 <growproc+0xa1>
} else if(n < 0){
80104809: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
8010480d: 79 31 jns 80104840 <growproc+0x7f>
if((sz = deallocuvm(proc->pgdir, sz, sz + n)) == 0)
8010480f: 8b 55 08 mov 0x8(%ebp),%edx
80104812: 8b 45 f4 mov -0xc(%ebp),%eax
80104815: 01 c2 add %eax,%edx
80104817: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010481d: 8b 40 04 mov 0x4(%eax),%eax
80104820: 83 ec 04 sub $0x4,%esp
80104823: 52 push %edx
80104824: ff 75 f4 pushl -0xc(%ebp)
80104827: 50 push %eax
80104828: e8 82 3f 00 00 call 801087af <deallocuvm>
8010482d: 83 c4 10 add $0x10,%esp
80104830: 89 45 f4 mov %eax,-0xc(%ebp)
80104833: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80104837: 75 07 jne 80104840 <growproc+0x7f>
return -1;
80104839: b8 ff ff ff ff mov $0xffffffff,%eax
8010483e: eb 22 jmp 80104862 <growproc+0xa1>
}
proc->sz = sz;
80104840: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104846: 8b 55 f4 mov -0xc(%ebp),%edx
80104849: 89 10 mov %edx,(%eax)
switchuvm(proc);
8010484b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104851: 83 ec 0c sub $0xc,%esp
80104854: 50 push %eax
80104855: e8 cc 3b 00 00 call 80108426 <switchuvm>
8010485a: 83 c4 10 add $0x10,%esp
return 0;
8010485d: b8 00 00 00 00 mov $0x0,%eax
}
80104862: c9 leave
80104863: c3 ret
80104864 <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
80104864: 55 push %ebp
80104865: 89 e5 mov %esp,%ebp
80104867: 57 push %edi
80104868: 56 push %esi
80104869: 53 push %ebx
8010486a: 83 ec 1c sub $0x1c,%esp
int i, pid;
struct proc *np;
// Allocate process.
if((np = allocproc()) == 0)
8010486d: e8 14 fd ff ff call 80104586 <allocproc>
80104872: 89 45 e0 mov %eax,-0x20(%ebp)
80104875: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
80104879: 75 0a jne 80104885 <fork+0x21>
return -1;
8010487b: b8 ff ff ff ff mov $0xffffffff,%eax
80104880: e9 68 01 00 00 jmp 801049ed <fork+0x189>
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
80104885: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010488b: 8b 10 mov (%eax),%edx
8010488d: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104893: 8b 40 04 mov 0x4(%eax),%eax
80104896: 83 ec 08 sub $0x8,%esp
80104899: 52 push %edx
8010489a: 50 push %eax
8010489b: e8 ad 40 00 00 call 8010894d <copyuvm>
801048a0: 83 c4 10 add $0x10,%esp
801048a3: 89 c2 mov %eax,%edx
801048a5: 8b 45 e0 mov -0x20(%ebp),%eax
801048a8: 89 50 04 mov %edx,0x4(%eax)
801048ab: 8b 45 e0 mov -0x20(%ebp),%eax
801048ae: 8b 40 04 mov 0x4(%eax),%eax
801048b1: 85 c0 test %eax,%eax
801048b3: 75 30 jne 801048e5 <fork+0x81>
kfree(np->kstack);
801048b5: 8b 45 e0 mov -0x20(%ebp),%eax
801048b8: 8b 40 08 mov 0x8(%eax),%eax
801048bb: 83 ec 0c sub $0xc,%esp
801048be: 50 push %eax
801048bf: e8 05 e3 ff ff call 80102bc9 <kfree>
801048c4: 83 c4 10 add $0x10,%esp
np->kstack = 0;
801048c7: 8b 45 e0 mov -0x20(%ebp),%eax
801048ca: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
np->state = UNUSED;
801048d1: 8b 45 e0 mov -0x20(%ebp),%eax
801048d4: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
return -1;
801048db: b8 ff ff ff ff mov $0xffffffff,%eax
801048e0: e9 08 01 00 00 jmp 801049ed <fork+0x189>
}
np->sz = proc->sz;
801048e5: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801048eb: 8b 10 mov (%eax),%edx
801048ed: 8b 45 e0 mov -0x20(%ebp),%eax
801048f0: 89 10 mov %edx,(%eax)
np->parent = proc;
801048f2: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
801048f9: 8b 45 e0 mov -0x20(%ebp),%eax
801048fc: 89 50 14 mov %edx,0x14(%eax)
*np->tf = *proc->tf;
801048ff: 8b 45 e0 mov -0x20(%ebp),%eax
80104902: 8b 50 18 mov 0x18(%eax),%edx
80104905: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010490b: 8b 40 18 mov 0x18(%eax),%eax
8010490e: 89 c3 mov %eax,%ebx
80104910: b8 13 00 00 00 mov $0x13,%eax
80104915: 89 d7 mov %edx,%edi
80104917: 89 de mov %ebx,%esi
80104919: 89 c1 mov %eax,%ecx
8010491b: f3 a5 rep movsl %ds:(%esi),%es:(%edi)
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
8010491d: 8b 45 e0 mov -0x20(%ebp),%eax
80104920: 8b 40 18 mov 0x18(%eax),%eax
80104923: c7 40 1c 00 00 00 00 movl $0x0,0x1c(%eax)
for(i = 0; i < NOFILE; i++)
8010492a: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
80104931: eb 43 jmp 80104976 <fork+0x112>
if(proc->ofile[i])
80104933: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104939: 8b 55 e4 mov -0x1c(%ebp),%edx
8010493c: 83 c2 08 add $0x8,%edx
8010493f: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104943: 85 c0 test %eax,%eax
80104945: 74 2b je 80104972 <fork+0x10e>
np->ofile[i] = filedup(proc->ofile[i]);
80104947: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010494d: 8b 55 e4 mov -0x1c(%ebp),%edx
80104950: 83 c2 08 add $0x8,%edx
80104953: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104957: 83 ec 0c sub $0xc,%esp
8010495a: 50 push %eax
8010495b: e8 a0 c6 ff ff call 80101000 <filedup>
80104960: 83 c4 10 add $0x10,%esp
80104963: 89 c1 mov %eax,%ecx
80104965: 8b 45 e0 mov -0x20(%ebp),%eax
80104968: 8b 55 e4 mov -0x1c(%ebp),%edx
8010496b: 83 c2 08 add $0x8,%edx
8010496e: 89 4c 90 08 mov %ecx,0x8(%eax,%edx,4)
*np->tf = *proc->tf;
// Clear %eax so that fork returns 0 in the child.
np->tf->eax = 0;
for(i = 0; i < NOFILE; i++)
80104972: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
80104976: 83 7d e4 0f cmpl $0xf,-0x1c(%ebp)
8010497a: 7e b7 jle 80104933 <fork+0xcf>
if(proc->ofile[i])
np->ofile[i] = filedup(proc->ofile[i]);
np->cwd = idup(proc->cwd);
8010497c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104982: 8b 40 68 mov 0x68(%eax),%eax
80104985: 83 ec 0c sub $0xc,%esp
80104988: 50 push %eax
80104989: e8 a2 cf ff ff call 80101930 <idup>
8010498e: 83 c4 10 add $0x10,%esp
80104991: 89 c2 mov %eax,%edx
80104993: 8b 45 e0 mov -0x20(%ebp),%eax
80104996: 89 50 68 mov %edx,0x68(%eax)
safestrcpy(np->name, proc->name, sizeof(proc->name));
80104999: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010499f: 8d 50 6c lea 0x6c(%eax),%edx
801049a2: 8b 45 e0 mov -0x20(%ebp),%eax
801049a5: 83 c0 6c add $0x6c,%eax
801049a8: 83 ec 04 sub $0x4,%esp
801049ab: 6a 10 push $0x10
801049ad: 52 push %edx
801049ae: 50 push %eax
801049af: e8 ef 10 00 00 call 80105aa3 <safestrcpy>
801049b4: 83 c4 10 add $0x10,%esp
pid = np->pid;
801049b7: 8b 45 e0 mov -0x20(%ebp),%eax
801049ba: 8b 40 10 mov 0x10(%eax),%eax
801049bd: 89 45 dc mov %eax,-0x24(%ebp)
// lock to force the compiler to emit the np->state write last.
acquire(&ptable.lock);
801049c0: 83 ec 0c sub $0xc,%esp
801049c3: 68 60 39 11 80 push $0x80113960
801049c8: e8 70 0c 00 00 call 8010563d <acquire>
801049cd: 83 c4 10 add $0x10,%esp
np->state = RUNNABLE;
801049d0: 8b 45 e0 mov -0x20(%ebp),%eax
801049d3: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
801049da: 83 ec 0c sub $0xc,%esp
801049dd: 68 60 39 11 80 push $0x80113960
801049e2: e8 bd 0c 00 00 call 801056a4 <release>
801049e7: 83 c4 10 add $0x10,%esp
return pid;
801049ea: 8b 45 dc mov -0x24(%ebp),%eax
}
801049ed: 8d 65 f4 lea -0xc(%ebp),%esp
801049f0: 5b pop %ebx
801049f1: 5e pop %esi
801049f2: 5f pop %edi
801049f3: 5d pop %ebp
801049f4: c3 ret
801049f5 <exit>:
// Exit the current process. Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
801049f5: 55 push %ebp
801049f6: 89 e5 mov %esp,%ebp
801049f8: 83 ec 18 sub $0x18,%esp
struct proc *p;
int fd;
if(proc == initproc)
801049fb: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80104a02: a1 48 c6 10 80 mov 0x8010c648,%eax
80104a07: 39 c2 cmp %eax,%edx
80104a09: 75 0d jne 80104a18 <exit+0x23>
panic("init exiting");
80104a0b: 83 ec 0c sub $0xc,%esp
80104a0e: 68 db 8e 10 80 push $0x80108edb
80104a13: e8 4e bb ff ff call 80100566 <panic>
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80104a18: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
80104a1f: eb 48 jmp 80104a69 <exit+0x74>
if(proc->ofile[fd]){
80104a21: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a27: 8b 55 f0 mov -0x10(%ebp),%edx
80104a2a: 83 c2 08 add $0x8,%edx
80104a2d: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104a31: 85 c0 test %eax,%eax
80104a33: 74 30 je 80104a65 <exit+0x70>
fileclose(proc->ofile[fd]);
80104a35: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a3b: 8b 55 f0 mov -0x10(%ebp),%edx
80104a3e: 83 c2 08 add $0x8,%edx
80104a41: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80104a45: 83 ec 0c sub $0xc,%esp
80104a48: 50 push %eax
80104a49: e8 03 c6 ff ff call 80101051 <fileclose>
80104a4e: 83 c4 10 add $0x10,%esp
proc->ofile[fd] = 0;
80104a51: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a57: 8b 55 f0 mov -0x10(%ebp),%edx
80104a5a: 83 c2 08 add $0x8,%edx
80104a5d: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80104a64: 00
if(proc == initproc)
panic("init exiting");
// Close all open files.
for(fd = 0; fd < NOFILE; fd++){
80104a65: 83 45 f0 01 addl $0x1,-0x10(%ebp)
80104a69: 83 7d f0 0f cmpl $0xf,-0x10(%ebp)
80104a6d: 7e b2 jle 80104a21 <exit+0x2c>
fileclose(proc->ofile[fd]);
proc->ofile[fd] = 0;
}
}
begin_op();
80104a6f: e8 d9 ea ff ff call 8010354d <begin_op>
iput(proc->cwd);
80104a74: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a7a: 8b 40 68 mov 0x68(%eax),%eax
80104a7d: 83 ec 0c sub $0xc,%esp
80104a80: 50 push %eax
80104a81: e8 b4 d0 ff ff call 80101b3a <iput>
80104a86: 83 c4 10 add $0x10,%esp
end_op();
80104a89: e8 4b eb ff ff call 801035d9 <end_op>
proc->cwd = 0;
80104a8e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104a94: c7 40 68 00 00 00 00 movl $0x0,0x68(%eax)
acquire(&ptable.lock);
80104a9b: 83 ec 0c sub $0xc,%esp
80104a9e: 68 60 39 11 80 push $0x80113960
80104aa3: e8 95 0b 00 00 call 8010563d <acquire>
80104aa8: 83 c4 10 add $0x10,%esp
// Parent might be sleeping in wait().
wakeup1(proc->parent);
80104aab: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104ab1: 8b 40 14 mov 0x14(%eax),%eax
80104ab4: 83 ec 0c sub $0xc,%esp
80104ab7: 50 push %eax
80104ab8: e8 2a 09 00 00 call 801053e7 <wakeup1>
80104abd: 83 c4 10 add $0x10,%esp
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104ac0: c7 45 f4 94 39 11 80 movl $0x80113994,-0xc(%ebp)
80104ac7: eb 3f jmp 80104b08 <exit+0x113>
if(p->parent == proc){
80104ac9: 8b 45 f4 mov -0xc(%ebp),%eax
80104acc: 8b 50 14 mov 0x14(%eax),%edx
80104acf: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104ad5: 39 c2 cmp %eax,%edx
80104ad7: 75 28 jne 80104b01 <exit+0x10c>
p->parent = initproc;
80104ad9: 8b 15 48 c6 10 80 mov 0x8010c648,%edx
80104adf: 8b 45 f4 mov -0xc(%ebp),%eax
80104ae2: 89 50 14 mov %edx,0x14(%eax)
if(p->state == ZOMBIE)
80104ae5: 8b 45 f4 mov -0xc(%ebp),%eax
80104ae8: 8b 40 0c mov 0xc(%eax),%eax
80104aeb: 83 f8 05 cmp $0x5,%eax
80104aee: 75 11 jne 80104b01 <exit+0x10c>
wakeup1(initproc);
80104af0: a1 48 c6 10 80 mov 0x8010c648,%eax
80104af5: 83 ec 0c sub $0xc,%esp
80104af8: 50 push %eax
80104af9: e8 e9 08 00 00 call 801053e7 <wakeup1>
80104afe: 83 c4 10 add $0x10,%esp
// Parent might be sleeping in wait().
wakeup1(proc->parent);
// Pass abandoned children to init.
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b01: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104b08: 81 7d f4 94 5a 11 80 cmpl $0x80115a94,-0xc(%ebp)
80104b0f: 72 b8 jb 80104ac9 <exit+0xd4>
wakeup1(initproc);
}
}
// Jump into the scheduler, never to return.
proc->state = ZOMBIE;
80104b11: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b17: c7 40 0c 05 00 00 00 movl $0x5,0xc(%eax)
//change queue length here
sched();
80104b1e: e8 db 06 00 00 call 801051fe <sched>
panic("zombie exit");
80104b23: 83 ec 0c sub $0xc,%esp
80104b26: 68 e8 8e 10 80 push $0x80108ee8
80104b2b: e8 36 ba ff ff call 80100566 <panic>
80104b30 <wait>:
// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
80104b30: 55 push %ebp
80104b31: 89 e5 mov %esp,%ebp
80104b33: 83 ec 18 sub $0x18,%esp
struct proc *p;
int havekids, pid;
acquire(&ptable.lock);
80104b36: 83 ec 0c sub $0xc,%esp
80104b39: 68 60 39 11 80 push $0x80113960
80104b3e: e8 fa 0a 00 00 call 8010563d <acquire>
80104b43: 83 c4 10 add $0x10,%esp
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
80104b46: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104b4d: c7 45 f4 94 39 11 80 movl $0x80113994,-0xc(%ebp)
80104b54: e9 a9 00 00 00 jmp 80104c02 <wait+0xd2>
if(p->parent != proc)
80104b59: 8b 45 f4 mov -0xc(%ebp),%eax
80104b5c: 8b 50 14 mov 0x14(%eax),%edx
80104b5f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104b65: 39 c2 cmp %eax,%edx
80104b67: 0f 85 8d 00 00 00 jne 80104bfa <wait+0xca>
continue;
havekids = 1;
80104b6d: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
if(p->state == ZOMBIE){
80104b74: 8b 45 f4 mov -0xc(%ebp),%eax
80104b77: 8b 40 0c mov 0xc(%eax),%eax
80104b7a: 83 f8 05 cmp $0x5,%eax
80104b7d: 75 7c jne 80104bfb <wait+0xcb>
// Found one.
pid = p->pid;
80104b7f: 8b 45 f4 mov -0xc(%ebp),%eax
80104b82: 8b 40 10 mov 0x10(%eax),%eax
80104b85: 89 45 ec mov %eax,-0x14(%ebp)
kfree(p->kstack);
80104b88: 8b 45 f4 mov -0xc(%ebp),%eax
80104b8b: 8b 40 08 mov 0x8(%eax),%eax
80104b8e: 83 ec 0c sub $0xc,%esp
80104b91: 50 push %eax
80104b92: e8 32 e0 ff ff call 80102bc9 <kfree>
80104b97: 83 c4 10 add $0x10,%esp
p->kstack = 0;
80104b9a: 8b 45 f4 mov -0xc(%ebp),%eax
80104b9d: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
freevm(p->pgdir);
80104ba4: 8b 45 f4 mov -0xc(%ebp),%eax
80104ba7: 8b 40 04 mov 0x4(%eax),%eax
80104baa: 83 ec 0c sub $0xc,%esp
80104bad: 50 push %eax
80104bae: e8 b9 3c 00 00 call 8010886c <freevm>
80104bb3: 83 c4 10 add $0x10,%esp
p->state = UNUSED;
80104bb6: 8b 45 f4 mov -0xc(%ebp),%eax
80104bb9: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
p->pid = 0;
80104bc0: 8b 45 f4 mov -0xc(%ebp),%eax
80104bc3: c7 40 10 00 00 00 00 movl $0x0,0x10(%eax)
p->parent = 0;
80104bca: 8b 45 f4 mov -0xc(%ebp),%eax
80104bcd: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
p->name[0] = 0;
80104bd4: 8b 45 f4 mov -0xc(%ebp),%eax
80104bd7: c6 40 6c 00 movb $0x0,0x6c(%eax)
p->killed = 0;
80104bdb: 8b 45 f4 mov -0xc(%ebp),%eax
80104bde: c7 40 24 00 00 00 00 movl $0x0,0x24(%eax)
release(&ptable.lock);
80104be5: 83 ec 0c sub $0xc,%esp
80104be8: 68 60 39 11 80 push $0x80113960
80104bed: e8 b2 0a 00 00 call 801056a4 <release>
80104bf2: 83 c4 10 add $0x10,%esp
return pid;
80104bf5: 8b 45 ec mov -0x14(%ebp),%eax
80104bf8: eb 5b jmp 80104c55 <wait+0x125>
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->parent != proc)
continue;
80104bfa: 90 nop
acquire(&ptable.lock);
for(;;){
// Scan through table looking for zombie children.
havekids = 0;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104bfb: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104c02: 81 7d f4 94 5a 11 80 cmpl $0x80115a94,-0xc(%ebp)
80104c09: 0f 82 4a ff ff ff jb 80104b59 <wait+0x29>
return pid;
}
}
// No point waiting if we don't have any children.
if(!havekids || proc->killed){
80104c0f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80104c13: 74 0d je 80104c22 <wait+0xf2>
80104c15: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104c1b: 8b 40 24 mov 0x24(%eax),%eax
80104c1e: 85 c0 test %eax,%eax
80104c20: 74 17 je 80104c39 <wait+0x109>
release(&ptable.lock);
80104c22: 83 ec 0c sub $0xc,%esp
80104c25: 68 60 39 11 80 push $0x80113960
80104c2a: e8 75 0a 00 00 call 801056a4 <release>
80104c2f: 83 c4 10 add $0x10,%esp
return -1;
80104c32: b8 ff ff ff ff mov $0xffffffff,%eax
80104c37: eb 1c jmp 80104c55 <wait+0x125>
}
// Wait for children to exit. (See wakeup1 call in proc_exit.)
sleep(proc, &ptable.lock); //DOC: wait-sleep
80104c39: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104c3f: 83 ec 08 sub $0x8,%esp
80104c42: 68 60 39 11 80 push $0x80113960
80104c47: 50 push %eax
80104c48: e8 ee 06 00 00 call 8010533b <sleep>
80104c4d: 83 c4 10 add $0x10,%esp
}
80104c50: e9 f1 fe ff ff jmp 80104b46 <wait+0x16>
}
80104c55: c9 leave
80104c56: c3 ret
80104c57 <scheduler>:
// - swtch to start running that process
// - eventually that process transfers control
// via swtch back to the scheduler.
void
scheduler(void)
{
80104c57: 55 push %ebp
80104c58: 89 e5 mov %esp,%ebp
80104c5a: 53 push %ebx
80104c5b: 83 ec 14 sub $0x14,%esp
struct proc *p;
for(;;){
// Enable interrupts on this processor.
sti();
80104c5e: e8 eb f7 ff ff call 8010444e <sti>
// Loop over process table looking for process to run.
acquire(&ptable.lock);
80104c63: 83 ec 0c sub $0xc,%esp
80104c66: 68 60 39 11 80 push $0x80113960
80104c6b: e8 cd 09 00 00 call 8010563d <acquire>
80104c70: 83 c4 10 add $0x10,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104c73: c7 45 f4 94 39 11 80 movl $0x80113994,-0xc(%ebp)
80104c7a: e9 b9 01 00 00 jmp 80104e38 <scheduler+0x1e1>
if(p->state != RUNNABLE)
80104c7f: 8b 45 f4 mov -0xc(%ebp),%eax
80104c82: 8b 40 0c mov 0xc(%eax),%eax
80104c85: 83 f8 03 cmp $0x3,%eax
80104c88: 0f 85 a2 01 00 00 jne 80104e30 <scheduler+0x1d9>
continue;
p = &ptable.proc[randomrange(0, 63)];
80104c8e: 83 ec 08 sub $0x8,%esp
80104c91: 6a 3f push $0x3f
80104c93: 6a 00 push $0x0
80104c95: e8 8c f8 ff ff call 80104526 <randomrange>
80104c9a: 83 c4 10 add $0x10,%esp
80104c9d: c1 e0 02 shl $0x2,%eax
80104ca0: 89 c2 mov %eax,%edx
80104ca2: c1 e2 05 shl $0x5,%edx
80104ca5: 01 d0 add %edx,%eax
80104ca7: 83 c0 30 add $0x30,%eax
80104caa: 05 60 39 11 80 add $0x80113960,%eax
80104caf: 83 c0 04 add $0x4,%eax
80104cb2: 89 45 f4 mov %eax,-0xc(%ebp)
while(p->queuetype == 0 && p->state == RUNNABLE){//search for Q1 processes
80104cb5: e9 50 01 00 00 jmp 80104e0a <scheduler+0x1b3>
proc = p;
80104cba: 8b 45 f4 mov -0xc(%ebp),%eax
80104cbd: 65 a3 04 00 00 00 mov %eax,%gs:0x4
switchuvm(p);
80104cc3: 83 ec 0c sub $0xc,%esp
80104cc6: ff 75 f4 pushl -0xc(%ebp)
80104cc9: e8 58 37 00 00 call 80108426 <switchuvm>
80104cce: 83 c4 10 add $0x10,%esp
p->state = RUNNING;
80104cd1: 8b 45 f4 mov -0xc(%ebp),%eax
80104cd4: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax)
p->quantumsize+= 10; //increment quantumsize
80104cdb: 8b 45 f4 mov -0xc(%ebp),%eax
80104cde: 8b 80 80 00 00 00 mov 0x80(%eax),%eax
80104ce4: 8d 50 0a lea 0xa(%eax),%edx
80104ce7: 8b 45 f4 mov -0xc(%ebp),%eax
80104cea: 89 90 80 00 00 00 mov %edx,0x80(%eax)
if(strncmp(p->name, "sh", 2) == 0 || strncmp(p->name, "spin", 4) == 0){
80104cf0: 8b 45 f4 mov -0xc(%ebp),%eax
80104cf3: 83 c0 6c add $0x6c,%eax
80104cf6: 83 ec 04 sub $0x4,%esp
80104cf9: 6a 02 push $0x2
80104cfb: 68 f4 8e 10 80 push $0x80108ef4
80104d00: 50 push %eax
80104d01: e8 ef 0c 00 00 call 801059f5 <strncmp>
80104d06: 83 c4 10 add $0x10,%esp
80104d09: 85 c0 test %eax,%eax
80104d0b: 74 1d je 80104d2a <scheduler+0xd3>
80104d0d: 8b 45 f4 mov -0xc(%ebp),%eax
80104d10: 83 c0 6c add $0x6c,%eax
80104d13: 83 ec 04 sub $0x4,%esp
80104d16: 6a 04 push $0x4
80104d18: 68 f7 8e 10 80 push $0x80108ef7
80104d1d: 50 push %eax
80104d1e: e8 d2 0c 00 00 call 801059f5 <strncmp>
80104d23: 83 c4 10 add $0x10,%esp
80104d26: 85 c0 test %eax,%eax
80104d28: 75 32 jne 80104d5c <scheduler+0x105>
cprintf("Process %s %d has consumed 10 ms in Q%d, Total Quantum %d \n", p->name, p->pid, p->queuetype + 1, p->quantumsize);
80104d2a: 8b 45 f4 mov -0xc(%ebp),%eax
80104d2d: 8b 90 80 00 00 00 mov 0x80(%eax),%edx
80104d33: 8b 45 f4 mov -0xc(%ebp),%eax
80104d36: 8b 40 7c mov 0x7c(%eax),%eax
80104d39: 8d 58 01 lea 0x1(%eax),%ebx
80104d3c: 8b 45 f4 mov -0xc(%ebp),%eax
80104d3f: 8b 40 10 mov 0x10(%eax),%eax
80104d42: 8b 4d f4 mov -0xc(%ebp),%ecx
80104d45: 83 c1 6c add $0x6c,%ecx
80104d48: 83 ec 0c sub $0xc,%esp
80104d4b: 52 push %edx
80104d4c: 53 push %ebx
80104d4d: 50 push %eax
80104d4e: 51 push %ecx
80104d4f: 68 fc 8e 10 80 push $0x80108efc
80104d54: e8 6d b6 ff ff call 801003c6 <cprintf>
80104d59: 83 c4 20 add $0x20,%esp
}
if(p->quantumsize == 30){//once the quantumsize is reached
80104d5c: 8b 45 f4 mov -0xc(%ebp),%eax
80104d5f: 8b 80 80 00 00 00 mov 0x80(%eax),%eax
80104d65: 83 f8 1e cmp $0x1e,%eax
80104d68: 75 7b jne 80104de5 <scheduler+0x18e>
p->queuetype++;//increment the queuetype, which will break the condition in the while loop
80104d6a: 8b 45 f4 mov -0xc(%ebp),%eax
80104d6d: 8b 40 7c mov 0x7c(%eax),%eax
80104d70: 8d 50 01 lea 0x1(%eax),%edx
80104d73: 8b 45 f4 mov -0xc(%ebp),%eax
80104d76: 89 50 7c mov %edx,0x7c(%eax)
p->quantumsize = 0;
80104d79: 8b 45 f4 mov -0xc(%ebp),%eax
80104d7c: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
80104d83: 00 00 00
if(strncmp(p->name, "sh", 2) == 0 || strncmp(p->name, "spin", 4) == 0){
80104d86: 8b 45 f4 mov -0xc(%ebp),%eax
80104d89: 83 c0 6c add $0x6c,%eax
80104d8c: 83 ec 04 sub $0x4,%esp
80104d8f: 6a 02 push $0x2
80104d91: 68 f4 8e 10 80 push $0x80108ef4
80104d96: 50 push %eax
80104d97: e8 59 0c 00 00 call 801059f5 <strncmp>
80104d9c: 83 c4 10 add $0x10,%esp
80104d9f: 85 c0 test %eax,%eax
80104da1: 74 1d je 80104dc0 <scheduler+0x169>
80104da3: 8b 45 f4 mov -0xc(%ebp),%eax
80104da6: 83 c0 6c add $0x6c,%eax
80104da9: 83 ec 04 sub $0x4,%esp
80104dac: 6a 04 push $0x4
80104dae: 68 f7 8e 10 80 push $0x80108ef7
80104db3: 50 push %eax
80104db4: e8 3c 0c 00 00 call 801059f5 <strncmp>
80104db9: 83 c4 10 add $0x10,%esp
80104dbc: 85 c0 test %eax,%eax
80104dbe: 75 25 jne 80104de5 <scheduler+0x18e>
cprintf("Process Name: %s, Process ID %d, is moving to Queue %d\n", p->name, p->pid, p->queuetype + 1);
80104dc0: 8b 45 f4 mov -0xc(%ebp),%eax
80104dc3: 8b 40 7c mov 0x7c(%eax),%eax
80104dc6: 8d 48 01 lea 0x1(%eax),%ecx
80104dc9: 8b 45 f4 mov -0xc(%ebp),%eax
80104dcc: 8b 40 10 mov 0x10(%eax),%eax
80104dcf: 8b 55 f4 mov -0xc(%ebp),%edx
80104dd2: 83 c2 6c add $0x6c,%edx
80104dd5: 51 push %ecx
80104dd6: 50 push %eax
80104dd7: 52 push %edx
80104dd8: 68 38 8f 10 80 push $0x80108f38
80104ddd: e8 e4 b5 ff ff call 801003c6 <cprintf>
80104de2: 83 c4 10 add $0x10,%esp
}
}
swtch(&cpu->scheduler, proc->context); ////run proc which holds a Q1 process
80104de5: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104deb: 8b 40 1c mov 0x1c(%eax),%eax
80104dee: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80104df5: 83 c2 04 add $0x4,%edx
80104df8: 83 ec 08 sub $0x8,%esp
80104dfb: 50 push %eax
80104dfc: 52 push %edx
80104dfd: e8 12 0d 00 00 call 80105b14 <swtch>
80104e02: 83 c4 10 add $0x10,%esp
switchkvm();
80104e05: e8 ff 35 00 00 call 80108409 <switchkvm>
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
p = &ptable.proc[randomrange(0, 63)];
while(p->queuetype == 0 && p->state == RUNNABLE){//search for Q1 processes
80104e0a: 8b 45 f4 mov -0xc(%ebp),%eax
80104e0d: 8b 40 7c mov 0x7c(%eax),%eax
80104e10: 85 c0 test %eax,%eax
80104e12: 75 0f jne 80104e23 <scheduler+0x1cc>
80104e14: 8b 45 f4 mov -0xc(%ebp),%eax
80104e17: 8b 40 0c mov 0xc(%eax),%eax
80104e1a: 83 f8 03 cmp $0x3,%eax
80104e1d: 0f 84 97 fe ff ff je 80104cba <scheduler+0x63>
}
}
swtch(&cpu->scheduler, proc->context); ////run proc which holds a Q1 process
switchkvm();
}//end of Q1 while loop
proc = 0;
80104e23: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80104e2a: 00 00 00 00
80104e2e: eb 01 jmp 80104e31 <scheduler+0x1da>
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
80104e30: 90 nop
// Enable interrupts on this processor.
sti();
// Loop over process table looking for process to run.
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104e31: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
80104e38: 81 7d f4 94 5a 11 80 cmpl $0x80115a94,-0xc(%ebp)
80104e3f: 0f 82 3a fe ff ff jb 80104c7f <scheduler+0x28>
swtch(&cpu->scheduler, proc->context); ////run proc which holds a Q1 process
switchkvm();
}//end of Q1 while loop
proc = 0;
}//end of second for loop that searches for Q1 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80104e45: c7 45 f4 94 39 11 80 movl $0x80113994,-0xc(%ebp)
80104e4c: e9 ba 01 00 00 jmp 8010500b <scheduler+0x3b4>
if(p->state != RUNNABLE)
80104e51: 8b 45 f4 mov -0xc(%ebp),%eax
80104e54: 8b 40 0c mov 0xc(%eax),%eax
80104e57: 83 f8 03 cmp $0x3,%eax
80104e5a: 0f 85 a3 01 00 00 jne 80105003 <scheduler+0x3ac>
continue;
p = &ptable.proc[randomrange(0, 63)];
80104e60: 83 ec 08 sub $0x8,%esp
80104e63: 6a 3f push $0x3f
80104e65: 6a 00 push $0x0
80104e67: e8 ba f6 ff ff call 80104526 <randomrange>
80104e6c: 83 c4 10 add $0x10,%esp
80104e6f: c1 e0 02 shl $0x2,%eax
80104e72: 89 c2 mov %eax,%edx
80104e74: c1 e2 05 shl $0x5,%edx
80104e77: 01 d0 add %edx,%eax
80104e79: 83 c0 30 add $0x30,%eax
80104e7c: 05 60 39 11 80 add $0x80113960,%eax
80104e81: 83 c0 04 add $0x4,%eax
80104e84: 89 45 f4 mov %eax,-0xc(%ebp)
while(p->queuetype == 1 && p->state == RUNNABLE){//search for Q2 processes
80104e87: e9 50 01 00 00 jmp 80104fdc <scheduler+0x385>
proc = p;
80104e8c: 8b 45 f4 mov -0xc(%ebp),%eax
80104e8f: 65 a3 04 00 00 00 mov %eax,%gs:0x4
switchuvm(p);
80104e95: 83 ec 0c sub $0xc,%esp
80104e98: ff 75 f4 pushl -0xc(%ebp)
80104e9b: e8 86 35 00 00 call 80108426 <switchuvm>
80104ea0: 83 c4 10 add $0x10,%esp
p->state = RUNNING;
80104ea3: 8b 45 f4 mov -0xc(%ebp),%eax
80104ea6: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax)
p->quantumsize+= 10;
80104ead: 8b 45 f4 mov -0xc(%ebp),%eax
80104eb0: 8b 80 80 00 00 00 mov 0x80(%eax),%eax
80104eb6: 8d 50 0a lea 0xa(%eax),%edx
80104eb9: 8b 45 f4 mov -0xc(%ebp),%eax
80104ebc: 89 90 80 00 00 00 mov %edx,0x80(%eax)
if(strncmp(p->name, "sh", 2) == 0 || strncmp(p->name, "spin", 4) == 0){
80104ec2: 8b 45 f4 mov -0xc(%ebp),%eax
80104ec5: 83 c0 6c add $0x6c,%eax
80104ec8: 83 ec 04 sub $0x4,%esp
80104ecb: 6a 02 push $0x2
80104ecd: 68 f4 8e 10 80 push $0x80108ef4
80104ed2: 50 push %eax
80104ed3: e8 1d 0b 00 00 call 801059f5 <strncmp>
80104ed8: 83 c4 10 add $0x10,%esp
80104edb: 85 c0 test %eax,%eax
80104edd: 74 1d je 80104efc <scheduler+0x2a5>
80104edf: 8b 45 f4 mov -0xc(%ebp),%eax
80104ee2: 83 c0 6c add $0x6c,%eax
80104ee5: 83 ec 04 sub $0x4,%esp
80104ee8: 6a 04 push $0x4
80104eea: 68 f7 8e 10 80 push $0x80108ef7
80104eef: 50 push %eax
80104ef0: e8 00 0b 00 00 call 801059f5 <strncmp>
80104ef5: 83 c4 10 add $0x10,%esp
80104ef8: 85 c0 test %eax,%eax
80104efa: 75 32 jne 80104f2e <scheduler+0x2d7>
cprintf("Process %s %d has consumed 10 ms in Q%d, Total Quantum %d \n", p->name, p->pid, p->queuetype + 1, p->quantumsize);
80104efc: 8b 45 f4 mov -0xc(%ebp),%eax
80104eff: 8b 90 80 00 00 00 mov 0x80(%eax),%edx
80104f05: 8b 45 f4 mov -0xc(%ebp),%eax
80104f08: 8b 40 7c mov 0x7c(%eax),%eax
80104f0b: 8d 58 01 lea 0x1(%eax),%ebx
80104f0e: 8b 45 f4 mov -0xc(%ebp),%eax
80104f11: 8b 40 10 mov 0x10(%eax),%eax
80104f14: 8b 4d f4 mov -0xc(%ebp),%ecx
80104f17: 83 c1 6c add $0x6c,%ecx
80104f1a: 83 ec 0c sub $0xc,%esp
80104f1d: 52 push %edx
80104f1e: 53 push %ebx
80104f1f: 50 push %eax
80104f20: 51 push %ecx
80104f21: 68 fc 8e 10 80 push $0x80108efc
80104f26: e8 9b b4 ff ff call 801003c6 <cprintf>
80104f2b: 83 c4 20 add $0x20,%esp
}
if(p->quantumsize == 60){//check if process exceed Q2 quantum size
80104f2e: 8b 45 f4 mov -0xc(%ebp),%eax
80104f31: 8b 80 80 00 00 00 mov 0x80(%eax),%eax
80104f37: 83 f8 3c cmp $0x3c,%eax
80104f3a: 75 7b jne 80104fb7 <scheduler+0x360>
p->queuetype++;
80104f3c: 8b 45 f4 mov -0xc(%ebp),%eax
80104f3f: 8b 40 7c mov 0x7c(%eax),%eax
80104f42: 8d 50 01 lea 0x1(%eax),%edx
80104f45: 8b 45 f4 mov -0xc(%ebp),%eax
80104f48: 89 50 7c mov %edx,0x7c(%eax)
p->quantumsize = 0;
80104f4b: 8b 45 f4 mov -0xc(%ebp),%eax
80104f4e: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
80104f55: 00 00 00
if(strncmp(p->name, "sh", 2) == 0 || strncmp(p->name, "spin", 4) == 0){
80104f58: 8b 45 f4 mov -0xc(%ebp),%eax
80104f5b: 83 c0 6c add $0x6c,%eax
80104f5e: 83 ec 04 sub $0x4,%esp
80104f61: 6a 02 push $0x2
80104f63: 68 f4 8e 10 80 push $0x80108ef4
80104f68: 50 push %eax
80104f69: e8 87 0a 00 00 call 801059f5 <strncmp>
80104f6e: 83 c4 10 add $0x10,%esp
80104f71: 85 c0 test %eax,%eax
80104f73: 74 1d je 80104f92 <scheduler+0x33b>
80104f75: 8b 45 f4 mov -0xc(%ebp),%eax
80104f78: 83 c0 6c add $0x6c,%eax
80104f7b: 83 ec 04 sub $0x4,%esp
80104f7e: 6a 04 push $0x4
80104f80: 68 f7 8e 10 80 push $0x80108ef7
80104f85: 50 push %eax
80104f86: e8 6a 0a 00 00 call 801059f5 <strncmp>
80104f8b: 83 c4 10 add $0x10,%esp
80104f8e: 85 c0 test %eax,%eax
80104f90: 75 25 jne 80104fb7 <scheduler+0x360>
cprintf("Process Name: %s, Process ID %d, is moving to Queue %d\n", p->name, p->pid, p->queuetype + 1);
80104f92: 8b 45 f4 mov -0xc(%ebp),%eax
80104f95: 8b 40 7c mov 0x7c(%eax),%eax
80104f98: 8d 48 01 lea 0x1(%eax),%ecx
80104f9b: 8b 45 f4 mov -0xc(%ebp),%eax
80104f9e: 8b 40 10 mov 0x10(%eax),%eax
80104fa1: 8b 55 f4 mov -0xc(%ebp),%edx
80104fa4: 83 c2 6c add $0x6c,%edx
80104fa7: 51 push %ecx
80104fa8: 50 push %eax
80104fa9: 52 push %edx
80104faa: 68 38 8f 10 80 push $0x80108f38
80104faf: e8 12 b4 ff ff call 801003c6 <cprintf>
80104fb4: 83 c4 10 add $0x10,%esp
}
}
swtch(&cpu->scheduler, proc->context); //run proc which holds a Q2 process
80104fb7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80104fbd: 8b 40 1c mov 0x1c(%eax),%eax
80104fc0: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80104fc7: 83 c2 04 add $0x4,%edx
80104fca: 83 ec 08 sub $0x8,%esp
80104fcd: 50 push %eax
80104fce: 52 push %edx
80104fcf: e8 40 0b 00 00 call 80105b14 <swtch>
80104fd4: 83 c4 10 add $0x10,%esp
switchkvm();
80104fd7: e8 2d 34 00 00 call 80108409 <switchkvm>
}//end of second for loop that searches for Q1 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
p = &ptable.proc[randomrange(0, 63)];
while(p->queuetype == 1 && p->state == RUNNABLE){//search for Q2 processes
80104fdc: 8b 45 f4 mov -0xc(%ebp),%eax
80104fdf: 8b 40 7c mov 0x7c(%eax),%eax
80104fe2: 83 f8 01 cmp $0x1,%eax
80104fe5: 75 0f jne 80104ff6 <scheduler+0x39f>
80104fe7: 8b 45 f4 mov -0xc(%ebp),%eax
80104fea: 8b 40 0c mov 0xc(%eax),%eax
80104fed: 83 f8 03 cmp $0x3,%eax
80104ff0: 0f 84 96 fe ff ff je 80104e8c <scheduler+0x235>
}
}
swtch(&cpu->scheduler, proc->context); //run proc which holds a Q2 process
switchkvm();
}//end of Q2 while loop
proc = 0;
80104ff6: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80104ffd: 00 00 00 00
80105001: eb 01 jmp 80105004 <scheduler+0x3ad>
}//end of Q1 while loop
proc = 0;
}//end of second for loop that searches for Q1 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
80105003: 90 nop
swtch(&cpu->scheduler, proc->context); ////run proc which holds a Q1 process
switchkvm();
}//end of Q1 while loop
proc = 0;
}//end of second for loop that searches for Q1 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80105004: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
8010500b: 81 7d f4 94 5a 11 80 cmpl $0x80115a94,-0xc(%ebp)
80105012: 0f 82 39 fe ff ff jb 80104e51 <scheduler+0x1fa>
swtch(&cpu->scheduler, proc->context); //run proc which holds a Q2 process
switchkvm();
}//end of Q2 while loop
proc = 0;
}//end of second for loop that searches for Q2 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80105018: c7 45 f4 94 39 11 80 movl $0x80113994,-0xc(%ebp)
8010501f: e9 b8 01 00 00 jmp 801051dc <scheduler+0x585>
if(p->state != RUNNABLE)
80105024: 8b 45 f4 mov -0xc(%ebp),%eax
80105027: 8b 40 0c mov 0xc(%eax),%eax
8010502a: 83 f8 03 cmp $0x3,%eax
8010502d: 0f 85 a1 01 00 00 jne 801051d4 <scheduler+0x57d>
continue;
p = &ptable.proc[randomrange(0, 63)];
80105033: 83 ec 08 sub $0x8,%esp
80105036: 6a 3f push $0x3f
80105038: 6a 00 push $0x0
8010503a: e8 e7 f4 ff ff call 80104526 <randomrange>
8010503f: 83 c4 10 add $0x10,%esp
80105042: c1 e0 02 shl $0x2,%eax
80105045: 89 c2 mov %eax,%edx
80105047: c1 e2 05 shl $0x5,%edx
8010504a: 01 d0 add %edx,%eax
8010504c: 83 c0 30 add $0x30,%eax
8010504f: 05 60 39 11 80 add $0x80113960,%eax
80105054: 83 c0 04 add $0x4,%eax
80105057: 89 45 f4 mov %eax,-0xc(%ebp)
while(p->queuetype == 2 && p->state == RUNNABLE){//search for Q3 processes
8010505a: e9 4e 01 00 00 jmp 801051ad <scheduler+0x556>
proc = p;
8010505f: 8b 45 f4 mov -0xc(%ebp),%eax
80105062: 65 a3 04 00 00 00 mov %eax,%gs:0x4
switchuvm(p);
80105068: 83 ec 0c sub $0xc,%esp
8010506b: ff 75 f4 pushl -0xc(%ebp)
8010506e: e8 b3 33 00 00 call 80108426 <switchuvm>
80105073: 83 c4 10 add $0x10,%esp
p->state = RUNNING;
80105076: 8b 45 f4 mov -0xc(%ebp),%eax
80105079: c7 40 0c 04 00 00 00 movl $0x4,0xc(%eax)
p->quantumsize+= 10;
80105080: 8b 45 f4 mov -0xc(%ebp),%eax
80105083: 8b 80 80 00 00 00 mov 0x80(%eax),%eax
80105089: 8d 50 0a lea 0xa(%eax),%edx
8010508c: 8b 45 f4 mov -0xc(%ebp),%eax
8010508f: 89 90 80 00 00 00 mov %edx,0x80(%eax)
if(strncmp(p->name, "sh", 2) == 0 || strncmp(p->name, "spin", 4) == 0){
80105095: 8b 45 f4 mov -0xc(%ebp),%eax
80105098: 83 c0 6c add $0x6c,%eax
8010509b: 83 ec 04 sub $0x4,%esp
8010509e: 6a 02 push $0x2
801050a0: 68 f4 8e 10 80 push $0x80108ef4
801050a5: 50 push %eax
801050a6: e8 4a 09 00 00 call 801059f5 <strncmp>
801050ab: 83 c4 10 add $0x10,%esp
801050ae: 85 c0 test %eax,%eax
801050b0: 74 1d je 801050cf <scheduler+0x478>
801050b2: 8b 45 f4 mov -0xc(%ebp),%eax
801050b5: 83 c0 6c add $0x6c,%eax
801050b8: 83 ec 04 sub $0x4,%esp
801050bb: 6a 04 push $0x4
801050bd: 68 f7 8e 10 80 push $0x80108ef7
801050c2: 50 push %eax
801050c3: e8 2d 09 00 00 call 801059f5 <strncmp>
801050c8: 83 c4 10 add $0x10,%esp
801050cb: 85 c0 test %eax,%eax
801050cd: 75 32 jne 80105101 <scheduler+0x4aa>
cprintf("Process %s %d has consumed 10 ms in Q%d, Total Quantum %d \n", p->name, p->pid, p->queuetype + 1, p->quantumsize);
801050cf: 8b 45 f4 mov -0xc(%ebp),%eax
801050d2: 8b 90 80 00 00 00 mov 0x80(%eax),%edx
801050d8: 8b 45 f4 mov -0xc(%ebp),%eax
801050db: 8b 40 7c mov 0x7c(%eax),%eax
801050de: 8d 58 01 lea 0x1(%eax),%ebx
801050e1: 8b 45 f4 mov -0xc(%ebp),%eax
801050e4: 8b 40 10 mov 0x10(%eax),%eax
801050e7: 8b 4d f4 mov -0xc(%ebp),%ecx
801050ea: 83 c1 6c add $0x6c,%ecx
801050ed: 83 ec 0c sub $0xc,%esp
801050f0: 52 push %edx
801050f1: 53 push %ebx
801050f2: 50 push %eax
801050f3: 51 push %ecx
801050f4: 68 fc 8e 10 80 push $0x80108efc
801050f9: e8 c8 b2 ff ff call 801003c6 <cprintf>
801050fe: 83 c4 20 add $0x20,%esp
}
if(p->quantumsize == 90){//check if 90ms quantum size if reached
80105101: 8b 45 f4 mov -0xc(%ebp),%eax
80105104: 8b 80 80 00 00 00 mov 0x80(%eax),%eax
8010510a: 83 f8 5a cmp $0x5a,%eax
8010510d: 75 79 jne 80105188 <scheduler+0x531>
p->quantumsize = 0;//only reset the quantum size, since Q3 is the lowest queue
8010510f: 8b 45 f4 mov -0xc(%ebp),%eax
80105112: c7 80 80 00 00 00 00 movl $0x0,0x80(%eax)
80105119: 00 00 00
if(strncmp(p->name, "sh", 2) == 0 || strncmp(p->name, "spin", 4) == 0){
8010511c: 8b 45 f4 mov -0xc(%ebp),%eax
8010511f: 83 c0 6c add $0x6c,%eax
80105122: 83 ec 04 sub $0x4,%esp
80105125: 6a 02 push $0x2
80105127: 68 f4 8e 10 80 push $0x80108ef4
8010512c: 50 push %eax
8010512d: e8 c3 08 00 00 call 801059f5 <strncmp>
80105132: 83 c4 10 add $0x10,%esp
80105135: 85 c0 test %eax,%eax
80105137: 74 1d je 80105156 <scheduler+0x4ff>
80105139: 8b 45 f4 mov -0xc(%ebp),%eax
8010513c: 83 c0 6c add $0x6c,%eax
8010513f: 83 ec 04 sub $0x4,%esp
80105142: 6a 04 push $0x4
80105144: 68 f7 8e 10 80 push $0x80108ef7
80105149: 50 push %eax
8010514a: e8 a6 08 00 00 call 801059f5 <strncmp>
8010514f: 83 c4 10 add $0x10,%esp
80105152: 85 c0 test %eax,%eax
80105154: 75 32 jne 80105188 <scheduler+0x531>
cprintf("Process Name: %s, Process ID %d, still in Queue %d, reset Quantum Size %d\n", p->name, p->pid, p->queuetype + 1, p->quantumsize);
80105156: 8b 45 f4 mov -0xc(%ebp),%eax
80105159: 8b 90 80 00 00 00 mov 0x80(%eax),%edx
8010515f: 8b 45 f4 mov -0xc(%ebp),%eax
80105162: 8b 40 7c mov 0x7c(%eax),%eax
80105165: 8d 58 01 lea 0x1(%eax),%ebx
80105168: 8b 45 f4 mov -0xc(%ebp),%eax
8010516b: 8b 40 10 mov 0x10(%eax),%eax
8010516e: 8b 4d f4 mov -0xc(%ebp),%ecx
80105171: 83 c1 6c add $0x6c,%ecx
80105174: 83 ec 0c sub $0xc,%esp
80105177: 52 push %edx
80105178: 53 push %ebx
80105179: 50 push %eax
8010517a: 51 push %ecx
8010517b: 68 70 8f 10 80 push $0x80108f70
80105180: e8 41 b2 ff ff call 801003c6 <cprintf>
80105185: 83 c4 20 add $0x20,%esp
}
}
swtch(&cpu->scheduler, proc->context);//run proc which holds a Q3 process
80105188: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010518e: 8b 40 1c mov 0x1c(%eax),%eax
80105191: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80105198: 83 c2 04 add $0x4,%edx
8010519b: 83 ec 08 sub $0x8,%esp
8010519e: 50 push %eax
8010519f: 52 push %edx
801051a0: e8 6f 09 00 00 call 80105b14 <swtch>
801051a5: 83 c4 10 add $0x10,%esp
switchkvm();
801051a8: e8 5c 32 00 00 call 80108409 <switchkvm>
}//end of second for loop that searches for Q2 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
p = &ptable.proc[randomrange(0, 63)];
while(p->queuetype == 2 && p->state == RUNNABLE){//search for Q3 processes
801051ad: 8b 45 f4 mov -0xc(%ebp),%eax
801051b0: 8b 40 7c mov 0x7c(%eax),%eax
801051b3: 83 f8 02 cmp $0x2,%eax
801051b6: 75 0f jne 801051c7 <scheduler+0x570>
801051b8: 8b 45 f4 mov -0xc(%ebp),%eax
801051bb: 8b 40 0c mov 0xc(%eax),%eax
801051be: 83 f8 03 cmp $0x3,%eax
801051c1: 0f 84 98 fe ff ff je 8010505f <scheduler+0x408>
}
}
swtch(&cpu->scheduler, proc->context);//run proc which holds a Q3 process
switchkvm();
}
proc = 0;
801051c7: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
801051ce: 00 00 00 00
801051d2: eb 01 jmp 801051d5 <scheduler+0x57e>
}//end of Q2 while loop
proc = 0;
}//end of second for loop that searches for Q2 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state != RUNNABLE)
continue;
801051d4: 90 nop
swtch(&cpu->scheduler, proc->context); //run proc which holds a Q2 process
switchkvm();
}//end of Q2 while loop
proc = 0;
}//end of second for loop that searches for Q2 processes
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801051d5: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
801051dc: 81 7d f4 94 5a 11 80 cmpl $0x80115a94,-0xc(%ebp)
801051e3: 0f 82 3b fe ff ff jb 80105024 <scheduler+0x3cd>
swtch(&cpu->scheduler, proc->context);//run proc which holds a Q3 process
switchkvm();
}
proc = 0;
}
release(&ptable.lock);
801051e9: 83 ec 0c sub $0xc,%esp
801051ec: 68 60 39 11 80 push $0x80113960
801051f1: e8 ae 04 00 00 call 801056a4 <release>
801051f6: 83 c4 10 add $0x10,%esp
}//end infinite for loop
801051f9: e9 60 fa ff ff jmp 80104c5e <scheduler+0x7>
801051fe <sched>:
// Enter scheduler. Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
801051fe: 55 push %ebp
801051ff: 89 e5 mov %esp,%ebp
80105201: 83 ec 18 sub $0x18,%esp
int intena;
if(!holding(&ptable.lock))
80105204: 83 ec 0c sub $0xc,%esp
80105207: 68 60 39 11 80 push $0x80113960
8010520c: e8 5f 05 00 00 call 80105770 <holding>
80105211: 83 c4 10 add $0x10,%esp
80105214: 85 c0 test %eax,%eax
80105216: 75 0d jne 80105225 <sched+0x27>
panic("sched ptable.lock");
80105218: 83 ec 0c sub $0xc,%esp
8010521b: 68 bb 8f 10 80 push $0x80108fbb
80105220: e8 41 b3 ff ff call 80100566 <panic>
if(cpu->ncli != 1)
80105225: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010522b: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80105231: 83 f8 01 cmp $0x1,%eax
80105234: 74 0d je 80105243 <sched+0x45>
panic("sched locks");
80105236: 83 ec 0c sub $0xc,%esp
80105239: 68 cd 8f 10 80 push $0x80108fcd
8010523e: e8 23 b3 ff ff call 80100566 <panic>
if(proc->state == RUNNING)
80105243: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105249: 8b 40 0c mov 0xc(%eax),%eax
8010524c: 83 f8 04 cmp $0x4,%eax
8010524f: 75 0d jne 8010525e <sched+0x60>
panic("sched running");
80105251: 83 ec 0c sub $0xc,%esp
80105254: 68 d9 8f 10 80 push $0x80108fd9
80105259: e8 08 b3 ff ff call 80100566 <panic>
if(readeflags()&FL_IF)
8010525e: e8 db f1 ff ff call 8010443e <readeflags>
80105263: 25 00 02 00 00 and $0x200,%eax
80105268: 85 c0 test %eax,%eax
8010526a: 74 0d je 80105279 <sched+0x7b>
panic("sched interruptible");
8010526c: 83 ec 0c sub $0xc,%esp
8010526f: 68 e7 8f 10 80 push $0x80108fe7
80105274: e8 ed b2 ff ff call 80100566 <panic>
intena = cpu->intena;
80105279: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010527f: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80105285: 89 45 f4 mov %eax,-0xc(%ebp)
swtch(&proc->context, cpu->scheduler);
80105288: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010528e: 8b 40 04 mov 0x4(%eax),%eax
80105291: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
80105298: 83 c2 1c add $0x1c,%edx
8010529b: 83 ec 08 sub $0x8,%esp
8010529e: 50 push %eax
8010529f: 52 push %edx
801052a0: e8 6f 08 00 00 call 80105b14 <swtch>
801052a5: 83 c4 10 add $0x10,%esp
cpu->intena = intena;
801052a8: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801052ae: 8b 55 f4 mov -0xc(%ebp),%edx
801052b1: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
801052b7: 90 nop
801052b8: c9 leave
801052b9: c3 ret
801052ba <yield>:
// Give up the CPU for one scheduling round.
void
yield(void)
{
801052ba: 55 push %ebp
801052bb: 89 e5 mov %esp,%ebp
801052bd: 83 ec 08 sub $0x8,%esp
acquire(&ptable.lock); //DOC: yieldlock
801052c0: 83 ec 0c sub $0xc,%esp
801052c3: 68 60 39 11 80 push $0x80113960
801052c8: e8 70 03 00 00 call 8010563d <acquire>
801052cd: 83 c4 10 add $0x10,%esp
proc->state = RUNNABLE;
801052d0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801052d6: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
sched();
801052dd: e8 1c ff ff ff call 801051fe <sched>
release(&ptable.lock);
801052e2: 83 ec 0c sub $0xc,%esp
801052e5: 68 60 39 11 80 push $0x80113960
801052ea: e8 b5 03 00 00 call 801056a4 <release>
801052ef: 83 c4 10 add $0x10,%esp
}
801052f2: 90 nop
801052f3: c9 leave
801052f4: c3 ret
801052f5 <forkret>:
// A fork child's very first scheduling by scheduler()
// will swtch here. "Return" to user space.
void
forkret(void)
{
801052f5: 55 push %ebp
801052f6: 89 e5 mov %esp,%ebp
801052f8: 83 ec 08 sub $0x8,%esp
static int first = 1;
// Still holding ptable.lock from scheduler.
release(&ptable.lock);
801052fb: 83 ec 0c sub $0xc,%esp
801052fe: 68 60 39 11 80 push $0x80113960
80105303: e8 9c 03 00 00 call 801056a4 <release>
80105308: 83 c4 10 add $0x10,%esp
if (first) {
8010530b: a1 18 c0 10 80 mov 0x8010c018,%eax
80105310: 85 c0 test %eax,%eax
80105312: 74 24 je 80105338 <forkret+0x43>
// Some initialization functions must be run in the context
// of a regular process (e.g., they call sleep), and thus cannot
// be run from main().
first = 0;
80105314: c7 05 18 c0 10 80 00 movl $0x0,0x8010c018
8010531b: 00 00 00
iinit(ROOTDEV);
8010531e: 83 ec 0c sub $0xc,%esp
80105321: 6a 01 push $0x1
80105323: e8 16 c3 ff ff call 8010163e <iinit>
80105328: 83 c4 10 add $0x10,%esp
initlog(ROOTDEV);
8010532b: 83 ec 0c sub $0xc,%esp
8010532e: 6a 01 push $0x1
80105330: e8 fa df ff ff call 8010332f <initlog>
80105335: 83 c4 10 add $0x10,%esp
}
// Return to "caller", actually trapret (see allocproc).
}
80105338: 90 nop
80105339: c9 leave
8010533a: c3 ret
8010533b <sleep>:
// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
8010533b: 55 push %ebp
8010533c: 89 e5 mov %esp,%ebp
8010533e: 83 ec 08 sub $0x8,%esp
if(proc == 0)
80105341: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105347: 85 c0 test %eax,%eax
80105349: 75 0d jne 80105358 <sleep+0x1d>
panic("sleep");
8010534b: 83 ec 0c sub $0xc,%esp
8010534e: 68 fb 8f 10 80 push $0x80108ffb
80105353: e8 0e b2 ff ff call 80100566 <panic>
if(lk == 0)
80105358: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
8010535c: 75 0d jne 8010536b <sleep+0x30>
panic("sleep without lk");
8010535e: 83 ec 0c sub $0xc,%esp
80105361: 68 01 90 10 80 push $0x80109001
80105366: e8 fb b1 ff ff call 80100566 <panic>
// change p->state and then call sched.
// Once we hold ptable.lock, we can be
// guaranteed that we won't miss any wakeup
// (wakeup runs with ptable.lock locked),
// so it's okay to release lk.
if(lk != &ptable.lock){ //DOC: sleeplock0
8010536b: 81 7d 0c 60 39 11 80 cmpl $0x80113960,0xc(%ebp)
80105372: 74 1e je 80105392 <sleep+0x57>
acquire(&ptable.lock); //DOC: sleeplock1
80105374: 83 ec 0c sub $0xc,%esp
80105377: 68 60 39 11 80 push $0x80113960
8010537c: e8 bc 02 00 00 call 8010563d <acquire>
80105381: 83 c4 10 add $0x10,%esp
release(lk);
80105384: 83 ec 0c sub $0xc,%esp
80105387: ff 75 0c pushl 0xc(%ebp)
8010538a: e8 15 03 00 00 call 801056a4 <release>
8010538f: 83 c4 10 add $0x10,%esp
}
// Go to sleep.
proc->chan = chan;
80105392: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105398: 8b 55 08 mov 0x8(%ebp),%edx
8010539b: 89 50 20 mov %edx,0x20(%eax)
proc->state = SLEEPING;
8010539e: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801053a4: c7 40 0c 02 00 00 00 movl $0x2,0xc(%eax)
sched();
801053ab: e8 4e fe ff ff call 801051fe <sched>
// Tidy up.
proc->chan = 0;
801053b0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
801053b6: c7 40 20 00 00 00 00 movl $0x0,0x20(%eax)
// Reacquire original lock.
if(lk != &ptable.lock){ //DOC: sleeplock2
801053bd: 81 7d 0c 60 39 11 80 cmpl $0x80113960,0xc(%ebp)
801053c4: 74 1e je 801053e4 <sleep+0xa9>
release(&ptable.lock);
801053c6: 83 ec 0c sub $0xc,%esp
801053c9: 68 60 39 11 80 push $0x80113960
801053ce: e8 d1 02 00 00 call 801056a4 <release>
801053d3: 83 c4 10 add $0x10,%esp
acquire(lk);
801053d6: 83 ec 0c sub $0xc,%esp
801053d9: ff 75 0c pushl 0xc(%ebp)
801053dc: e8 5c 02 00 00 call 8010563d <acquire>
801053e1: 83 c4 10 add $0x10,%esp
}
}
801053e4: 90 nop
801053e5: c9 leave
801053e6: c3 ret
801053e7 <wakeup1>:
//PAGEBREAK!
// Wake up all processes sleeping on chan.
// The ptable lock must be held.
static void
wakeup1(void *chan)
{
801053e7: 55 push %ebp
801053e8: 89 e5 mov %esp,%ebp
801053ea: 83 ec 10 sub $0x10,%esp
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
801053ed: c7 45 fc 94 39 11 80 movl $0x80113994,-0x4(%ebp)
801053f4: eb 27 jmp 8010541d <wakeup1+0x36>
if(p->state == SLEEPING && p->chan == chan)
801053f6: 8b 45 fc mov -0x4(%ebp),%eax
801053f9: 8b 40 0c mov 0xc(%eax),%eax
801053fc: 83 f8 02 cmp $0x2,%eax
801053ff: 75 15 jne 80105416 <wakeup1+0x2f>
80105401: 8b 45 fc mov -0x4(%ebp),%eax
80105404: 8b 40 20 mov 0x20(%eax),%eax
80105407: 3b 45 08 cmp 0x8(%ebp),%eax
8010540a: 75 0a jne 80105416 <wakeup1+0x2f>
p->state = RUNNABLE;
8010540c: 8b 45 fc mov -0x4(%ebp),%eax
8010540f: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
struct proc *p;
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
80105416: 81 45 fc 84 00 00 00 addl $0x84,-0x4(%ebp)
8010541d: 81 7d fc 94 5a 11 80 cmpl $0x80115a94,-0x4(%ebp)
80105424: 72 d0 jb 801053f6 <wakeup1+0xf>
if(p->state == SLEEPING && p->chan == chan)
p->state = RUNNABLE;
}
80105426: 90 nop
80105427: c9 leave
80105428: c3 ret
80105429 <wakeup>:
// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
80105429: 55 push %ebp
8010542a: 89 e5 mov %esp,%ebp
8010542c: 83 ec 08 sub $0x8,%esp
acquire(&ptable.lock);
8010542f: 83 ec 0c sub $0xc,%esp
80105432: 68 60 39 11 80 push $0x80113960
80105437: e8 01 02 00 00 call 8010563d <acquire>
8010543c: 83 c4 10 add $0x10,%esp
wakeup1(chan);
8010543f: 83 ec 0c sub $0xc,%esp
80105442: ff 75 08 pushl 0x8(%ebp)
80105445: e8 9d ff ff ff call 801053e7 <wakeup1>
8010544a: 83 c4 10 add $0x10,%esp
release(&ptable.lock);
8010544d: 83 ec 0c sub $0xc,%esp
80105450: 68 60 39 11 80 push $0x80113960
80105455: e8 4a 02 00 00 call 801056a4 <release>
8010545a: 83 c4 10 add $0x10,%esp
}
8010545d: 90 nop
8010545e: c9 leave
8010545f: c3 ret
80105460 <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
80105460: 55 push %ebp
80105461: 89 e5 mov %esp,%ebp
80105463: 83 ec 18 sub $0x18,%esp
struct proc *p;
acquire(&ptable.lock);
80105466: 83 ec 0c sub $0xc,%esp
80105469: 68 60 39 11 80 push $0x80113960
8010546e: e8 ca 01 00 00 call 8010563d <acquire>
80105473: 83 c4 10 add $0x10,%esp
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
80105476: c7 45 f4 94 39 11 80 movl $0x80113994,-0xc(%ebp)
8010547d: eb 48 jmp 801054c7 <kill+0x67>
if(p->pid == pid){
8010547f: 8b 45 f4 mov -0xc(%ebp),%eax
80105482: 8b 40 10 mov 0x10(%eax),%eax
80105485: 3b 45 08 cmp 0x8(%ebp),%eax
80105488: 75 36 jne 801054c0 <kill+0x60>
p->killed = 1;
8010548a: 8b 45 f4 mov -0xc(%ebp),%eax
8010548d: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
// Wake process from sleep if necessary.
if(p->state == SLEEPING)
80105494: 8b 45 f4 mov -0xc(%ebp),%eax
80105497: 8b 40 0c mov 0xc(%eax),%eax
8010549a: 83 f8 02 cmp $0x2,%eax
8010549d: 75 0a jne 801054a9 <kill+0x49>
p->state = RUNNABLE;
8010549f: 8b 45 f4 mov -0xc(%ebp),%eax
801054a2: c7 40 0c 03 00 00 00 movl $0x3,0xc(%eax)
release(&ptable.lock);
801054a9: 83 ec 0c sub $0xc,%esp
801054ac: 68 60 39 11 80 push $0x80113960
801054b1: e8 ee 01 00 00 call 801056a4 <release>
801054b6: 83 c4 10 add $0x10,%esp
return 0;
801054b9: b8 00 00 00 00 mov $0x0,%eax
801054be: eb 25 jmp 801054e5 <kill+0x85>
kill(int pid)
{
struct proc *p;
acquire(&ptable.lock);
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801054c0: 81 45 f4 84 00 00 00 addl $0x84,-0xc(%ebp)
801054c7: 81 7d f4 94 5a 11 80 cmpl $0x80115a94,-0xc(%ebp)
801054ce: 72 af jb 8010547f <kill+0x1f>
p->state = RUNNABLE;
release(&ptable.lock);
return 0;
}
}
release(&ptable.lock);
801054d0: 83 ec 0c sub $0xc,%esp
801054d3: 68 60 39 11 80 push $0x80113960
801054d8: e8 c7 01 00 00 call 801056a4 <release>
801054dd: 83 c4 10 add $0x10,%esp
return -1;
801054e0: b8 ff ff ff ff mov $0xffffffff,%eax
}
801054e5: c9 leave
801054e6: c3 ret
801054e7 <procdump>:
// Print a process listing to console. For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
801054e7: 55 push %ebp
801054e8: 89 e5 mov %esp,%ebp
801054ea: 83 ec 48 sub $0x48,%esp
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801054ed: c7 45 f0 94 39 11 80 movl $0x80113994,-0x10(%ebp)
801054f4: e9 da 00 00 00 jmp 801055d3 <procdump+0xec>
if(p->state == UNUSED)
801054f9: 8b 45 f0 mov -0x10(%ebp),%eax
801054fc: 8b 40 0c mov 0xc(%eax),%eax
801054ff: 85 c0 test %eax,%eax
80105501: 0f 84 c4 00 00 00 je 801055cb <procdump+0xe4>
continue;
if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
80105507: 8b 45 f0 mov -0x10(%ebp),%eax
8010550a: 8b 40 0c mov 0xc(%eax),%eax
8010550d: 83 f8 05 cmp $0x5,%eax
80105510: 77 23 ja 80105535 <procdump+0x4e>
80105512: 8b 45 f0 mov -0x10(%ebp),%eax
80105515: 8b 40 0c mov 0xc(%eax),%eax
80105518: 8b 04 85 1c c0 10 80 mov -0x7fef3fe4(,%eax,4),%eax
8010551f: 85 c0 test %eax,%eax
80105521: 74 12 je 80105535 <procdump+0x4e>
state = states[p->state];
80105523: 8b 45 f0 mov -0x10(%ebp),%eax
80105526: 8b 40 0c mov 0xc(%eax),%eax
80105529: 8b 04 85 1c c0 10 80 mov -0x7fef3fe4(,%eax,4),%eax
80105530: 89 45 ec mov %eax,-0x14(%ebp)
80105533: eb 07 jmp 8010553c <procdump+0x55>
else
state = "???";
80105535: c7 45 ec 12 90 10 80 movl $0x80109012,-0x14(%ebp)
cprintf("%d %s %s", p->pid, state, p->name);
8010553c: 8b 45 f0 mov -0x10(%ebp),%eax
8010553f: 8d 50 6c lea 0x6c(%eax),%edx
80105542: 8b 45 f0 mov -0x10(%ebp),%eax
80105545: 8b 40 10 mov 0x10(%eax),%eax
80105548: 52 push %edx
80105549: ff 75 ec pushl -0x14(%ebp)
8010554c: 50 push %eax
8010554d: 68 16 90 10 80 push $0x80109016
80105552: e8 6f ae ff ff call 801003c6 <cprintf>
80105557: 83 c4 10 add $0x10,%esp
if(p->state == SLEEPING){
8010555a: 8b 45 f0 mov -0x10(%ebp),%eax
8010555d: 8b 40 0c mov 0xc(%eax),%eax
80105560: 83 f8 02 cmp $0x2,%eax
80105563: 75 54 jne 801055b9 <procdump+0xd2>
getcallerpcs((uint*)p->context->ebp+2, pc);
80105565: 8b 45 f0 mov -0x10(%ebp),%eax
80105568: 8b 40 1c mov 0x1c(%eax),%eax
8010556b: 8b 40 0c mov 0xc(%eax),%eax
8010556e: 83 c0 08 add $0x8,%eax
80105571: 89 c2 mov %eax,%edx
80105573: 83 ec 08 sub $0x8,%esp
80105576: 8d 45 c4 lea -0x3c(%ebp),%eax
80105579: 50 push %eax
8010557a: 52 push %edx
8010557b: e8 76 01 00 00 call 801056f6 <getcallerpcs>
80105580: 83 c4 10 add $0x10,%esp
for(i=0; i<10 && pc[i] != 0; i++)
80105583: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
8010558a: eb 1c jmp 801055a8 <procdump+0xc1>
cprintf(" %p", pc[i]);
8010558c: 8b 45 f4 mov -0xc(%ebp),%eax
8010558f: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
80105593: 83 ec 08 sub $0x8,%esp
80105596: 50 push %eax
80105597: 68 1f 90 10 80 push $0x8010901f
8010559c: e8 25 ae ff ff call 801003c6 <cprintf>
801055a1: 83 c4 10 add $0x10,%esp
else
state = "???";
cprintf("%d %s %s", p->pid, state, p->name);
if(p->state == SLEEPING){
getcallerpcs((uint*)p->context->ebp+2, pc);
for(i=0; i<10 && pc[i] != 0; i++)
801055a4: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801055a8: 83 7d f4 09 cmpl $0x9,-0xc(%ebp)
801055ac: 7f 0b jg 801055b9 <procdump+0xd2>
801055ae: 8b 45 f4 mov -0xc(%ebp),%eax
801055b1: 8b 44 85 c4 mov -0x3c(%ebp,%eax,4),%eax
801055b5: 85 c0 test %eax,%eax
801055b7: 75 d3 jne 8010558c <procdump+0xa5>
cprintf(" %p", pc[i]);
}
cprintf("\n");
801055b9: 83 ec 0c sub $0xc,%esp
801055bc: 68 23 90 10 80 push $0x80109023
801055c1: e8 00 ae ff ff call 801003c6 <cprintf>
801055c6: 83 c4 10 add $0x10,%esp
801055c9: eb 01 jmp 801055cc <procdump+0xe5>
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
if(p->state == UNUSED)
continue;
801055cb: 90 nop
int i;
struct proc *p;
char *state;
uint pc[10];
for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
801055cc: 81 45 f0 84 00 00 00 addl $0x84,-0x10(%ebp)
801055d3: 81 7d f0 94 5a 11 80 cmpl $0x80115a94,-0x10(%ebp)
801055da: 0f 82 19 ff ff ff jb 801054f9 <procdump+0x12>
for(i=0; i<10 && pc[i] != 0; i++)
cprintf(" %p", pc[i]);
}
cprintf("\n");
}
}
801055e0: 90 nop
801055e1: c9 leave
801055e2: c3 ret
801055e3 <readeflags>:
asm volatile("ltr %0" : : "r" (sel));
}
static inline uint
readeflags(void)
{
801055e3: 55 push %ebp
801055e4: 89 e5 mov %esp,%ebp
801055e6: 83 ec 10 sub $0x10,%esp
uint eflags;
asm volatile("pushfl; popl %0" : "=r" (eflags));
801055e9: 9c pushf
801055ea: 58 pop %eax
801055eb: 89 45 fc mov %eax,-0x4(%ebp)
return eflags;
801055ee: 8b 45 fc mov -0x4(%ebp),%eax
}
801055f1: c9 leave
801055f2: c3 ret
801055f3 <cli>:
asm volatile("movw %0, %%gs" : : "r" (v));
}
static inline void
cli(void)
{
801055f3: 55 push %ebp
801055f4: 89 e5 mov %esp,%ebp
asm volatile("cli");
801055f6: fa cli
}
801055f7: 90 nop
801055f8: 5d pop %ebp
801055f9: c3 ret
801055fa <sti>:
static inline void
sti(void)
{
801055fa: 55 push %ebp
801055fb: 89 e5 mov %esp,%ebp
asm volatile("sti");
801055fd: fb sti
}
801055fe: 90 nop
801055ff: 5d pop %ebp
80105600: c3 ret
80105601 <xchg>:
static inline uint
xchg(volatile uint *addr, uint newval)
{
80105601: 55 push %ebp
80105602: 89 e5 mov %esp,%ebp
80105604: 83 ec 10 sub $0x10,%esp
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
80105607: 8b 55 08 mov 0x8(%ebp),%edx
8010560a: 8b 45 0c mov 0xc(%ebp),%eax
8010560d: 8b 4d 08 mov 0x8(%ebp),%ecx
80105610: f0 87 02 lock xchg %eax,(%edx)
80105613: 89 45 fc mov %eax,-0x4(%ebp)
"+m" (*addr), "=a" (result) :
"1" (newval) :
"cc");
return result;
80105616: 8b 45 fc mov -0x4(%ebp),%eax
}
80105619: c9 leave
8010561a: c3 ret
8010561b <initlock>:
#include "proc.h"
#include "spinlock.h"
void
initlock(struct spinlock *lk, char *name)
{
8010561b: 55 push %ebp
8010561c: 89 e5 mov %esp,%ebp
lk->name = name;
8010561e: 8b 45 08 mov 0x8(%ebp),%eax
80105621: 8b 55 0c mov 0xc(%ebp),%edx
80105624: 89 50 04 mov %edx,0x4(%eax)
lk->locked = 0;
80105627: 8b 45 08 mov 0x8(%ebp),%eax
8010562a: c7 00 00 00 00 00 movl $0x0,(%eax)
lk->cpu = 0;
80105630: 8b 45 08 mov 0x8(%ebp),%eax
80105633: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
}
8010563a: 90 nop
8010563b: 5d pop %ebp
8010563c: c3 ret
8010563d <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
8010563d: 55 push %ebp
8010563e: 89 e5 mov %esp,%ebp
80105640: 83 ec 08 sub $0x8,%esp
pushcli(); // disable interrupts to avoid deadlock.
80105643: e8 52 01 00 00 call 8010579a <pushcli>
if(holding(lk))
80105648: 8b 45 08 mov 0x8(%ebp),%eax
8010564b: 83 ec 0c sub $0xc,%esp
8010564e: 50 push %eax
8010564f: e8 1c 01 00 00 call 80105770 <holding>
80105654: 83 c4 10 add $0x10,%esp
80105657: 85 c0 test %eax,%eax
80105659: 74 0d je 80105668 <acquire+0x2b>
panic("acquire");
8010565b: 83 ec 0c sub $0xc,%esp
8010565e: 68 4f 90 10 80 push $0x8010904f
80105663: e8 fe ae ff ff call 80100566 <panic>
// The xchg is atomic.
// It also serializes, so that reads after acquire are not
// reordered before it.
while(xchg(&lk->locked, 1) != 0)
80105668: 90 nop
80105669: 8b 45 08 mov 0x8(%ebp),%eax
8010566c: 83 ec 08 sub $0x8,%esp
8010566f: 6a 01 push $0x1
80105671: 50 push %eax
80105672: e8 8a ff ff ff call 80105601 <xchg>
80105677: 83 c4 10 add $0x10,%esp
8010567a: 85 c0 test %eax,%eax
8010567c: 75 eb jne 80105669 <acquire+0x2c>
;
// Record info about lock acquisition for debugging.
lk->cpu = cpu;
8010567e: 8b 45 08 mov 0x8(%ebp),%eax
80105681: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80105688: 89 50 08 mov %edx,0x8(%eax)
getcallerpcs(&lk, lk->pcs);
8010568b: 8b 45 08 mov 0x8(%ebp),%eax
8010568e: 83 c0 0c add $0xc,%eax
80105691: 83 ec 08 sub $0x8,%esp
80105694: 50 push %eax
80105695: 8d 45 08 lea 0x8(%ebp),%eax
80105698: 50 push %eax
80105699: e8 58 00 00 00 call 801056f6 <getcallerpcs>
8010569e: 83 c4 10 add $0x10,%esp
}
801056a1: 90 nop
801056a2: c9 leave
801056a3: c3 ret
801056a4 <release>:
// Release the lock.
void
release(struct spinlock *lk)
{
801056a4: 55 push %ebp
801056a5: 89 e5 mov %esp,%ebp
801056a7: 83 ec 08 sub $0x8,%esp
if(!holding(lk))
801056aa: 83 ec 0c sub $0xc,%esp
801056ad: ff 75 08 pushl 0x8(%ebp)
801056b0: e8 bb 00 00 00 call 80105770 <holding>
801056b5: 83 c4 10 add $0x10,%esp
801056b8: 85 c0 test %eax,%eax
801056ba: 75 0d jne 801056c9 <release+0x25>
panic("release");
801056bc: 83 ec 0c sub $0xc,%esp
801056bf: 68 57 90 10 80 push $0x80109057
801056c4: e8 9d ae ff ff call 80100566 <panic>
lk->pcs[0] = 0;
801056c9: 8b 45 08 mov 0x8(%ebp),%eax
801056cc: c7 40 0c 00 00 00 00 movl $0x0,0xc(%eax)
lk->cpu = 0;
801056d3: 8b 45 08 mov 0x8(%ebp),%eax
801056d6: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax)
// But the 2007 Intel 64 Architecture Memory Ordering White
// Paper says that Intel 64 and IA-32 will not move a load
// after a store. So lock->locked = 0 would work here.
// The xchg being asm volatile ensures gcc emits it after
// the above assignments (and after the critical section).
xchg(&lk->locked, 0);
801056dd: 8b 45 08 mov 0x8(%ebp),%eax
801056e0: 83 ec 08 sub $0x8,%esp
801056e3: 6a 00 push $0x0
801056e5: 50 push %eax
801056e6: e8 16 ff ff ff call 80105601 <xchg>
801056eb: 83 c4 10 add $0x10,%esp
popcli();
801056ee: e8 ec 00 00 00 call 801057df <popcli>
}
801056f3: 90 nop
801056f4: c9 leave
801056f5: c3 ret
801056f6 <getcallerpcs>:
// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
801056f6: 55 push %ebp
801056f7: 89 e5 mov %esp,%ebp
801056f9: 83 ec 10 sub $0x10,%esp
uint *ebp;
int i;
ebp = (uint*)v - 2;
801056fc: 8b 45 08 mov 0x8(%ebp),%eax
801056ff: 83 e8 08 sub $0x8,%eax
80105702: 89 45 fc mov %eax,-0x4(%ebp)
for(i = 0; i < 10; i++){
80105705: c7 45 f8 00 00 00 00 movl $0x0,-0x8(%ebp)
8010570c: eb 38 jmp 80105746 <getcallerpcs+0x50>
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
8010570e: 83 7d fc 00 cmpl $0x0,-0x4(%ebp)
80105712: 74 53 je 80105767 <getcallerpcs+0x71>
80105714: 81 7d fc ff ff ff 7f cmpl $0x7fffffff,-0x4(%ebp)
8010571b: 76 4a jbe 80105767 <getcallerpcs+0x71>
8010571d: 83 7d fc ff cmpl $0xffffffff,-0x4(%ebp)
80105721: 74 44 je 80105767 <getcallerpcs+0x71>
break;
pcs[i] = ebp[1]; // saved %eip
80105723: 8b 45 f8 mov -0x8(%ebp),%eax
80105726: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
8010572d: 8b 45 0c mov 0xc(%ebp),%eax
80105730: 01 c2 add %eax,%edx
80105732: 8b 45 fc mov -0x4(%ebp),%eax
80105735: 8b 40 04 mov 0x4(%eax),%eax
80105738: 89 02 mov %eax,(%edx)
ebp = (uint*)ebp[0]; // saved %ebp
8010573a: 8b 45 fc mov -0x4(%ebp),%eax
8010573d: 8b 00 mov (%eax),%eax
8010573f: 89 45 fc mov %eax,-0x4(%ebp)
{
uint *ebp;
int i;
ebp = (uint*)v - 2;
for(i = 0; i < 10; i++){
80105742: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80105746: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
8010574a: 7e c2 jle 8010570e <getcallerpcs+0x18>
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
8010574c: eb 19 jmp 80105767 <getcallerpcs+0x71>
pcs[i] = 0;
8010574e: 8b 45 f8 mov -0x8(%ebp),%eax
80105751: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80105758: 8b 45 0c mov 0xc(%ebp),%eax
8010575b: 01 d0 add %edx,%eax
8010575d: c7 00 00 00 00 00 movl $0x0,(%eax)
if(ebp == 0 || ebp < (uint*)KERNBASE || ebp == (uint*)0xffffffff)
break;
pcs[i] = ebp[1]; // saved %eip
ebp = (uint*)ebp[0]; // saved %ebp
}
for(; i < 10; i++)
80105763: 83 45 f8 01 addl $0x1,-0x8(%ebp)
80105767: 83 7d f8 09 cmpl $0x9,-0x8(%ebp)
8010576b: 7e e1 jle 8010574e <getcallerpcs+0x58>
pcs[i] = 0;
}
8010576d: 90 nop
8010576e: c9 leave
8010576f: c3 ret
80105770 <holding>:
// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
80105770: 55 push %ebp
80105771: 89 e5 mov %esp,%ebp
return lock->locked && lock->cpu == cpu;
80105773: 8b 45 08 mov 0x8(%ebp),%eax
80105776: 8b 00 mov (%eax),%eax
80105778: 85 c0 test %eax,%eax
8010577a: 74 17 je 80105793 <holding+0x23>
8010577c: 8b 45 08 mov 0x8(%ebp),%eax
8010577f: 8b 50 08 mov 0x8(%eax),%edx
80105782: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80105788: 39 c2 cmp %eax,%edx
8010578a: 75 07 jne 80105793 <holding+0x23>
8010578c: b8 01 00 00 00 mov $0x1,%eax
80105791: eb 05 jmp 80105798 <holding+0x28>
80105793: b8 00 00 00 00 mov $0x0,%eax
}
80105798: 5d pop %ebp
80105799: c3 ret
8010579a <pushcli>:
// it takes two popcli to undo two pushcli. Also, if interrupts
// are off, then pushcli, popcli leaves them off.
void
pushcli(void)
{
8010579a: 55 push %ebp
8010579b: 89 e5 mov %esp,%ebp
8010579d: 83 ec 10 sub $0x10,%esp
int eflags;
eflags = readeflags();
801057a0: e8 3e fe ff ff call 801055e3 <readeflags>
801057a5: 89 45 fc mov %eax,-0x4(%ebp)
cli();
801057a8: e8 46 fe ff ff call 801055f3 <cli>
if(cpu->ncli++ == 0)
801057ad: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
801057b4: 8b 82 ac 00 00 00 mov 0xac(%edx),%eax
801057ba: 8d 48 01 lea 0x1(%eax),%ecx
801057bd: 89 8a ac 00 00 00 mov %ecx,0xac(%edx)
801057c3: 85 c0 test %eax,%eax
801057c5: 75 15 jne 801057dc <pushcli+0x42>
cpu->intena = eflags & FL_IF;
801057c7: 65 a1 00 00 00 00 mov %gs:0x0,%eax
801057cd: 8b 55 fc mov -0x4(%ebp),%edx
801057d0: 81 e2 00 02 00 00 and $0x200,%edx
801057d6: 89 90 b0 00 00 00 mov %edx,0xb0(%eax)
}
801057dc: 90 nop
801057dd: c9 leave
801057de: c3 ret
801057df <popcli>:
void
popcli(void)
{
801057df: 55 push %ebp
801057e0: 89 e5 mov %esp,%ebp
801057e2: 83 ec 08 sub $0x8,%esp
if(readeflags()&FL_IF)
801057e5: e8 f9 fd ff ff call 801055e3 <readeflags>
801057ea: 25 00 02 00 00 and $0x200,%eax
801057ef: 85 c0 test %eax,%eax
801057f1: 74 0d je 80105800 <popcli+0x21>
panic("popcli - interruptible");
801057f3: 83 ec 0c sub $0xc,%esp
801057f6: 68 5f 90 10 80 push $0x8010905f
801057fb: e8 66 ad ff ff call 80100566 <panic>
if(--cpu->ncli < 0)
80105800: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80105806: 8b 90 ac 00 00 00 mov 0xac(%eax),%edx
8010580c: 83 ea 01 sub $0x1,%edx
8010580f: 89 90 ac 00 00 00 mov %edx,0xac(%eax)
80105815: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
8010581b: 85 c0 test %eax,%eax
8010581d: 79 0d jns 8010582c <popcli+0x4d>
panic("popcli");
8010581f: 83 ec 0c sub $0xc,%esp
80105822: 68 76 90 10 80 push $0x80109076
80105827: e8 3a ad ff ff call 80100566 <panic>
if(cpu->ncli == 0 && cpu->intena)
8010582c: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80105832: 8b 80 ac 00 00 00 mov 0xac(%eax),%eax
80105838: 85 c0 test %eax,%eax
8010583a: 75 15 jne 80105851 <popcli+0x72>
8010583c: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80105842: 8b 80 b0 00 00 00 mov 0xb0(%eax),%eax
80105848: 85 c0 test %eax,%eax
8010584a: 74 05 je 80105851 <popcli+0x72>
sti();
8010584c: e8 a9 fd ff ff call 801055fa <sti>
}
80105851: 90 nop
80105852: c9 leave
80105853: c3 ret
80105854 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
80105854: 55 push %ebp
80105855: 89 e5 mov %esp,%ebp
80105857: 57 push %edi
80105858: 53 push %ebx
asm volatile("cld; rep stosb" :
80105859: 8b 4d 08 mov 0x8(%ebp),%ecx
8010585c: 8b 55 10 mov 0x10(%ebp),%edx
8010585f: 8b 45 0c mov 0xc(%ebp),%eax
80105862: 89 cb mov %ecx,%ebx
80105864: 89 df mov %ebx,%edi
80105866: 89 d1 mov %edx,%ecx
80105868: fc cld
80105869: f3 aa rep stos %al,%es:(%edi)
8010586b: 89 ca mov %ecx,%edx
8010586d: 89 fb mov %edi,%ebx
8010586f: 89 5d 08 mov %ebx,0x8(%ebp)
80105872: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
80105875: 90 nop
80105876: 5b pop %ebx
80105877: 5f pop %edi
80105878: 5d pop %ebp
80105879: c3 ret
8010587a <stosl>:
static inline void
stosl(void *addr, int data, int cnt)
{
8010587a: 55 push %ebp
8010587b: 89 e5 mov %esp,%ebp
8010587d: 57 push %edi
8010587e: 53 push %ebx
asm volatile("cld; rep stosl" :
8010587f: 8b 4d 08 mov 0x8(%ebp),%ecx
80105882: 8b 55 10 mov 0x10(%ebp),%edx
80105885: 8b 45 0c mov 0xc(%ebp),%eax
80105888: 89 cb mov %ecx,%ebx
8010588a: 89 df mov %ebx,%edi
8010588c: 89 d1 mov %edx,%ecx
8010588e: fc cld
8010588f: f3 ab rep stos %eax,%es:(%edi)
80105891: 89 ca mov %ecx,%edx
80105893: 89 fb mov %edi,%ebx
80105895: 89 5d 08 mov %ebx,0x8(%ebp)
80105898: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
8010589b: 90 nop
8010589c: 5b pop %ebx
8010589d: 5f pop %edi
8010589e: 5d pop %ebp
8010589f: c3 ret
801058a0 <memset>:
#include "types.h"
#include "x86.h"
void*
memset(void *dst, int c, uint n)
{
801058a0: 55 push %ebp
801058a1: 89 e5 mov %esp,%ebp
if ((int)dst%4 == 0 && n%4 == 0){
801058a3: 8b 45 08 mov 0x8(%ebp),%eax
801058a6: 83 e0 03 and $0x3,%eax
801058a9: 85 c0 test %eax,%eax
801058ab: 75 43 jne 801058f0 <memset+0x50>
801058ad: 8b 45 10 mov 0x10(%ebp),%eax
801058b0: 83 e0 03 and $0x3,%eax
801058b3: 85 c0 test %eax,%eax
801058b5: 75 39 jne 801058f0 <memset+0x50>
c &= 0xFF;
801058b7: 81 65 0c ff 00 00 00 andl $0xff,0xc(%ebp)
stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);
801058be: 8b 45 10 mov 0x10(%ebp),%eax
801058c1: c1 e8 02 shr $0x2,%eax
801058c4: 89 c1 mov %eax,%ecx
801058c6: 8b 45 0c mov 0xc(%ebp),%eax
801058c9: c1 e0 18 shl $0x18,%eax
801058cc: 89 c2 mov %eax,%edx
801058ce: 8b 45 0c mov 0xc(%ebp),%eax
801058d1: c1 e0 10 shl $0x10,%eax
801058d4: 09 c2 or %eax,%edx
801058d6: 8b 45 0c mov 0xc(%ebp),%eax
801058d9: c1 e0 08 shl $0x8,%eax
801058dc: 09 d0 or %edx,%eax
801058de: 0b 45 0c or 0xc(%ebp),%eax
801058e1: 51 push %ecx
801058e2: 50 push %eax
801058e3: ff 75 08 pushl 0x8(%ebp)
801058e6: e8 8f ff ff ff call 8010587a <stosl>
801058eb: 83 c4 0c add $0xc,%esp
801058ee: eb 12 jmp 80105902 <memset+0x62>
} else
stosb(dst, c, n);
801058f0: 8b 45 10 mov 0x10(%ebp),%eax
801058f3: 50 push %eax
801058f4: ff 75 0c pushl 0xc(%ebp)
801058f7: ff 75 08 pushl 0x8(%ebp)
801058fa: e8 55 ff ff ff call 80105854 <stosb>
801058ff: 83 c4 0c add $0xc,%esp
return dst;
80105902: 8b 45 08 mov 0x8(%ebp),%eax
}
80105905: c9 leave
80105906: c3 ret
80105907 <memcmp>:
int
memcmp(const void *v1, const void *v2, uint n)
{
80105907: 55 push %ebp
80105908: 89 e5 mov %esp,%ebp
8010590a: 83 ec 10 sub $0x10,%esp
const uchar *s1, *s2;
s1 = v1;
8010590d: 8b 45 08 mov 0x8(%ebp),%eax
80105910: 89 45 fc mov %eax,-0x4(%ebp)
s2 = v2;
80105913: 8b 45 0c mov 0xc(%ebp),%eax
80105916: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0){
80105919: eb 30 jmp 8010594b <memcmp+0x44>
if(*s1 != *s2)
8010591b: 8b 45 fc mov -0x4(%ebp),%eax
8010591e: 0f b6 10 movzbl (%eax),%edx
80105921: 8b 45 f8 mov -0x8(%ebp),%eax
80105924: 0f b6 00 movzbl (%eax),%eax
80105927: 38 c2 cmp %al,%dl
80105929: 74 18 je 80105943 <memcmp+0x3c>
return *s1 - *s2;
8010592b: 8b 45 fc mov -0x4(%ebp),%eax
8010592e: 0f b6 00 movzbl (%eax),%eax
80105931: 0f b6 d0 movzbl %al,%edx
80105934: 8b 45 f8 mov -0x8(%ebp),%eax
80105937: 0f b6 00 movzbl (%eax),%eax
8010593a: 0f b6 c0 movzbl %al,%eax
8010593d: 29 c2 sub %eax,%edx
8010593f: 89 d0 mov %edx,%eax
80105941: eb 1a jmp 8010595d <memcmp+0x56>
s1++, s2++;
80105943: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105947: 83 45 f8 01 addl $0x1,-0x8(%ebp)
{
const uchar *s1, *s2;
s1 = v1;
s2 = v2;
while(n-- > 0){
8010594b: 8b 45 10 mov 0x10(%ebp),%eax
8010594e: 8d 50 ff lea -0x1(%eax),%edx
80105951: 89 55 10 mov %edx,0x10(%ebp)
80105954: 85 c0 test %eax,%eax
80105956: 75 c3 jne 8010591b <memcmp+0x14>
if(*s1 != *s2)
return *s1 - *s2;
s1++, s2++;
}
return 0;
80105958: b8 00 00 00 00 mov $0x0,%eax
}
8010595d: c9 leave
8010595e: c3 ret
8010595f <memmove>:
void*
memmove(void *dst, const void *src, uint n)
{
8010595f: 55 push %ebp
80105960: 89 e5 mov %esp,%ebp
80105962: 83 ec 10 sub $0x10,%esp
const char *s;
char *d;
s = src;
80105965: 8b 45 0c mov 0xc(%ebp),%eax
80105968: 89 45 fc mov %eax,-0x4(%ebp)
d = dst;
8010596b: 8b 45 08 mov 0x8(%ebp),%eax
8010596e: 89 45 f8 mov %eax,-0x8(%ebp)
if(s < d && s + n > d){
80105971: 8b 45 fc mov -0x4(%ebp),%eax
80105974: 3b 45 f8 cmp -0x8(%ebp),%eax
80105977: 73 54 jae 801059cd <memmove+0x6e>
80105979: 8b 55 fc mov -0x4(%ebp),%edx
8010597c: 8b 45 10 mov 0x10(%ebp),%eax
8010597f: 01 d0 add %edx,%eax
80105981: 3b 45 f8 cmp -0x8(%ebp),%eax
80105984: 76 47 jbe 801059cd <memmove+0x6e>
s += n;
80105986: 8b 45 10 mov 0x10(%ebp),%eax
80105989: 01 45 fc add %eax,-0x4(%ebp)
d += n;
8010598c: 8b 45 10 mov 0x10(%ebp),%eax
8010598f: 01 45 f8 add %eax,-0x8(%ebp)
while(n-- > 0)
80105992: eb 13 jmp 801059a7 <memmove+0x48>
*--d = *--s;
80105994: 83 6d f8 01 subl $0x1,-0x8(%ebp)
80105998: 83 6d fc 01 subl $0x1,-0x4(%ebp)
8010599c: 8b 45 fc mov -0x4(%ebp),%eax
8010599f: 0f b6 10 movzbl (%eax),%edx
801059a2: 8b 45 f8 mov -0x8(%ebp),%eax
801059a5: 88 10 mov %dl,(%eax)
s = src;
d = dst;
if(s < d && s + n > d){
s += n;
d += n;
while(n-- > 0)
801059a7: 8b 45 10 mov 0x10(%ebp),%eax
801059aa: 8d 50 ff lea -0x1(%eax),%edx
801059ad: 89 55 10 mov %edx,0x10(%ebp)
801059b0: 85 c0 test %eax,%eax
801059b2: 75 e0 jne 80105994 <memmove+0x35>
const char *s;
char *d;
s = src;
d = dst;
if(s < d && s + n > d){
801059b4: eb 24 jmp 801059da <memmove+0x7b>
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
*d++ = *s++;
801059b6: 8b 45 f8 mov -0x8(%ebp),%eax
801059b9: 8d 50 01 lea 0x1(%eax),%edx
801059bc: 89 55 f8 mov %edx,-0x8(%ebp)
801059bf: 8b 55 fc mov -0x4(%ebp),%edx
801059c2: 8d 4a 01 lea 0x1(%edx),%ecx
801059c5: 89 4d fc mov %ecx,-0x4(%ebp)
801059c8: 0f b6 12 movzbl (%edx),%edx
801059cb: 88 10 mov %dl,(%eax)
s += n;
d += n;
while(n-- > 0)
*--d = *--s;
} else
while(n-- > 0)
801059cd: 8b 45 10 mov 0x10(%ebp),%eax
801059d0: 8d 50 ff lea -0x1(%eax),%edx
801059d3: 89 55 10 mov %edx,0x10(%ebp)
801059d6: 85 c0 test %eax,%eax
801059d8: 75 dc jne 801059b6 <memmove+0x57>
*d++ = *s++;
return dst;
801059da: 8b 45 08 mov 0x8(%ebp),%eax
}
801059dd: c9 leave
801059de: c3 ret
801059df <memcpy>:
// memcpy exists to placate GCC. Use memmove.
void*
memcpy(void *dst, const void *src, uint n)
{
801059df: 55 push %ebp
801059e0: 89 e5 mov %esp,%ebp
return memmove(dst, src, n);
801059e2: ff 75 10 pushl 0x10(%ebp)
801059e5: ff 75 0c pushl 0xc(%ebp)
801059e8: ff 75 08 pushl 0x8(%ebp)
801059eb: e8 6f ff ff ff call 8010595f <memmove>
801059f0: 83 c4 0c add $0xc,%esp
}
801059f3: c9 leave
801059f4: c3 ret
801059f5 <strncmp>:
int
strncmp(const char *p, const char *q, uint n)
{
801059f5: 55 push %ebp
801059f6: 89 e5 mov %esp,%ebp
while(n > 0 && *p && *p == *q)
801059f8: eb 0c jmp 80105a06 <strncmp+0x11>
n--, p++, q++;
801059fa: 83 6d 10 01 subl $0x1,0x10(%ebp)
801059fe: 83 45 08 01 addl $0x1,0x8(%ebp)
80105a02: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strncmp(const char *p, const char *q, uint n)
{
while(n > 0 && *p && *p == *q)
80105a06: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105a0a: 74 1a je 80105a26 <strncmp+0x31>
80105a0c: 8b 45 08 mov 0x8(%ebp),%eax
80105a0f: 0f b6 00 movzbl (%eax),%eax
80105a12: 84 c0 test %al,%al
80105a14: 74 10 je 80105a26 <strncmp+0x31>
80105a16: 8b 45 08 mov 0x8(%ebp),%eax
80105a19: 0f b6 10 movzbl (%eax),%edx
80105a1c: 8b 45 0c mov 0xc(%ebp),%eax
80105a1f: 0f b6 00 movzbl (%eax),%eax
80105a22: 38 c2 cmp %al,%dl
80105a24: 74 d4 je 801059fa <strncmp+0x5>
n--, p++, q++;
if(n == 0)
80105a26: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105a2a: 75 07 jne 80105a33 <strncmp+0x3e>
return 0;
80105a2c: b8 00 00 00 00 mov $0x0,%eax
80105a31: eb 16 jmp 80105a49 <strncmp+0x54>
return (uchar)*p - (uchar)*q;
80105a33: 8b 45 08 mov 0x8(%ebp),%eax
80105a36: 0f b6 00 movzbl (%eax),%eax
80105a39: 0f b6 d0 movzbl %al,%edx
80105a3c: 8b 45 0c mov 0xc(%ebp),%eax
80105a3f: 0f b6 00 movzbl (%eax),%eax
80105a42: 0f b6 c0 movzbl %al,%eax
80105a45: 29 c2 sub %eax,%edx
80105a47: 89 d0 mov %edx,%eax
}
80105a49: 5d pop %ebp
80105a4a: c3 ret
80105a4b <strncpy>:
char*
strncpy(char *s, const char *t, int n)
{
80105a4b: 55 push %ebp
80105a4c: 89 e5 mov %esp,%ebp
80105a4e: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
80105a51: 8b 45 08 mov 0x8(%ebp),%eax
80105a54: 89 45 fc mov %eax,-0x4(%ebp)
while(n-- > 0 && (*s++ = *t++) != 0)
80105a57: 90 nop
80105a58: 8b 45 10 mov 0x10(%ebp),%eax
80105a5b: 8d 50 ff lea -0x1(%eax),%edx
80105a5e: 89 55 10 mov %edx,0x10(%ebp)
80105a61: 85 c0 test %eax,%eax
80105a63: 7e 2c jle 80105a91 <strncpy+0x46>
80105a65: 8b 45 08 mov 0x8(%ebp),%eax
80105a68: 8d 50 01 lea 0x1(%eax),%edx
80105a6b: 89 55 08 mov %edx,0x8(%ebp)
80105a6e: 8b 55 0c mov 0xc(%ebp),%edx
80105a71: 8d 4a 01 lea 0x1(%edx),%ecx
80105a74: 89 4d 0c mov %ecx,0xc(%ebp)
80105a77: 0f b6 12 movzbl (%edx),%edx
80105a7a: 88 10 mov %dl,(%eax)
80105a7c: 0f b6 00 movzbl (%eax),%eax
80105a7f: 84 c0 test %al,%al
80105a81: 75 d5 jne 80105a58 <strncpy+0xd>
;
while(n-- > 0)
80105a83: eb 0c jmp 80105a91 <strncpy+0x46>
*s++ = 0;
80105a85: 8b 45 08 mov 0x8(%ebp),%eax
80105a88: 8d 50 01 lea 0x1(%eax),%edx
80105a8b: 89 55 08 mov %edx,0x8(%ebp)
80105a8e: c6 00 00 movb $0x0,(%eax)
char *os;
os = s;
while(n-- > 0 && (*s++ = *t++) != 0)
;
while(n-- > 0)
80105a91: 8b 45 10 mov 0x10(%ebp),%eax
80105a94: 8d 50 ff lea -0x1(%eax),%edx
80105a97: 89 55 10 mov %edx,0x10(%ebp)
80105a9a: 85 c0 test %eax,%eax
80105a9c: 7f e7 jg 80105a85 <strncpy+0x3a>
*s++ = 0;
return os;
80105a9e: 8b 45 fc mov -0x4(%ebp),%eax
}
80105aa1: c9 leave
80105aa2: c3 ret
80105aa3 <safestrcpy>:
// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
80105aa3: 55 push %ebp
80105aa4: 89 e5 mov %esp,%ebp
80105aa6: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
80105aa9: 8b 45 08 mov 0x8(%ebp),%eax
80105aac: 89 45 fc mov %eax,-0x4(%ebp)
if(n <= 0)
80105aaf: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105ab3: 7f 05 jg 80105aba <safestrcpy+0x17>
return os;
80105ab5: 8b 45 fc mov -0x4(%ebp),%eax
80105ab8: eb 31 jmp 80105aeb <safestrcpy+0x48>
while(--n > 0 && (*s++ = *t++) != 0)
80105aba: 83 6d 10 01 subl $0x1,0x10(%ebp)
80105abe: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105ac2: 7e 1e jle 80105ae2 <safestrcpy+0x3f>
80105ac4: 8b 45 08 mov 0x8(%ebp),%eax
80105ac7: 8d 50 01 lea 0x1(%eax),%edx
80105aca: 89 55 08 mov %edx,0x8(%ebp)
80105acd: 8b 55 0c mov 0xc(%ebp),%edx
80105ad0: 8d 4a 01 lea 0x1(%edx),%ecx
80105ad3: 89 4d 0c mov %ecx,0xc(%ebp)
80105ad6: 0f b6 12 movzbl (%edx),%edx
80105ad9: 88 10 mov %dl,(%eax)
80105adb: 0f b6 00 movzbl (%eax),%eax
80105ade: 84 c0 test %al,%al
80105ae0: 75 d8 jne 80105aba <safestrcpy+0x17>
;
*s = 0;
80105ae2: 8b 45 08 mov 0x8(%ebp),%eax
80105ae5: c6 00 00 movb $0x0,(%eax)
return os;
80105ae8: 8b 45 fc mov -0x4(%ebp),%eax
}
80105aeb: c9 leave
80105aec: c3 ret
80105aed <strlen>:
int
strlen(const char *s)
{
80105aed: 55 push %ebp
80105aee: 89 e5 mov %esp,%ebp
80105af0: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
80105af3: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80105afa: eb 04 jmp 80105b00 <strlen+0x13>
80105afc: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105b00: 8b 55 fc mov -0x4(%ebp),%edx
80105b03: 8b 45 08 mov 0x8(%ebp),%eax
80105b06: 01 d0 add %edx,%eax
80105b08: 0f b6 00 movzbl (%eax),%eax
80105b0b: 84 c0 test %al,%al
80105b0d: 75 ed jne 80105afc <strlen+0xf>
;
return n;
80105b0f: 8b 45 fc mov -0x4(%ebp),%eax
}
80105b12: c9 leave
80105b13: c3 ret
80105b14 <swtch>:
# Save current register context in old
# and then load register context from new.
.globl swtch
swtch:
movl 4(%esp), %eax
80105b14: 8b 44 24 04 mov 0x4(%esp),%eax
movl 8(%esp), %edx
80105b18: 8b 54 24 08 mov 0x8(%esp),%edx
# Save old callee-save registers
pushl %ebp
80105b1c: 55 push %ebp
pushl %ebx
80105b1d: 53 push %ebx
pushl %esi
80105b1e: 56 push %esi
pushl %edi
80105b1f: 57 push %edi
# Switch stacks
movl %esp, (%eax)
80105b20: 89 20 mov %esp,(%eax)
movl %edx, %esp
80105b22: 89 d4 mov %edx,%esp
# Load new callee-save registers
popl %edi
80105b24: 5f pop %edi
popl %esi
80105b25: 5e pop %esi
popl %ebx
80105b26: 5b pop %ebx
popl %ebp
80105b27: 5d pop %ebp
ret
80105b28: c3 ret
80105b29 <fetchint>:
// to a saved program counter, and then the first argument.
// Fetch the int at addr from the current process.
int
fetchint(uint addr, int *ip)
{
80105b29: 55 push %ebp
80105b2a: 89 e5 mov %esp,%ebp
if(addr >= proc->sz || addr+4 > proc->sz)
80105b2c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105b32: 8b 00 mov (%eax),%eax
80105b34: 3b 45 08 cmp 0x8(%ebp),%eax
80105b37: 76 12 jbe 80105b4b <fetchint+0x22>
80105b39: 8b 45 08 mov 0x8(%ebp),%eax
80105b3c: 8d 50 04 lea 0x4(%eax),%edx
80105b3f: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105b45: 8b 00 mov (%eax),%eax
80105b47: 39 c2 cmp %eax,%edx
80105b49: 76 07 jbe 80105b52 <fetchint+0x29>
return -1;
80105b4b: b8 ff ff ff ff mov $0xffffffff,%eax
80105b50: eb 0f jmp 80105b61 <fetchint+0x38>
*ip = *(int*)(addr);
80105b52: 8b 45 08 mov 0x8(%ebp),%eax
80105b55: 8b 10 mov (%eax),%edx
80105b57: 8b 45 0c mov 0xc(%ebp),%eax
80105b5a: 89 10 mov %edx,(%eax)
return 0;
80105b5c: b8 00 00 00 00 mov $0x0,%eax
}
80105b61: 5d pop %ebp
80105b62: c3 ret
80105b63 <fetchstr>:
// Fetch the nul-terminated string at addr from the current process.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(uint addr, char **pp)
{
80105b63: 55 push %ebp
80105b64: 89 e5 mov %esp,%ebp
80105b66: 83 ec 10 sub $0x10,%esp
char *s, *ep;
if(addr >= proc->sz)
80105b69: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105b6f: 8b 00 mov (%eax),%eax
80105b71: 3b 45 08 cmp 0x8(%ebp),%eax
80105b74: 77 07 ja 80105b7d <fetchstr+0x1a>
return -1;
80105b76: b8 ff ff ff ff mov $0xffffffff,%eax
80105b7b: eb 46 jmp 80105bc3 <fetchstr+0x60>
*pp = (char*)addr;
80105b7d: 8b 55 08 mov 0x8(%ebp),%edx
80105b80: 8b 45 0c mov 0xc(%ebp),%eax
80105b83: 89 10 mov %edx,(%eax)
ep = (char*)proc->sz;
80105b85: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105b8b: 8b 00 mov (%eax),%eax
80105b8d: 89 45 f8 mov %eax,-0x8(%ebp)
for(s = *pp; s < ep; s++)
80105b90: 8b 45 0c mov 0xc(%ebp),%eax
80105b93: 8b 00 mov (%eax),%eax
80105b95: 89 45 fc mov %eax,-0x4(%ebp)
80105b98: eb 1c jmp 80105bb6 <fetchstr+0x53>
if(*s == 0)
80105b9a: 8b 45 fc mov -0x4(%ebp),%eax
80105b9d: 0f b6 00 movzbl (%eax),%eax
80105ba0: 84 c0 test %al,%al
80105ba2: 75 0e jne 80105bb2 <fetchstr+0x4f>
return s - *pp;
80105ba4: 8b 55 fc mov -0x4(%ebp),%edx
80105ba7: 8b 45 0c mov 0xc(%ebp),%eax
80105baa: 8b 00 mov (%eax),%eax
80105bac: 29 c2 sub %eax,%edx
80105bae: 89 d0 mov %edx,%eax
80105bb0: eb 11 jmp 80105bc3 <fetchstr+0x60>
if(addr >= proc->sz)
return -1;
*pp = (char*)addr;
ep = (char*)proc->sz;
for(s = *pp; s < ep; s++)
80105bb2: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105bb6: 8b 45 fc mov -0x4(%ebp),%eax
80105bb9: 3b 45 f8 cmp -0x8(%ebp),%eax
80105bbc: 72 dc jb 80105b9a <fetchstr+0x37>
if(*s == 0)
return s - *pp;
return -1;
80105bbe: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105bc3: c9 leave
80105bc4: c3 ret
80105bc5 <argint>:
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
80105bc5: 55 push %ebp
80105bc6: 89 e5 mov %esp,%ebp
return fetchint(proc->tf->esp + 4 + 4*n, ip);
80105bc8: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105bce: 8b 40 18 mov 0x18(%eax),%eax
80105bd1: 8b 40 44 mov 0x44(%eax),%eax
80105bd4: 8b 55 08 mov 0x8(%ebp),%edx
80105bd7: c1 e2 02 shl $0x2,%edx
80105bda: 01 d0 add %edx,%eax
80105bdc: 83 c0 04 add $0x4,%eax
80105bdf: ff 75 0c pushl 0xc(%ebp)
80105be2: 50 push %eax
80105be3: e8 41 ff ff ff call 80105b29 <fetchint>
80105be8: 83 c4 08 add $0x8,%esp
}
80105beb: c9 leave
80105bec: c3 ret
80105bed <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes. Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
80105bed: 55 push %ebp
80105bee: 89 e5 mov %esp,%ebp
80105bf0: 83 ec 10 sub $0x10,%esp
int i;
if(argint(n, &i) < 0)
80105bf3: 8d 45 fc lea -0x4(%ebp),%eax
80105bf6: 50 push %eax
80105bf7: ff 75 08 pushl 0x8(%ebp)
80105bfa: e8 c6 ff ff ff call 80105bc5 <argint>
80105bff: 83 c4 08 add $0x8,%esp
80105c02: 85 c0 test %eax,%eax
80105c04: 79 07 jns 80105c0d <argptr+0x20>
return -1;
80105c06: b8 ff ff ff ff mov $0xffffffff,%eax
80105c0b: eb 3b jmp 80105c48 <argptr+0x5b>
if((uint)i >= proc->sz || (uint)i+size > proc->sz)
80105c0d: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105c13: 8b 00 mov (%eax),%eax
80105c15: 8b 55 fc mov -0x4(%ebp),%edx
80105c18: 39 d0 cmp %edx,%eax
80105c1a: 76 16 jbe 80105c32 <argptr+0x45>
80105c1c: 8b 45 fc mov -0x4(%ebp),%eax
80105c1f: 89 c2 mov %eax,%edx
80105c21: 8b 45 10 mov 0x10(%ebp),%eax
80105c24: 01 c2 add %eax,%edx
80105c26: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105c2c: 8b 00 mov (%eax),%eax
80105c2e: 39 c2 cmp %eax,%edx
80105c30: 76 07 jbe 80105c39 <argptr+0x4c>
return -1;
80105c32: b8 ff ff ff ff mov $0xffffffff,%eax
80105c37: eb 0f jmp 80105c48 <argptr+0x5b>
*pp = (char*)i;
80105c39: 8b 45 fc mov -0x4(%ebp),%eax
80105c3c: 89 c2 mov %eax,%edx
80105c3e: 8b 45 0c mov 0xc(%ebp),%eax
80105c41: 89 10 mov %edx,(%eax)
return 0;
80105c43: b8 00 00 00 00 mov $0x0,%eax
}
80105c48: c9 leave
80105c49: c3 ret
80105c4a <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
80105c4a: 55 push %ebp
80105c4b: 89 e5 mov %esp,%ebp
80105c4d: 83 ec 10 sub $0x10,%esp
int addr;
if(argint(n, &addr) < 0)
80105c50: 8d 45 fc lea -0x4(%ebp),%eax
80105c53: 50 push %eax
80105c54: ff 75 08 pushl 0x8(%ebp)
80105c57: e8 69 ff ff ff call 80105bc5 <argint>
80105c5c: 83 c4 08 add $0x8,%esp
80105c5f: 85 c0 test %eax,%eax
80105c61: 79 07 jns 80105c6a <argstr+0x20>
return -1;
80105c63: b8 ff ff ff ff mov $0xffffffff,%eax
80105c68: eb 0f jmp 80105c79 <argstr+0x2f>
return fetchstr(addr, pp);
80105c6a: 8b 45 fc mov -0x4(%ebp),%eax
80105c6d: ff 75 0c pushl 0xc(%ebp)
80105c70: 50 push %eax
80105c71: e8 ed fe ff ff call 80105b63 <fetchstr>
80105c76: 83 c4 08 add $0x8,%esp
}
80105c79: c9 leave
80105c7a: c3 ret
80105c7b <syscall>:
[SYS_close] sys_close,
};
void
syscall(void)
{
80105c7b: 55 push %ebp
80105c7c: 89 e5 mov %esp,%ebp
80105c7e: 53 push %ebx
80105c7f: 83 ec 14 sub $0x14,%esp
int num;
num = proc->tf->eax;
80105c82: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105c88: 8b 40 18 mov 0x18(%eax),%eax
80105c8b: 8b 40 1c mov 0x1c(%eax),%eax
80105c8e: 89 45 f4 mov %eax,-0xc(%ebp)
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
80105c91: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105c95: 7e 30 jle 80105cc7 <syscall+0x4c>
80105c97: 8b 45 f4 mov -0xc(%ebp),%eax
80105c9a: 83 f8 15 cmp $0x15,%eax
80105c9d: 77 28 ja 80105cc7 <syscall+0x4c>
80105c9f: 8b 45 f4 mov -0xc(%ebp),%eax
80105ca2: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax
80105ca9: 85 c0 test %eax,%eax
80105cab: 74 1a je 80105cc7 <syscall+0x4c>
proc->tf->eax = syscalls[num]();
80105cad: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105cb3: 8b 58 18 mov 0x18(%eax),%ebx
80105cb6: 8b 45 f4 mov -0xc(%ebp),%eax
80105cb9: 8b 04 85 40 c0 10 80 mov -0x7fef3fc0(,%eax,4),%eax
80105cc0: ff d0 call *%eax
80105cc2: 89 43 1c mov %eax,0x1c(%ebx)
80105cc5: eb 34 jmp 80105cfb <syscall+0x80>
} else {
cprintf("%d %s: unknown sys call %d\n",
proc->pid, proc->name, num);
80105cc7: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105ccd: 8d 50 6c lea 0x6c(%eax),%edx
80105cd0: 65 a1 04 00 00 00 mov %gs:0x4,%eax
num = proc->tf->eax;
if(num > 0 && num < NELEM(syscalls) && syscalls[num]) {
proc->tf->eax = syscalls[num]();
} else {
cprintf("%d %s: unknown sys call %d\n",
80105cd6: 8b 40 10 mov 0x10(%eax),%eax
80105cd9: ff 75 f4 pushl -0xc(%ebp)
80105cdc: 52 push %edx
80105cdd: 50 push %eax
80105cde: 68 7d 90 10 80 push $0x8010907d
80105ce3: e8 de a6 ff ff call 801003c6 <cprintf>
80105ce8: 83 c4 10 add $0x10,%esp
proc->pid, proc->name, num);
proc->tf->eax = -1;
80105ceb: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105cf1: 8b 40 18 mov 0x18(%eax),%eax
80105cf4: c7 40 1c ff ff ff ff movl $0xffffffff,0x1c(%eax)
}
}
80105cfb: 90 nop
80105cfc: 8b 5d fc mov -0x4(%ebp),%ebx
80105cff: c9 leave
80105d00: c3 ret
80105d01 <argfd>:
// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
{
80105d01: 55 push %ebp
80105d02: 89 e5 mov %esp,%ebp
80105d04: 83 ec 18 sub $0x18,%esp
int fd;
struct file *f;
if(argint(n, &fd) < 0)
80105d07: 83 ec 08 sub $0x8,%esp
80105d0a: 8d 45 f0 lea -0x10(%ebp),%eax
80105d0d: 50 push %eax
80105d0e: ff 75 08 pushl 0x8(%ebp)
80105d11: e8 af fe ff ff call 80105bc5 <argint>
80105d16: 83 c4 10 add $0x10,%esp
80105d19: 85 c0 test %eax,%eax
80105d1b: 79 07 jns 80105d24 <argfd+0x23>
return -1;
80105d1d: b8 ff ff ff ff mov $0xffffffff,%eax
80105d22: eb 50 jmp 80105d74 <argfd+0x73>
if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
80105d24: 8b 45 f0 mov -0x10(%ebp),%eax
80105d27: 85 c0 test %eax,%eax
80105d29: 78 21 js 80105d4c <argfd+0x4b>
80105d2b: 8b 45 f0 mov -0x10(%ebp),%eax
80105d2e: 83 f8 0f cmp $0xf,%eax
80105d31: 7f 19 jg 80105d4c <argfd+0x4b>
80105d33: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105d39: 8b 55 f0 mov -0x10(%ebp),%edx
80105d3c: 83 c2 08 add $0x8,%edx
80105d3f: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80105d43: 89 45 f4 mov %eax,-0xc(%ebp)
80105d46: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105d4a: 75 07 jne 80105d53 <argfd+0x52>
return -1;
80105d4c: b8 ff ff ff ff mov $0xffffffff,%eax
80105d51: eb 21 jmp 80105d74 <argfd+0x73>
if(pfd)
80105d53: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
80105d57: 74 08 je 80105d61 <argfd+0x60>
*pfd = fd;
80105d59: 8b 55 f0 mov -0x10(%ebp),%edx
80105d5c: 8b 45 0c mov 0xc(%ebp),%eax
80105d5f: 89 10 mov %edx,(%eax)
if(pf)
80105d61: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80105d65: 74 08 je 80105d6f <argfd+0x6e>
*pf = f;
80105d67: 8b 45 10 mov 0x10(%ebp),%eax
80105d6a: 8b 55 f4 mov -0xc(%ebp),%edx
80105d6d: 89 10 mov %edx,(%eax)
return 0;
80105d6f: b8 00 00 00 00 mov $0x0,%eax
}
80105d74: c9 leave
80105d75: c3 ret
80105d76 <fdalloc>:
// Allocate a file descriptor for the given file.
// Takes over file reference from caller on success.
static int
fdalloc(struct file *f)
{
80105d76: 55 push %ebp
80105d77: 89 e5 mov %esp,%ebp
80105d79: 83 ec 10 sub $0x10,%esp
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105d7c: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
80105d83: eb 30 jmp 80105db5 <fdalloc+0x3f>
if(proc->ofile[fd] == 0){
80105d85: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105d8b: 8b 55 fc mov -0x4(%ebp),%edx
80105d8e: 83 c2 08 add $0x8,%edx
80105d91: 8b 44 90 08 mov 0x8(%eax,%edx,4),%eax
80105d95: 85 c0 test %eax,%eax
80105d97: 75 18 jne 80105db1 <fdalloc+0x3b>
proc->ofile[fd] = f;
80105d99: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105d9f: 8b 55 fc mov -0x4(%ebp),%edx
80105da2: 8d 4a 08 lea 0x8(%edx),%ecx
80105da5: 8b 55 08 mov 0x8(%ebp),%edx
80105da8: 89 54 88 08 mov %edx,0x8(%eax,%ecx,4)
return fd;
80105dac: 8b 45 fc mov -0x4(%ebp),%eax
80105daf: eb 0f jmp 80105dc0 <fdalloc+0x4a>
static int
fdalloc(struct file *f)
{
int fd;
for(fd = 0; fd < NOFILE; fd++){
80105db1: 83 45 fc 01 addl $0x1,-0x4(%ebp)
80105db5: 83 7d fc 0f cmpl $0xf,-0x4(%ebp)
80105db9: 7e ca jle 80105d85 <fdalloc+0xf>
if(proc->ofile[fd] == 0){
proc->ofile[fd] = f;
return fd;
}
}
return -1;
80105dbb: b8 ff ff ff ff mov $0xffffffff,%eax
}
80105dc0: c9 leave
80105dc1: c3 ret
80105dc2 <sys_dup>:
int
sys_dup(void)
{
80105dc2: 55 push %ebp
80105dc3: 89 e5 mov %esp,%ebp
80105dc5: 83 ec 18 sub $0x18,%esp
struct file *f;
int fd;
if(argfd(0, 0, &f) < 0)
80105dc8: 83 ec 04 sub $0x4,%esp
80105dcb: 8d 45 f0 lea -0x10(%ebp),%eax
80105dce: 50 push %eax
80105dcf: 6a 00 push $0x0
80105dd1: 6a 00 push $0x0
80105dd3: e8 29 ff ff ff call 80105d01 <argfd>
80105dd8: 83 c4 10 add $0x10,%esp
80105ddb: 85 c0 test %eax,%eax
80105ddd: 79 07 jns 80105de6 <sys_dup+0x24>
return -1;
80105ddf: b8 ff ff ff ff mov $0xffffffff,%eax
80105de4: eb 31 jmp 80105e17 <sys_dup+0x55>
if((fd=fdalloc(f)) < 0)
80105de6: 8b 45 f0 mov -0x10(%ebp),%eax
80105de9: 83 ec 0c sub $0xc,%esp
80105dec: 50 push %eax
80105ded: e8 84 ff ff ff call 80105d76 <fdalloc>
80105df2: 83 c4 10 add $0x10,%esp
80105df5: 89 45 f4 mov %eax,-0xc(%ebp)
80105df8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105dfc: 79 07 jns 80105e05 <sys_dup+0x43>
return -1;
80105dfe: b8 ff ff ff ff mov $0xffffffff,%eax
80105e03: eb 12 jmp 80105e17 <sys_dup+0x55>
filedup(f);
80105e05: 8b 45 f0 mov -0x10(%ebp),%eax
80105e08: 83 ec 0c sub $0xc,%esp
80105e0b: 50 push %eax
80105e0c: e8 ef b1 ff ff call 80101000 <filedup>
80105e11: 83 c4 10 add $0x10,%esp
return fd;
80105e14: 8b 45 f4 mov -0xc(%ebp),%eax
}
80105e17: c9 leave
80105e18: c3 ret
80105e19 <sys_read>:
int
sys_read(void)
{
80105e19: 55 push %ebp
80105e1a: 89 e5 mov %esp,%ebp
80105e1c: 83 ec 18 sub $0x18,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80105e1f: 83 ec 04 sub $0x4,%esp
80105e22: 8d 45 f4 lea -0xc(%ebp),%eax
80105e25: 50 push %eax
80105e26: 6a 00 push $0x0
80105e28: 6a 00 push $0x0
80105e2a: e8 d2 fe ff ff call 80105d01 <argfd>
80105e2f: 83 c4 10 add $0x10,%esp
80105e32: 85 c0 test %eax,%eax
80105e34: 78 2e js 80105e64 <sys_read+0x4b>
80105e36: 83 ec 08 sub $0x8,%esp
80105e39: 8d 45 f0 lea -0x10(%ebp),%eax
80105e3c: 50 push %eax
80105e3d: 6a 02 push $0x2
80105e3f: e8 81 fd ff ff call 80105bc5 <argint>
80105e44: 83 c4 10 add $0x10,%esp
80105e47: 85 c0 test %eax,%eax
80105e49: 78 19 js 80105e64 <sys_read+0x4b>
80105e4b: 8b 45 f0 mov -0x10(%ebp),%eax
80105e4e: 83 ec 04 sub $0x4,%esp
80105e51: 50 push %eax
80105e52: 8d 45 ec lea -0x14(%ebp),%eax
80105e55: 50 push %eax
80105e56: 6a 01 push $0x1
80105e58: e8 90 fd ff ff call 80105bed <argptr>
80105e5d: 83 c4 10 add $0x10,%esp
80105e60: 85 c0 test %eax,%eax
80105e62: 79 07 jns 80105e6b <sys_read+0x52>
return -1;
80105e64: b8 ff ff ff ff mov $0xffffffff,%eax
80105e69: eb 17 jmp 80105e82 <sys_read+0x69>
return fileread(f, p, n);
80105e6b: 8b 4d f0 mov -0x10(%ebp),%ecx
80105e6e: 8b 55 ec mov -0x14(%ebp),%edx
80105e71: 8b 45 f4 mov -0xc(%ebp),%eax
80105e74: 83 ec 04 sub $0x4,%esp
80105e77: 51 push %ecx
80105e78: 52 push %edx
80105e79: 50 push %eax
80105e7a: e8 11 b3 ff ff call 80101190 <fileread>
80105e7f: 83 c4 10 add $0x10,%esp
}
80105e82: c9 leave
80105e83: c3 ret
80105e84 <sys_write>:
int
sys_write(void)
{
80105e84: 55 push %ebp
80105e85: 89 e5 mov %esp,%ebp
80105e87: 83 ec 18 sub $0x18,%esp
struct file *f;
int n;
char *p;
if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
80105e8a: 83 ec 04 sub $0x4,%esp
80105e8d: 8d 45 f4 lea -0xc(%ebp),%eax
80105e90: 50 push %eax
80105e91: 6a 00 push $0x0
80105e93: 6a 00 push $0x0
80105e95: e8 67 fe ff ff call 80105d01 <argfd>
80105e9a: 83 c4 10 add $0x10,%esp
80105e9d: 85 c0 test %eax,%eax
80105e9f: 78 2e js 80105ecf <sys_write+0x4b>
80105ea1: 83 ec 08 sub $0x8,%esp
80105ea4: 8d 45 f0 lea -0x10(%ebp),%eax
80105ea7: 50 push %eax
80105ea8: 6a 02 push $0x2
80105eaa: e8 16 fd ff ff call 80105bc5 <argint>
80105eaf: 83 c4 10 add $0x10,%esp
80105eb2: 85 c0 test %eax,%eax
80105eb4: 78 19 js 80105ecf <sys_write+0x4b>
80105eb6: 8b 45 f0 mov -0x10(%ebp),%eax
80105eb9: 83 ec 04 sub $0x4,%esp
80105ebc: 50 push %eax
80105ebd: 8d 45 ec lea -0x14(%ebp),%eax
80105ec0: 50 push %eax
80105ec1: 6a 01 push $0x1
80105ec3: e8 25 fd ff ff call 80105bed <argptr>
80105ec8: 83 c4 10 add $0x10,%esp
80105ecb: 85 c0 test %eax,%eax
80105ecd: 79 07 jns 80105ed6 <sys_write+0x52>
return -1;
80105ecf: b8 ff ff ff ff mov $0xffffffff,%eax
80105ed4: eb 17 jmp 80105eed <sys_write+0x69>
return filewrite(f, p, n);
80105ed6: 8b 4d f0 mov -0x10(%ebp),%ecx
80105ed9: 8b 55 ec mov -0x14(%ebp),%edx
80105edc: 8b 45 f4 mov -0xc(%ebp),%eax
80105edf: 83 ec 04 sub $0x4,%esp
80105ee2: 51 push %ecx
80105ee3: 52 push %edx
80105ee4: 50 push %eax
80105ee5: e8 5e b3 ff ff call 80101248 <filewrite>
80105eea: 83 c4 10 add $0x10,%esp
}
80105eed: c9 leave
80105eee: c3 ret
80105eef <sys_close>:
int
sys_close(void)
{
80105eef: 55 push %ebp
80105ef0: 89 e5 mov %esp,%ebp
80105ef2: 83 ec 18 sub $0x18,%esp
int fd;
struct file *f;
if(argfd(0, &fd, &f) < 0)
80105ef5: 83 ec 04 sub $0x4,%esp
80105ef8: 8d 45 f0 lea -0x10(%ebp),%eax
80105efb: 50 push %eax
80105efc: 8d 45 f4 lea -0xc(%ebp),%eax
80105eff: 50 push %eax
80105f00: 6a 00 push $0x0
80105f02: e8 fa fd ff ff call 80105d01 <argfd>
80105f07: 83 c4 10 add $0x10,%esp
80105f0a: 85 c0 test %eax,%eax
80105f0c: 79 07 jns 80105f15 <sys_close+0x26>
return -1;
80105f0e: b8 ff ff ff ff mov $0xffffffff,%eax
80105f13: eb 28 jmp 80105f3d <sys_close+0x4e>
proc->ofile[fd] = 0;
80105f15: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80105f1b: 8b 55 f4 mov -0xc(%ebp),%edx
80105f1e: 83 c2 08 add $0x8,%edx
80105f21: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80105f28: 00
fileclose(f);
80105f29: 8b 45 f0 mov -0x10(%ebp),%eax
80105f2c: 83 ec 0c sub $0xc,%esp
80105f2f: 50 push %eax
80105f30: e8 1c b1 ff ff call 80101051 <fileclose>
80105f35: 83 c4 10 add $0x10,%esp
return 0;
80105f38: b8 00 00 00 00 mov $0x0,%eax
}
80105f3d: c9 leave
80105f3e: c3 ret
80105f3f <sys_fstat>:
int
sys_fstat(void)
{
80105f3f: 55 push %ebp
80105f40: 89 e5 mov %esp,%ebp
80105f42: 83 ec 18 sub $0x18,%esp
struct file *f;
struct stat *st;
if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
80105f45: 83 ec 04 sub $0x4,%esp
80105f48: 8d 45 f4 lea -0xc(%ebp),%eax
80105f4b: 50 push %eax
80105f4c: 6a 00 push $0x0
80105f4e: 6a 00 push $0x0
80105f50: e8 ac fd ff ff call 80105d01 <argfd>
80105f55: 83 c4 10 add $0x10,%esp
80105f58: 85 c0 test %eax,%eax
80105f5a: 78 17 js 80105f73 <sys_fstat+0x34>
80105f5c: 83 ec 04 sub $0x4,%esp
80105f5f: 6a 14 push $0x14
80105f61: 8d 45 f0 lea -0x10(%ebp),%eax
80105f64: 50 push %eax
80105f65: 6a 01 push $0x1
80105f67: e8 81 fc ff ff call 80105bed <argptr>
80105f6c: 83 c4 10 add $0x10,%esp
80105f6f: 85 c0 test %eax,%eax
80105f71: 79 07 jns 80105f7a <sys_fstat+0x3b>
return -1;
80105f73: b8 ff ff ff ff mov $0xffffffff,%eax
80105f78: eb 13 jmp 80105f8d <sys_fstat+0x4e>
return filestat(f, st);
80105f7a: 8b 55 f0 mov -0x10(%ebp),%edx
80105f7d: 8b 45 f4 mov -0xc(%ebp),%eax
80105f80: 83 ec 08 sub $0x8,%esp
80105f83: 52 push %edx
80105f84: 50 push %eax
80105f85: e8 af b1 ff ff call 80101139 <filestat>
80105f8a: 83 c4 10 add $0x10,%esp
}
80105f8d: c9 leave
80105f8e: c3 ret
80105f8f <sys_link>:
// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
80105f8f: 55 push %ebp
80105f90: 89 e5 mov %esp,%ebp
80105f92: 83 ec 28 sub $0x28,%esp
char name[DIRSIZ], *new, *old;
struct inode *dp, *ip;
if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
80105f95: 83 ec 08 sub $0x8,%esp
80105f98: 8d 45 d8 lea -0x28(%ebp),%eax
80105f9b: 50 push %eax
80105f9c: 6a 00 push $0x0
80105f9e: e8 a7 fc ff ff call 80105c4a <argstr>
80105fa3: 83 c4 10 add $0x10,%esp
80105fa6: 85 c0 test %eax,%eax
80105fa8: 78 15 js 80105fbf <sys_link+0x30>
80105faa: 83 ec 08 sub $0x8,%esp
80105fad: 8d 45 dc lea -0x24(%ebp),%eax
80105fb0: 50 push %eax
80105fb1: 6a 01 push $0x1
80105fb3: e8 92 fc ff ff call 80105c4a <argstr>
80105fb8: 83 c4 10 add $0x10,%esp
80105fbb: 85 c0 test %eax,%eax
80105fbd: 79 0a jns 80105fc9 <sys_link+0x3a>
return -1;
80105fbf: b8 ff ff ff ff mov $0xffffffff,%eax
80105fc4: e9 68 01 00 00 jmp 80106131 <sys_link+0x1a2>
begin_op();
80105fc9: e8 7f d5 ff ff call 8010354d <begin_op>
if((ip = namei(old)) == 0){
80105fce: 8b 45 d8 mov -0x28(%ebp),%eax
80105fd1: 83 ec 0c sub $0xc,%esp
80105fd4: 50 push %eax
80105fd5: e8 4e c5 ff ff call 80102528 <namei>
80105fda: 83 c4 10 add $0x10,%esp
80105fdd: 89 45 f4 mov %eax,-0xc(%ebp)
80105fe0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80105fe4: 75 0f jne 80105ff5 <sys_link+0x66>
end_op();
80105fe6: e8 ee d5 ff ff call 801035d9 <end_op>
return -1;
80105feb: b8 ff ff ff ff mov $0xffffffff,%eax
80105ff0: e9 3c 01 00 00 jmp 80106131 <sys_link+0x1a2>
}
ilock(ip);
80105ff5: 83 ec 0c sub $0xc,%esp
80105ff8: ff 75 f4 pushl -0xc(%ebp)
80105ffb: e8 6a b9 ff ff call 8010196a <ilock>
80106000: 83 c4 10 add $0x10,%esp
if(ip->type == T_DIR){
80106003: 8b 45 f4 mov -0xc(%ebp),%eax
80106006: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010600a: 66 83 f8 01 cmp $0x1,%ax
8010600e: 75 1d jne 8010602d <sys_link+0x9e>
iunlockput(ip);
80106010: 83 ec 0c sub $0xc,%esp
80106013: ff 75 f4 pushl -0xc(%ebp)
80106016: e8 0f bc ff ff call 80101c2a <iunlockput>
8010601b: 83 c4 10 add $0x10,%esp
end_op();
8010601e: e8 b6 d5 ff ff call 801035d9 <end_op>
return -1;
80106023: b8 ff ff ff ff mov $0xffffffff,%eax
80106028: e9 04 01 00 00 jmp 80106131 <sys_link+0x1a2>
}
ip->nlink++;
8010602d: 8b 45 f4 mov -0xc(%ebp),%eax
80106030: 0f b7 40 16 movzwl 0x16(%eax),%eax
80106034: 83 c0 01 add $0x1,%eax
80106037: 89 c2 mov %eax,%edx
80106039: 8b 45 f4 mov -0xc(%ebp),%eax
8010603c: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80106040: 83 ec 0c sub $0xc,%esp
80106043: ff 75 f4 pushl -0xc(%ebp)
80106046: e8 45 b7 ff ff call 80101790 <iupdate>
8010604b: 83 c4 10 add $0x10,%esp
iunlock(ip);
8010604e: 83 ec 0c sub $0xc,%esp
80106051: ff 75 f4 pushl -0xc(%ebp)
80106054: e8 6f ba ff ff call 80101ac8 <iunlock>
80106059: 83 c4 10 add $0x10,%esp
if((dp = nameiparent(new, name)) == 0)
8010605c: 8b 45 dc mov -0x24(%ebp),%eax
8010605f: 83 ec 08 sub $0x8,%esp
80106062: 8d 55 e2 lea -0x1e(%ebp),%edx
80106065: 52 push %edx
80106066: 50 push %eax
80106067: e8 d8 c4 ff ff call 80102544 <nameiparent>
8010606c: 83 c4 10 add $0x10,%esp
8010606f: 89 45 f0 mov %eax,-0x10(%ebp)
80106072: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106076: 74 71 je 801060e9 <sys_link+0x15a>
goto bad;
ilock(dp);
80106078: 83 ec 0c sub $0xc,%esp
8010607b: ff 75 f0 pushl -0x10(%ebp)
8010607e: e8 e7 b8 ff ff call 8010196a <ilock>
80106083: 83 c4 10 add $0x10,%esp
if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
80106086: 8b 45 f0 mov -0x10(%ebp),%eax
80106089: 8b 10 mov (%eax),%edx
8010608b: 8b 45 f4 mov -0xc(%ebp),%eax
8010608e: 8b 00 mov (%eax),%eax
80106090: 39 c2 cmp %eax,%edx
80106092: 75 1d jne 801060b1 <sys_link+0x122>
80106094: 8b 45 f4 mov -0xc(%ebp),%eax
80106097: 8b 40 04 mov 0x4(%eax),%eax
8010609a: 83 ec 04 sub $0x4,%esp
8010609d: 50 push %eax
8010609e: 8d 45 e2 lea -0x1e(%ebp),%eax
801060a1: 50 push %eax
801060a2: ff 75 f0 pushl -0x10(%ebp)
801060a5: e8 e2 c1 ff ff call 8010228c <dirlink>
801060aa: 83 c4 10 add $0x10,%esp
801060ad: 85 c0 test %eax,%eax
801060af: 79 10 jns 801060c1 <sys_link+0x132>
iunlockput(dp);
801060b1: 83 ec 0c sub $0xc,%esp
801060b4: ff 75 f0 pushl -0x10(%ebp)
801060b7: e8 6e bb ff ff call 80101c2a <iunlockput>
801060bc: 83 c4 10 add $0x10,%esp
goto bad;
801060bf: eb 29 jmp 801060ea <sys_link+0x15b>
}
iunlockput(dp);
801060c1: 83 ec 0c sub $0xc,%esp
801060c4: ff 75 f0 pushl -0x10(%ebp)
801060c7: e8 5e bb ff ff call 80101c2a <iunlockput>
801060cc: 83 c4 10 add $0x10,%esp
iput(ip);
801060cf: 83 ec 0c sub $0xc,%esp
801060d2: ff 75 f4 pushl -0xc(%ebp)
801060d5: e8 60 ba ff ff call 80101b3a <iput>
801060da: 83 c4 10 add $0x10,%esp
end_op();
801060dd: e8 f7 d4 ff ff call 801035d9 <end_op>
return 0;
801060e2: b8 00 00 00 00 mov $0x0,%eax
801060e7: eb 48 jmp 80106131 <sys_link+0x1a2>
ip->nlink++;
iupdate(ip);
iunlock(ip);
if((dp = nameiparent(new, name)) == 0)
goto bad;
801060e9: 90 nop
end_op();
return 0;
bad:
ilock(ip);
801060ea: 83 ec 0c sub $0xc,%esp
801060ed: ff 75 f4 pushl -0xc(%ebp)
801060f0: e8 75 b8 ff ff call 8010196a <ilock>
801060f5: 83 c4 10 add $0x10,%esp
ip->nlink--;
801060f8: 8b 45 f4 mov -0xc(%ebp),%eax
801060fb: 0f b7 40 16 movzwl 0x16(%eax),%eax
801060ff: 83 e8 01 sub $0x1,%eax
80106102: 89 c2 mov %eax,%edx
80106104: 8b 45 f4 mov -0xc(%ebp),%eax
80106107: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
8010610b: 83 ec 0c sub $0xc,%esp
8010610e: ff 75 f4 pushl -0xc(%ebp)
80106111: e8 7a b6 ff ff call 80101790 <iupdate>
80106116: 83 c4 10 add $0x10,%esp
iunlockput(ip);
80106119: 83 ec 0c sub $0xc,%esp
8010611c: ff 75 f4 pushl -0xc(%ebp)
8010611f: e8 06 bb ff ff call 80101c2a <iunlockput>
80106124: 83 c4 10 add $0x10,%esp
end_op();
80106127: e8 ad d4 ff ff call 801035d9 <end_op>
return -1;
8010612c: b8 ff ff ff ff mov $0xffffffff,%eax
}
80106131: c9 leave
80106132: c3 ret
80106133 <isdirempty>:
// Is the directory dp empty except for "." and ".." ?
static int
isdirempty(struct inode *dp)
{
80106133: 55 push %ebp
80106134: 89 e5 mov %esp,%ebp
80106136: 83 ec 28 sub $0x28,%esp
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80106139: c7 45 f4 20 00 00 00 movl $0x20,-0xc(%ebp)
80106140: eb 40 jmp 80106182 <isdirempty+0x4f>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
80106142: 8b 45 f4 mov -0xc(%ebp),%eax
80106145: 6a 10 push $0x10
80106147: 50 push %eax
80106148: 8d 45 e4 lea -0x1c(%ebp),%eax
8010614b: 50 push %eax
8010614c: ff 75 08 pushl 0x8(%ebp)
8010614f: e8 84 bd ff ff call 80101ed8 <readi>
80106154: 83 c4 10 add $0x10,%esp
80106157: 83 f8 10 cmp $0x10,%eax
8010615a: 74 0d je 80106169 <isdirempty+0x36>
panic("isdirempty: readi");
8010615c: 83 ec 0c sub $0xc,%esp
8010615f: 68 99 90 10 80 push $0x80109099
80106164: e8 fd a3 ff ff call 80100566 <panic>
if(de.inum != 0)
80106169: 0f b7 45 e4 movzwl -0x1c(%ebp),%eax
8010616d: 66 85 c0 test %ax,%ax
80106170: 74 07 je 80106179 <isdirempty+0x46>
return 0;
80106172: b8 00 00 00 00 mov $0x0,%eax
80106177: eb 1b jmp 80106194 <isdirempty+0x61>
isdirempty(struct inode *dp)
{
int off;
struct dirent de;
for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
80106179: 8b 45 f4 mov -0xc(%ebp),%eax
8010617c: 83 c0 10 add $0x10,%eax
8010617f: 89 45 f4 mov %eax,-0xc(%ebp)
80106182: 8b 45 08 mov 0x8(%ebp),%eax
80106185: 8b 50 18 mov 0x18(%eax),%edx
80106188: 8b 45 f4 mov -0xc(%ebp),%eax
8010618b: 39 c2 cmp %eax,%edx
8010618d: 77 b3 ja 80106142 <isdirempty+0xf>
if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
panic("isdirempty: readi");
if(de.inum != 0)
return 0;
}
return 1;
8010618f: b8 01 00 00 00 mov $0x1,%eax
}
80106194: c9 leave
80106195: c3 ret
80106196 <sys_unlink>:
//PAGEBREAK!
int
sys_unlink(void)
{
80106196: 55 push %ebp
80106197: 89 e5 mov %esp,%ebp
80106199: 83 ec 38 sub $0x38,%esp
struct inode *ip, *dp;
struct dirent de;
char name[DIRSIZ], *path;
uint off;
if(argstr(0, &path) < 0)
8010619c: 83 ec 08 sub $0x8,%esp
8010619f: 8d 45 cc lea -0x34(%ebp),%eax
801061a2: 50 push %eax
801061a3: 6a 00 push $0x0
801061a5: e8 a0 fa ff ff call 80105c4a <argstr>
801061aa: 83 c4 10 add $0x10,%esp
801061ad: 85 c0 test %eax,%eax
801061af: 79 0a jns 801061bb <sys_unlink+0x25>
return -1;
801061b1: b8 ff ff ff ff mov $0xffffffff,%eax
801061b6: e9 bc 01 00 00 jmp 80106377 <sys_unlink+0x1e1>
begin_op();
801061bb: e8 8d d3 ff ff call 8010354d <begin_op>
if((dp = nameiparent(path, name)) == 0){
801061c0: 8b 45 cc mov -0x34(%ebp),%eax
801061c3: 83 ec 08 sub $0x8,%esp
801061c6: 8d 55 d2 lea -0x2e(%ebp),%edx
801061c9: 52 push %edx
801061ca: 50 push %eax
801061cb: e8 74 c3 ff ff call 80102544 <nameiparent>
801061d0: 83 c4 10 add $0x10,%esp
801061d3: 89 45 f4 mov %eax,-0xc(%ebp)
801061d6: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801061da: 75 0f jne 801061eb <sys_unlink+0x55>
end_op();
801061dc: e8 f8 d3 ff ff call 801035d9 <end_op>
return -1;
801061e1: b8 ff ff ff ff mov $0xffffffff,%eax
801061e6: e9 8c 01 00 00 jmp 80106377 <sys_unlink+0x1e1>
}
ilock(dp);
801061eb: 83 ec 0c sub $0xc,%esp
801061ee: ff 75 f4 pushl -0xc(%ebp)
801061f1: e8 74 b7 ff ff call 8010196a <ilock>
801061f6: 83 c4 10 add $0x10,%esp
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
801061f9: 83 ec 08 sub $0x8,%esp
801061fc: 68 ab 90 10 80 push $0x801090ab
80106201: 8d 45 d2 lea -0x2e(%ebp),%eax
80106204: 50 push %eax
80106205: e8 ad bf ff ff call 801021b7 <namecmp>
8010620a: 83 c4 10 add $0x10,%esp
8010620d: 85 c0 test %eax,%eax
8010620f: 0f 84 4a 01 00 00 je 8010635f <sys_unlink+0x1c9>
80106215: 83 ec 08 sub $0x8,%esp
80106218: 68 ad 90 10 80 push $0x801090ad
8010621d: 8d 45 d2 lea -0x2e(%ebp),%eax
80106220: 50 push %eax
80106221: e8 91 bf ff ff call 801021b7 <namecmp>
80106226: 83 c4 10 add $0x10,%esp
80106229: 85 c0 test %eax,%eax
8010622b: 0f 84 2e 01 00 00 je 8010635f <sys_unlink+0x1c9>
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
80106231: 83 ec 04 sub $0x4,%esp
80106234: 8d 45 c8 lea -0x38(%ebp),%eax
80106237: 50 push %eax
80106238: 8d 45 d2 lea -0x2e(%ebp),%eax
8010623b: 50 push %eax
8010623c: ff 75 f4 pushl -0xc(%ebp)
8010623f: e8 8e bf ff ff call 801021d2 <dirlookup>
80106244: 83 c4 10 add $0x10,%esp
80106247: 89 45 f0 mov %eax,-0x10(%ebp)
8010624a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010624e: 0f 84 0a 01 00 00 je 8010635e <sys_unlink+0x1c8>
goto bad;
ilock(ip);
80106254: 83 ec 0c sub $0xc,%esp
80106257: ff 75 f0 pushl -0x10(%ebp)
8010625a: e8 0b b7 ff ff call 8010196a <ilock>
8010625f: 83 c4 10 add $0x10,%esp
if(ip->nlink < 1)
80106262: 8b 45 f0 mov -0x10(%ebp),%eax
80106265: 0f b7 40 16 movzwl 0x16(%eax),%eax
80106269: 66 85 c0 test %ax,%ax
8010626c: 7f 0d jg 8010627b <sys_unlink+0xe5>
panic("unlink: nlink < 1");
8010626e: 83 ec 0c sub $0xc,%esp
80106271: 68 b0 90 10 80 push $0x801090b0
80106276: e8 eb a2 ff ff call 80100566 <panic>
if(ip->type == T_DIR && !isdirempty(ip)){
8010627b: 8b 45 f0 mov -0x10(%ebp),%eax
8010627e: 0f b7 40 10 movzwl 0x10(%eax),%eax
80106282: 66 83 f8 01 cmp $0x1,%ax
80106286: 75 25 jne 801062ad <sys_unlink+0x117>
80106288: 83 ec 0c sub $0xc,%esp
8010628b: ff 75 f0 pushl -0x10(%ebp)
8010628e: e8 a0 fe ff ff call 80106133 <isdirempty>
80106293: 83 c4 10 add $0x10,%esp
80106296: 85 c0 test %eax,%eax
80106298: 75 13 jne 801062ad <sys_unlink+0x117>
iunlockput(ip);
8010629a: 83 ec 0c sub $0xc,%esp
8010629d: ff 75 f0 pushl -0x10(%ebp)
801062a0: e8 85 b9 ff ff call 80101c2a <iunlockput>
801062a5: 83 c4 10 add $0x10,%esp
goto bad;
801062a8: e9 b2 00 00 00 jmp 8010635f <sys_unlink+0x1c9>
}
memset(&de, 0, sizeof(de));
801062ad: 83 ec 04 sub $0x4,%esp
801062b0: 6a 10 push $0x10
801062b2: 6a 00 push $0x0
801062b4: 8d 45 e0 lea -0x20(%ebp),%eax
801062b7: 50 push %eax
801062b8: e8 e3 f5 ff ff call 801058a0 <memset>
801062bd: 83 c4 10 add $0x10,%esp
if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
801062c0: 8b 45 c8 mov -0x38(%ebp),%eax
801062c3: 6a 10 push $0x10
801062c5: 50 push %eax
801062c6: 8d 45 e0 lea -0x20(%ebp),%eax
801062c9: 50 push %eax
801062ca: ff 75 f4 pushl -0xc(%ebp)
801062cd: e8 5d bd ff ff call 8010202f <writei>
801062d2: 83 c4 10 add $0x10,%esp
801062d5: 83 f8 10 cmp $0x10,%eax
801062d8: 74 0d je 801062e7 <sys_unlink+0x151>
panic("unlink: writei");
801062da: 83 ec 0c sub $0xc,%esp
801062dd: 68 c2 90 10 80 push $0x801090c2
801062e2: e8 7f a2 ff ff call 80100566 <panic>
if(ip->type == T_DIR){
801062e7: 8b 45 f0 mov -0x10(%ebp),%eax
801062ea: 0f b7 40 10 movzwl 0x10(%eax),%eax
801062ee: 66 83 f8 01 cmp $0x1,%ax
801062f2: 75 21 jne 80106315 <sys_unlink+0x17f>
dp->nlink--;
801062f4: 8b 45 f4 mov -0xc(%ebp),%eax
801062f7: 0f b7 40 16 movzwl 0x16(%eax),%eax
801062fb: 83 e8 01 sub $0x1,%eax
801062fe: 89 c2 mov %eax,%edx
80106300: 8b 45 f4 mov -0xc(%ebp),%eax
80106303: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
80106307: 83 ec 0c sub $0xc,%esp
8010630a: ff 75 f4 pushl -0xc(%ebp)
8010630d: e8 7e b4 ff ff call 80101790 <iupdate>
80106312: 83 c4 10 add $0x10,%esp
}
iunlockput(dp);
80106315: 83 ec 0c sub $0xc,%esp
80106318: ff 75 f4 pushl -0xc(%ebp)
8010631b: e8 0a b9 ff ff call 80101c2a <iunlockput>
80106320: 83 c4 10 add $0x10,%esp
ip->nlink--;
80106323: 8b 45 f0 mov -0x10(%ebp),%eax
80106326: 0f b7 40 16 movzwl 0x16(%eax),%eax
8010632a: 83 e8 01 sub $0x1,%eax
8010632d: 89 c2 mov %eax,%edx
8010632f: 8b 45 f0 mov -0x10(%ebp),%eax
80106332: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(ip);
80106336: 83 ec 0c sub $0xc,%esp
80106339: ff 75 f0 pushl -0x10(%ebp)
8010633c: e8 4f b4 ff ff call 80101790 <iupdate>
80106341: 83 c4 10 add $0x10,%esp
iunlockput(ip);
80106344: 83 ec 0c sub $0xc,%esp
80106347: ff 75 f0 pushl -0x10(%ebp)
8010634a: e8 db b8 ff ff call 80101c2a <iunlockput>
8010634f: 83 c4 10 add $0x10,%esp
end_op();
80106352: e8 82 d2 ff ff call 801035d9 <end_op>
return 0;
80106357: b8 00 00 00 00 mov $0x0,%eax
8010635c: eb 19 jmp 80106377 <sys_unlink+0x1e1>
// Cannot unlink "." or "..".
if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0)
goto bad;
if((ip = dirlookup(dp, name, &off)) == 0)
goto bad;
8010635e: 90 nop
end_op();
return 0;
bad:
iunlockput(dp);
8010635f: 83 ec 0c sub $0xc,%esp
80106362: ff 75 f4 pushl -0xc(%ebp)
80106365: e8 c0 b8 ff ff call 80101c2a <iunlockput>
8010636a: 83 c4 10 add $0x10,%esp
end_op();
8010636d: e8 67 d2 ff ff call 801035d9 <end_op>
return -1;
80106372: b8 ff ff ff ff mov $0xffffffff,%eax
}
80106377: c9 leave
80106378: c3 ret
80106379 <create>:
static struct inode*
create(char *path, short type, short major, short minor)
{
80106379: 55 push %ebp
8010637a: 89 e5 mov %esp,%ebp
8010637c: 83 ec 38 sub $0x38,%esp
8010637f: 8b 4d 0c mov 0xc(%ebp),%ecx
80106382: 8b 55 10 mov 0x10(%ebp),%edx
80106385: 8b 45 14 mov 0x14(%ebp),%eax
80106388: 66 89 4d d4 mov %cx,-0x2c(%ebp)
8010638c: 66 89 55 d0 mov %dx,-0x30(%ebp)
80106390: 66 89 45 cc mov %ax,-0x34(%ebp)
uint off;
struct inode *ip, *dp;
char name[DIRSIZ];
if((dp = nameiparent(path, name)) == 0)
80106394: 83 ec 08 sub $0x8,%esp
80106397: 8d 45 de lea -0x22(%ebp),%eax
8010639a: 50 push %eax
8010639b: ff 75 08 pushl 0x8(%ebp)
8010639e: e8 a1 c1 ff ff call 80102544 <nameiparent>
801063a3: 83 c4 10 add $0x10,%esp
801063a6: 89 45 f4 mov %eax,-0xc(%ebp)
801063a9: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801063ad: 75 0a jne 801063b9 <create+0x40>
return 0;
801063af: b8 00 00 00 00 mov $0x0,%eax
801063b4: e9 90 01 00 00 jmp 80106549 <create+0x1d0>
ilock(dp);
801063b9: 83 ec 0c sub $0xc,%esp
801063bc: ff 75 f4 pushl -0xc(%ebp)
801063bf: e8 a6 b5 ff ff call 8010196a <ilock>
801063c4: 83 c4 10 add $0x10,%esp
if((ip = dirlookup(dp, name, &off)) != 0){
801063c7: 83 ec 04 sub $0x4,%esp
801063ca: 8d 45 ec lea -0x14(%ebp),%eax
801063cd: 50 push %eax
801063ce: 8d 45 de lea -0x22(%ebp),%eax
801063d1: 50 push %eax
801063d2: ff 75 f4 pushl -0xc(%ebp)
801063d5: e8 f8 bd ff ff call 801021d2 <dirlookup>
801063da: 83 c4 10 add $0x10,%esp
801063dd: 89 45 f0 mov %eax,-0x10(%ebp)
801063e0: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801063e4: 74 50 je 80106436 <create+0xbd>
iunlockput(dp);
801063e6: 83 ec 0c sub $0xc,%esp
801063e9: ff 75 f4 pushl -0xc(%ebp)
801063ec: e8 39 b8 ff ff call 80101c2a <iunlockput>
801063f1: 83 c4 10 add $0x10,%esp
ilock(ip);
801063f4: 83 ec 0c sub $0xc,%esp
801063f7: ff 75 f0 pushl -0x10(%ebp)
801063fa: e8 6b b5 ff ff call 8010196a <ilock>
801063ff: 83 c4 10 add $0x10,%esp
if(type == T_FILE && ip->type == T_FILE)
80106402: 66 83 7d d4 02 cmpw $0x2,-0x2c(%ebp)
80106407: 75 15 jne 8010641e <create+0xa5>
80106409: 8b 45 f0 mov -0x10(%ebp),%eax
8010640c: 0f b7 40 10 movzwl 0x10(%eax),%eax
80106410: 66 83 f8 02 cmp $0x2,%ax
80106414: 75 08 jne 8010641e <create+0xa5>
return ip;
80106416: 8b 45 f0 mov -0x10(%ebp),%eax
80106419: e9 2b 01 00 00 jmp 80106549 <create+0x1d0>
iunlockput(ip);
8010641e: 83 ec 0c sub $0xc,%esp
80106421: ff 75 f0 pushl -0x10(%ebp)
80106424: e8 01 b8 ff ff call 80101c2a <iunlockput>
80106429: 83 c4 10 add $0x10,%esp
return 0;
8010642c: b8 00 00 00 00 mov $0x0,%eax
80106431: e9 13 01 00 00 jmp 80106549 <create+0x1d0>
}
if((ip = ialloc(dp->dev, type)) == 0)
80106436: 0f bf 55 d4 movswl -0x2c(%ebp),%edx
8010643a: 8b 45 f4 mov -0xc(%ebp),%eax
8010643d: 8b 00 mov (%eax),%eax
8010643f: 83 ec 08 sub $0x8,%esp
80106442: 52 push %edx
80106443: 50 push %eax
80106444: e8 70 b2 ff ff call 801016b9 <ialloc>
80106449: 83 c4 10 add $0x10,%esp
8010644c: 89 45 f0 mov %eax,-0x10(%ebp)
8010644f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106453: 75 0d jne 80106462 <create+0xe9>
panic("create: ialloc");
80106455: 83 ec 0c sub $0xc,%esp
80106458: 68 d1 90 10 80 push $0x801090d1
8010645d: e8 04 a1 ff ff call 80100566 <panic>
ilock(ip);
80106462: 83 ec 0c sub $0xc,%esp
80106465: ff 75 f0 pushl -0x10(%ebp)
80106468: e8 fd b4 ff ff call 8010196a <ilock>
8010646d: 83 c4 10 add $0x10,%esp
ip->major = major;
80106470: 8b 45 f0 mov -0x10(%ebp),%eax
80106473: 0f b7 55 d0 movzwl -0x30(%ebp),%edx
80106477: 66 89 50 12 mov %dx,0x12(%eax)
ip->minor = minor;
8010647b: 8b 45 f0 mov -0x10(%ebp),%eax
8010647e: 0f b7 55 cc movzwl -0x34(%ebp),%edx
80106482: 66 89 50 14 mov %dx,0x14(%eax)
ip->nlink = 1;
80106486: 8b 45 f0 mov -0x10(%ebp),%eax
80106489: 66 c7 40 16 01 00 movw $0x1,0x16(%eax)
iupdate(ip);
8010648f: 83 ec 0c sub $0xc,%esp
80106492: ff 75 f0 pushl -0x10(%ebp)
80106495: e8 f6 b2 ff ff call 80101790 <iupdate>
8010649a: 83 c4 10 add $0x10,%esp
if(type == T_DIR){ // Create . and .. entries.
8010649d: 66 83 7d d4 01 cmpw $0x1,-0x2c(%ebp)
801064a2: 75 6a jne 8010650e <create+0x195>
dp->nlink++; // for ".."
801064a4: 8b 45 f4 mov -0xc(%ebp),%eax
801064a7: 0f b7 40 16 movzwl 0x16(%eax),%eax
801064ab: 83 c0 01 add $0x1,%eax
801064ae: 89 c2 mov %eax,%edx
801064b0: 8b 45 f4 mov -0xc(%ebp),%eax
801064b3: 66 89 50 16 mov %dx,0x16(%eax)
iupdate(dp);
801064b7: 83 ec 0c sub $0xc,%esp
801064ba: ff 75 f4 pushl -0xc(%ebp)
801064bd: e8 ce b2 ff ff call 80101790 <iupdate>
801064c2: 83 c4 10 add $0x10,%esp
// No ip->nlink++ for ".": avoid cyclic ref count.
if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
801064c5: 8b 45 f0 mov -0x10(%ebp),%eax
801064c8: 8b 40 04 mov 0x4(%eax),%eax
801064cb: 83 ec 04 sub $0x4,%esp
801064ce: 50 push %eax
801064cf: 68 ab 90 10 80 push $0x801090ab
801064d4: ff 75 f0 pushl -0x10(%ebp)
801064d7: e8 b0 bd ff ff call 8010228c <dirlink>
801064dc: 83 c4 10 add $0x10,%esp
801064df: 85 c0 test %eax,%eax
801064e1: 78 1e js 80106501 <create+0x188>
801064e3: 8b 45 f4 mov -0xc(%ebp),%eax
801064e6: 8b 40 04 mov 0x4(%eax),%eax
801064e9: 83 ec 04 sub $0x4,%esp
801064ec: 50 push %eax
801064ed: 68 ad 90 10 80 push $0x801090ad
801064f2: ff 75 f0 pushl -0x10(%ebp)
801064f5: e8 92 bd ff ff call 8010228c <dirlink>
801064fa: 83 c4 10 add $0x10,%esp
801064fd: 85 c0 test %eax,%eax
801064ff: 79 0d jns 8010650e <create+0x195>
panic("create dots");
80106501: 83 ec 0c sub $0xc,%esp
80106504: 68 e0 90 10 80 push $0x801090e0
80106509: e8 58 a0 ff ff call 80100566 <panic>
}
if(dirlink(dp, name, ip->inum) < 0)
8010650e: 8b 45 f0 mov -0x10(%ebp),%eax
80106511: 8b 40 04 mov 0x4(%eax),%eax
80106514: 83 ec 04 sub $0x4,%esp
80106517: 50 push %eax
80106518: 8d 45 de lea -0x22(%ebp),%eax
8010651b: 50 push %eax
8010651c: ff 75 f4 pushl -0xc(%ebp)
8010651f: e8 68 bd ff ff call 8010228c <dirlink>
80106524: 83 c4 10 add $0x10,%esp
80106527: 85 c0 test %eax,%eax
80106529: 79 0d jns 80106538 <create+0x1bf>
panic("create: dirlink");
8010652b: 83 ec 0c sub $0xc,%esp
8010652e: 68 ec 90 10 80 push $0x801090ec
80106533: e8 2e a0 ff ff call 80100566 <panic>
iunlockput(dp);
80106538: 83 ec 0c sub $0xc,%esp
8010653b: ff 75 f4 pushl -0xc(%ebp)
8010653e: e8 e7 b6 ff ff call 80101c2a <iunlockput>
80106543: 83 c4 10 add $0x10,%esp
return ip;
80106546: 8b 45 f0 mov -0x10(%ebp),%eax
}
80106549: c9 leave
8010654a: c3 ret
8010654b <sys_open>:
int
sys_open(void)
{
8010654b: 55 push %ebp
8010654c: 89 e5 mov %esp,%ebp
8010654e: 83 ec 28 sub $0x28,%esp
char *path;
int fd, omode;
struct file *f;
struct inode *ip;
if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
80106551: 83 ec 08 sub $0x8,%esp
80106554: 8d 45 e8 lea -0x18(%ebp),%eax
80106557: 50 push %eax
80106558: 6a 00 push $0x0
8010655a: e8 eb f6 ff ff call 80105c4a <argstr>
8010655f: 83 c4 10 add $0x10,%esp
80106562: 85 c0 test %eax,%eax
80106564: 78 15 js 8010657b <sys_open+0x30>
80106566: 83 ec 08 sub $0x8,%esp
80106569: 8d 45 e4 lea -0x1c(%ebp),%eax
8010656c: 50 push %eax
8010656d: 6a 01 push $0x1
8010656f: e8 51 f6 ff ff call 80105bc5 <argint>
80106574: 83 c4 10 add $0x10,%esp
80106577: 85 c0 test %eax,%eax
80106579: 79 0a jns 80106585 <sys_open+0x3a>
return -1;
8010657b: b8 ff ff ff ff mov $0xffffffff,%eax
80106580: e9 61 01 00 00 jmp 801066e6 <sys_open+0x19b>
begin_op();
80106585: e8 c3 cf ff ff call 8010354d <begin_op>
if(omode & O_CREATE){
8010658a: 8b 45 e4 mov -0x1c(%ebp),%eax
8010658d: 25 00 02 00 00 and $0x200,%eax
80106592: 85 c0 test %eax,%eax
80106594: 74 2a je 801065c0 <sys_open+0x75>
ip = create(path, T_FILE, 0, 0);
80106596: 8b 45 e8 mov -0x18(%ebp),%eax
80106599: 6a 00 push $0x0
8010659b: 6a 00 push $0x0
8010659d: 6a 02 push $0x2
8010659f: 50 push %eax
801065a0: e8 d4 fd ff ff call 80106379 <create>
801065a5: 83 c4 10 add $0x10,%esp
801065a8: 89 45 f4 mov %eax,-0xc(%ebp)
if(ip == 0){
801065ab: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801065af: 75 75 jne 80106626 <sys_open+0xdb>
end_op();
801065b1: e8 23 d0 ff ff call 801035d9 <end_op>
return -1;
801065b6: b8 ff ff ff ff mov $0xffffffff,%eax
801065bb: e9 26 01 00 00 jmp 801066e6 <sys_open+0x19b>
}
} else {
if((ip = namei(path)) == 0){
801065c0: 8b 45 e8 mov -0x18(%ebp),%eax
801065c3: 83 ec 0c sub $0xc,%esp
801065c6: 50 push %eax
801065c7: e8 5c bf ff ff call 80102528 <namei>
801065cc: 83 c4 10 add $0x10,%esp
801065cf: 89 45 f4 mov %eax,-0xc(%ebp)
801065d2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
801065d6: 75 0f jne 801065e7 <sys_open+0x9c>
end_op();
801065d8: e8 fc cf ff ff call 801035d9 <end_op>
return -1;
801065dd: b8 ff ff ff ff mov $0xffffffff,%eax
801065e2: e9 ff 00 00 00 jmp 801066e6 <sys_open+0x19b>
}
ilock(ip);
801065e7: 83 ec 0c sub $0xc,%esp
801065ea: ff 75 f4 pushl -0xc(%ebp)
801065ed: e8 78 b3 ff ff call 8010196a <ilock>
801065f2: 83 c4 10 add $0x10,%esp
if(ip->type == T_DIR && omode != O_RDONLY){
801065f5: 8b 45 f4 mov -0xc(%ebp),%eax
801065f8: 0f b7 40 10 movzwl 0x10(%eax),%eax
801065fc: 66 83 f8 01 cmp $0x1,%ax
80106600: 75 24 jne 80106626 <sys_open+0xdb>
80106602: 8b 45 e4 mov -0x1c(%ebp),%eax
80106605: 85 c0 test %eax,%eax
80106607: 74 1d je 80106626 <sys_open+0xdb>
iunlockput(ip);
80106609: 83 ec 0c sub $0xc,%esp
8010660c: ff 75 f4 pushl -0xc(%ebp)
8010660f: e8 16 b6 ff ff call 80101c2a <iunlockput>
80106614: 83 c4 10 add $0x10,%esp
end_op();
80106617: e8 bd cf ff ff call 801035d9 <end_op>
return -1;
8010661c: b8 ff ff ff ff mov $0xffffffff,%eax
80106621: e9 c0 00 00 00 jmp 801066e6 <sys_open+0x19b>
}
}
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
80106626: e8 68 a9 ff ff call 80100f93 <filealloc>
8010662b: 89 45 f0 mov %eax,-0x10(%ebp)
8010662e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106632: 74 17 je 8010664b <sys_open+0x100>
80106634: 83 ec 0c sub $0xc,%esp
80106637: ff 75 f0 pushl -0x10(%ebp)
8010663a: e8 37 f7 ff ff call 80105d76 <fdalloc>
8010663f: 83 c4 10 add $0x10,%esp
80106642: 89 45 ec mov %eax,-0x14(%ebp)
80106645: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80106649: 79 2e jns 80106679 <sys_open+0x12e>
if(f)
8010664b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010664f: 74 0e je 8010665f <sys_open+0x114>
fileclose(f);
80106651: 83 ec 0c sub $0xc,%esp
80106654: ff 75 f0 pushl -0x10(%ebp)
80106657: e8 f5 a9 ff ff call 80101051 <fileclose>
8010665c: 83 c4 10 add $0x10,%esp
iunlockput(ip);
8010665f: 83 ec 0c sub $0xc,%esp
80106662: ff 75 f4 pushl -0xc(%ebp)
80106665: e8 c0 b5 ff ff call 80101c2a <iunlockput>
8010666a: 83 c4 10 add $0x10,%esp
end_op();
8010666d: e8 67 cf ff ff call 801035d9 <end_op>
return -1;
80106672: b8 ff ff ff ff mov $0xffffffff,%eax
80106677: eb 6d jmp 801066e6 <sys_open+0x19b>
}
iunlock(ip);
80106679: 83 ec 0c sub $0xc,%esp
8010667c: ff 75 f4 pushl -0xc(%ebp)
8010667f: e8 44 b4 ff ff call 80101ac8 <iunlock>
80106684: 83 c4 10 add $0x10,%esp
end_op();
80106687: e8 4d cf ff ff call 801035d9 <end_op>
f->type = FD_INODE;
8010668c: 8b 45 f0 mov -0x10(%ebp),%eax
8010668f: c7 00 02 00 00 00 movl $0x2,(%eax)
f->ip = ip;
80106695: 8b 45 f0 mov -0x10(%ebp),%eax
80106698: 8b 55 f4 mov -0xc(%ebp),%edx
8010669b: 89 50 10 mov %edx,0x10(%eax)
f->off = 0;
8010669e: 8b 45 f0 mov -0x10(%ebp),%eax
801066a1: c7 40 14 00 00 00 00 movl $0x0,0x14(%eax)
f->readable = !(omode & O_WRONLY);
801066a8: 8b 45 e4 mov -0x1c(%ebp),%eax
801066ab: 83 e0 01 and $0x1,%eax
801066ae: 85 c0 test %eax,%eax
801066b0: 0f 94 c0 sete %al
801066b3: 89 c2 mov %eax,%edx
801066b5: 8b 45 f0 mov -0x10(%ebp),%eax
801066b8: 88 50 08 mov %dl,0x8(%eax)
f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
801066bb: 8b 45 e4 mov -0x1c(%ebp),%eax
801066be: 83 e0 01 and $0x1,%eax
801066c1: 85 c0 test %eax,%eax
801066c3: 75 0a jne 801066cf <sys_open+0x184>
801066c5: 8b 45 e4 mov -0x1c(%ebp),%eax
801066c8: 83 e0 02 and $0x2,%eax
801066cb: 85 c0 test %eax,%eax
801066cd: 74 07 je 801066d6 <sys_open+0x18b>
801066cf: b8 01 00 00 00 mov $0x1,%eax
801066d4: eb 05 jmp 801066db <sys_open+0x190>
801066d6: b8 00 00 00 00 mov $0x0,%eax
801066db: 89 c2 mov %eax,%edx
801066dd: 8b 45 f0 mov -0x10(%ebp),%eax
801066e0: 88 50 09 mov %dl,0x9(%eax)
return fd;
801066e3: 8b 45 ec mov -0x14(%ebp),%eax
}
801066e6: c9 leave
801066e7: c3 ret
801066e8 <sys_mkdir>:
int
sys_mkdir(void)
{
801066e8: 55 push %ebp
801066e9: 89 e5 mov %esp,%ebp
801066eb: 83 ec 18 sub $0x18,%esp
char *path;
struct inode *ip;
begin_op();
801066ee: e8 5a ce ff ff call 8010354d <begin_op>
if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0){
801066f3: 83 ec 08 sub $0x8,%esp
801066f6: 8d 45 f0 lea -0x10(%ebp),%eax
801066f9: 50 push %eax
801066fa: 6a 00 push $0x0
801066fc: e8 49 f5 ff ff call 80105c4a <argstr>
80106701: 83 c4 10 add $0x10,%esp
80106704: 85 c0 test %eax,%eax
80106706: 78 1b js 80106723 <sys_mkdir+0x3b>
80106708: 8b 45 f0 mov -0x10(%ebp),%eax
8010670b: 6a 00 push $0x0
8010670d: 6a 00 push $0x0
8010670f: 6a 01 push $0x1
80106711: 50 push %eax
80106712: e8 62 fc ff ff call 80106379 <create>
80106717: 83 c4 10 add $0x10,%esp
8010671a: 89 45 f4 mov %eax,-0xc(%ebp)
8010671d: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106721: 75 0c jne 8010672f <sys_mkdir+0x47>
end_op();
80106723: e8 b1 ce ff ff call 801035d9 <end_op>
return -1;
80106728: b8 ff ff ff ff mov $0xffffffff,%eax
8010672d: eb 18 jmp 80106747 <sys_mkdir+0x5f>
}
iunlockput(ip);
8010672f: 83 ec 0c sub $0xc,%esp
80106732: ff 75 f4 pushl -0xc(%ebp)
80106735: e8 f0 b4 ff ff call 80101c2a <iunlockput>
8010673a: 83 c4 10 add $0x10,%esp
end_op();
8010673d: e8 97 ce ff ff call 801035d9 <end_op>
return 0;
80106742: b8 00 00 00 00 mov $0x0,%eax
}
80106747: c9 leave
80106748: c3 ret
80106749 <sys_mknod>:
int
sys_mknod(void)
{
80106749: 55 push %ebp
8010674a: 89 e5 mov %esp,%ebp
8010674c: 83 ec 28 sub $0x28,%esp
struct inode *ip;
char *path;
int len;
int major, minor;
begin_op();
8010674f: e8 f9 cd ff ff call 8010354d <begin_op>
if((len=argstr(0, &path)) < 0 ||
80106754: 83 ec 08 sub $0x8,%esp
80106757: 8d 45 ec lea -0x14(%ebp),%eax
8010675a: 50 push %eax
8010675b: 6a 00 push $0x0
8010675d: e8 e8 f4 ff ff call 80105c4a <argstr>
80106762: 83 c4 10 add $0x10,%esp
80106765: 89 45 f4 mov %eax,-0xc(%ebp)
80106768: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010676c: 78 4f js 801067bd <sys_mknod+0x74>
argint(1, &major) < 0 ||
8010676e: 83 ec 08 sub $0x8,%esp
80106771: 8d 45 e8 lea -0x18(%ebp),%eax
80106774: 50 push %eax
80106775: 6a 01 push $0x1
80106777: e8 49 f4 ff ff call 80105bc5 <argint>
8010677c: 83 c4 10 add $0x10,%esp
char *path;
int len;
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
8010677f: 85 c0 test %eax,%eax
80106781: 78 3a js 801067bd <sys_mknod+0x74>
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
80106783: 83 ec 08 sub $0x8,%esp
80106786: 8d 45 e4 lea -0x1c(%ebp),%eax
80106789: 50 push %eax
8010678a: 6a 02 push $0x2
8010678c: e8 34 f4 ff ff call 80105bc5 <argint>
80106791: 83 c4 10 add $0x10,%esp
int len;
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
80106794: 85 c0 test %eax,%eax
80106796: 78 25 js 801067bd <sys_mknod+0x74>
argint(2, &minor) < 0 ||
(ip = create(path, T_DEV, major, minor)) == 0){
80106798: 8b 45 e4 mov -0x1c(%ebp),%eax
8010679b: 0f bf c8 movswl %ax,%ecx
8010679e: 8b 45 e8 mov -0x18(%ebp),%eax
801067a1: 0f bf d0 movswl %ax,%edx
801067a4: 8b 45 ec mov -0x14(%ebp),%eax
int major, minor;
begin_op();
if((len=argstr(0, &path)) < 0 ||
argint(1, &major) < 0 ||
argint(2, &minor) < 0 ||
801067a7: 51 push %ecx
801067a8: 52 push %edx
801067a9: 6a 03 push $0x3
801067ab: 50 push %eax
801067ac: e8 c8 fb ff ff call 80106379 <create>
801067b1: 83 c4 10 add $0x10,%esp
801067b4: 89 45 f0 mov %eax,-0x10(%ebp)
801067b7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801067bb: 75 0c jne 801067c9 <sys_mknod+0x80>
(ip = create(path, T_DEV, major, minor)) == 0){
end_op();
801067bd: e8 17 ce ff ff call 801035d9 <end_op>
return -1;
801067c2: b8 ff ff ff ff mov $0xffffffff,%eax
801067c7: eb 18 jmp 801067e1 <sys_mknod+0x98>
}
iunlockput(ip);
801067c9: 83 ec 0c sub $0xc,%esp
801067cc: ff 75 f0 pushl -0x10(%ebp)
801067cf: e8 56 b4 ff ff call 80101c2a <iunlockput>
801067d4: 83 c4 10 add $0x10,%esp
end_op();
801067d7: e8 fd cd ff ff call 801035d9 <end_op>
return 0;
801067dc: b8 00 00 00 00 mov $0x0,%eax
}
801067e1: c9 leave
801067e2: c3 ret
801067e3 <sys_chdir>:
int
sys_chdir(void)
{
801067e3: 55 push %ebp
801067e4: 89 e5 mov %esp,%ebp
801067e6: 83 ec 18 sub $0x18,%esp
char *path;
struct inode *ip;
begin_op();
801067e9: e8 5f cd ff ff call 8010354d <begin_op>
if(argstr(0, &path) < 0 || (ip = namei(path)) == 0){
801067ee: 83 ec 08 sub $0x8,%esp
801067f1: 8d 45 f0 lea -0x10(%ebp),%eax
801067f4: 50 push %eax
801067f5: 6a 00 push $0x0
801067f7: e8 4e f4 ff ff call 80105c4a <argstr>
801067fc: 83 c4 10 add $0x10,%esp
801067ff: 85 c0 test %eax,%eax
80106801: 78 18 js 8010681b <sys_chdir+0x38>
80106803: 8b 45 f0 mov -0x10(%ebp),%eax
80106806: 83 ec 0c sub $0xc,%esp
80106809: 50 push %eax
8010680a: e8 19 bd ff ff call 80102528 <namei>
8010680f: 83 c4 10 add $0x10,%esp
80106812: 89 45 f4 mov %eax,-0xc(%ebp)
80106815: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106819: 75 0c jne 80106827 <sys_chdir+0x44>
end_op();
8010681b: e8 b9 cd ff ff call 801035d9 <end_op>
return -1;
80106820: b8 ff ff ff ff mov $0xffffffff,%eax
80106825: eb 6e jmp 80106895 <sys_chdir+0xb2>
}
ilock(ip);
80106827: 83 ec 0c sub $0xc,%esp
8010682a: ff 75 f4 pushl -0xc(%ebp)
8010682d: e8 38 b1 ff ff call 8010196a <ilock>
80106832: 83 c4 10 add $0x10,%esp
if(ip->type != T_DIR){
80106835: 8b 45 f4 mov -0xc(%ebp),%eax
80106838: 0f b7 40 10 movzwl 0x10(%eax),%eax
8010683c: 66 83 f8 01 cmp $0x1,%ax
80106840: 74 1a je 8010685c <sys_chdir+0x79>
iunlockput(ip);
80106842: 83 ec 0c sub $0xc,%esp
80106845: ff 75 f4 pushl -0xc(%ebp)
80106848: e8 dd b3 ff ff call 80101c2a <iunlockput>
8010684d: 83 c4 10 add $0x10,%esp
end_op();
80106850: e8 84 cd ff ff call 801035d9 <end_op>
return -1;
80106855: b8 ff ff ff ff mov $0xffffffff,%eax
8010685a: eb 39 jmp 80106895 <sys_chdir+0xb2>
}
iunlock(ip);
8010685c: 83 ec 0c sub $0xc,%esp
8010685f: ff 75 f4 pushl -0xc(%ebp)
80106862: e8 61 b2 ff ff call 80101ac8 <iunlock>
80106867: 83 c4 10 add $0x10,%esp
iput(proc->cwd);
8010686a: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106870: 8b 40 68 mov 0x68(%eax),%eax
80106873: 83 ec 0c sub $0xc,%esp
80106876: 50 push %eax
80106877: e8 be b2 ff ff call 80101b3a <iput>
8010687c: 83 c4 10 add $0x10,%esp
end_op();
8010687f: e8 55 cd ff ff call 801035d9 <end_op>
proc->cwd = ip;
80106884: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010688a: 8b 55 f4 mov -0xc(%ebp),%edx
8010688d: 89 50 68 mov %edx,0x68(%eax)
return 0;
80106890: b8 00 00 00 00 mov $0x0,%eax
}
80106895: c9 leave
80106896: c3 ret
80106897 <sys_exec>:
int
sys_exec(void)
{
80106897: 55 push %ebp
80106898: 89 e5 mov %esp,%ebp
8010689a: 81 ec 98 00 00 00 sub $0x98,%esp
char *path, *argv[MAXARG];
int i;
uint uargv, uarg;
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
801068a0: 83 ec 08 sub $0x8,%esp
801068a3: 8d 45 f0 lea -0x10(%ebp),%eax
801068a6: 50 push %eax
801068a7: 6a 00 push $0x0
801068a9: e8 9c f3 ff ff call 80105c4a <argstr>
801068ae: 83 c4 10 add $0x10,%esp
801068b1: 85 c0 test %eax,%eax
801068b3: 78 18 js 801068cd <sys_exec+0x36>
801068b5: 83 ec 08 sub $0x8,%esp
801068b8: 8d 85 6c ff ff ff lea -0x94(%ebp),%eax
801068be: 50 push %eax
801068bf: 6a 01 push $0x1
801068c1: e8 ff f2 ff ff call 80105bc5 <argint>
801068c6: 83 c4 10 add $0x10,%esp
801068c9: 85 c0 test %eax,%eax
801068cb: 79 0a jns 801068d7 <sys_exec+0x40>
return -1;
801068cd: b8 ff ff ff ff mov $0xffffffff,%eax
801068d2: e9 c6 00 00 00 jmp 8010699d <sys_exec+0x106>
}
memset(argv, 0, sizeof(argv));
801068d7: 83 ec 04 sub $0x4,%esp
801068da: 68 80 00 00 00 push $0x80
801068df: 6a 00 push $0x0
801068e1: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
801068e7: 50 push %eax
801068e8: e8 b3 ef ff ff call 801058a0 <memset>
801068ed: 83 c4 10 add $0x10,%esp
for(i=0;; i++){
801068f0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
if(i >= NELEM(argv))
801068f7: 8b 45 f4 mov -0xc(%ebp),%eax
801068fa: 83 f8 1f cmp $0x1f,%eax
801068fd: 76 0a jbe 80106909 <sys_exec+0x72>
return -1;
801068ff: b8 ff ff ff ff mov $0xffffffff,%eax
80106904: e9 94 00 00 00 jmp 8010699d <sys_exec+0x106>
if(fetchint(uargv+4*i, (int*)&uarg) < 0)
80106909: 8b 45 f4 mov -0xc(%ebp),%eax
8010690c: c1 e0 02 shl $0x2,%eax
8010690f: 89 c2 mov %eax,%edx
80106911: 8b 85 6c ff ff ff mov -0x94(%ebp),%eax
80106917: 01 c2 add %eax,%edx
80106919: 83 ec 08 sub $0x8,%esp
8010691c: 8d 85 68 ff ff ff lea -0x98(%ebp),%eax
80106922: 50 push %eax
80106923: 52 push %edx
80106924: e8 00 f2 ff ff call 80105b29 <fetchint>
80106929: 83 c4 10 add $0x10,%esp
8010692c: 85 c0 test %eax,%eax
8010692e: 79 07 jns 80106937 <sys_exec+0xa0>
return -1;
80106930: b8 ff ff ff ff mov $0xffffffff,%eax
80106935: eb 66 jmp 8010699d <sys_exec+0x106>
if(uarg == 0){
80106937: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
8010693d: 85 c0 test %eax,%eax
8010693f: 75 27 jne 80106968 <sys_exec+0xd1>
argv[i] = 0;
80106941: 8b 45 f4 mov -0xc(%ebp),%eax
80106944: c7 84 85 70 ff ff ff movl $0x0,-0x90(%ebp,%eax,4)
8010694b: 00 00 00 00
break;
8010694f: 90 nop
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
return exec(path, argv);
80106950: 8b 45 f0 mov -0x10(%ebp),%eax
80106953: 83 ec 08 sub $0x8,%esp
80106956: 8d 95 70 ff ff ff lea -0x90(%ebp),%edx
8010695c: 52 push %edx
8010695d: 50 push %eax
8010695e: e8 0e a2 ff ff call 80100b71 <exec>
80106963: 83 c4 10 add $0x10,%esp
80106966: eb 35 jmp 8010699d <sys_exec+0x106>
return -1;
if(uarg == 0){
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
80106968: 8d 85 70 ff ff ff lea -0x90(%ebp),%eax
8010696e: 8b 55 f4 mov -0xc(%ebp),%edx
80106971: c1 e2 02 shl $0x2,%edx
80106974: 01 c2 add %eax,%edx
80106976: 8b 85 68 ff ff ff mov -0x98(%ebp),%eax
8010697c: 83 ec 08 sub $0x8,%esp
8010697f: 52 push %edx
80106980: 50 push %eax
80106981: e8 dd f1 ff ff call 80105b63 <fetchstr>
80106986: 83 c4 10 add $0x10,%esp
80106989: 85 c0 test %eax,%eax
8010698b: 79 07 jns 80106994 <sys_exec+0xfd>
return -1;
8010698d: b8 ff ff ff ff mov $0xffffffff,%eax
80106992: eb 09 jmp 8010699d <sys_exec+0x106>
if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0){
return -1;
}
memset(argv, 0, sizeof(argv));
for(i=0;; i++){
80106994: 83 45 f4 01 addl $0x1,-0xc(%ebp)
argv[i] = 0;
break;
}
if(fetchstr(uarg, &argv[i]) < 0)
return -1;
}
80106998: e9 5a ff ff ff jmp 801068f7 <sys_exec+0x60>
return exec(path, argv);
}
8010699d: c9 leave
8010699e: c3 ret
8010699f <sys_pipe>:
int
sys_pipe(void)
{
8010699f: 55 push %ebp
801069a0: 89 e5 mov %esp,%ebp
801069a2: 83 ec 28 sub $0x28,%esp
int *fd;
struct file *rf, *wf;
int fd0, fd1;
if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
801069a5: 83 ec 04 sub $0x4,%esp
801069a8: 6a 08 push $0x8
801069aa: 8d 45 ec lea -0x14(%ebp),%eax
801069ad: 50 push %eax
801069ae: 6a 00 push $0x0
801069b0: e8 38 f2 ff ff call 80105bed <argptr>
801069b5: 83 c4 10 add $0x10,%esp
801069b8: 85 c0 test %eax,%eax
801069ba: 79 0a jns 801069c6 <sys_pipe+0x27>
return -1;
801069bc: b8 ff ff ff ff mov $0xffffffff,%eax
801069c1: e9 af 00 00 00 jmp 80106a75 <sys_pipe+0xd6>
if(pipealloc(&rf, &wf) < 0)
801069c6: 83 ec 08 sub $0x8,%esp
801069c9: 8d 45 e4 lea -0x1c(%ebp),%eax
801069cc: 50 push %eax
801069cd: 8d 45 e8 lea -0x18(%ebp),%eax
801069d0: 50 push %eax
801069d1: e8 6b d6 ff ff call 80104041 <pipealloc>
801069d6: 83 c4 10 add $0x10,%esp
801069d9: 85 c0 test %eax,%eax
801069db: 79 0a jns 801069e7 <sys_pipe+0x48>
return -1;
801069dd: b8 ff ff ff ff mov $0xffffffff,%eax
801069e2: e9 8e 00 00 00 jmp 80106a75 <sys_pipe+0xd6>
fd0 = -1;
801069e7: c7 45 f4 ff ff ff ff movl $0xffffffff,-0xc(%ebp)
if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
801069ee: 8b 45 e8 mov -0x18(%ebp),%eax
801069f1: 83 ec 0c sub $0xc,%esp
801069f4: 50 push %eax
801069f5: e8 7c f3 ff ff call 80105d76 <fdalloc>
801069fa: 83 c4 10 add $0x10,%esp
801069fd: 89 45 f4 mov %eax,-0xc(%ebp)
80106a00: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106a04: 78 18 js 80106a1e <sys_pipe+0x7f>
80106a06: 8b 45 e4 mov -0x1c(%ebp),%eax
80106a09: 83 ec 0c sub $0xc,%esp
80106a0c: 50 push %eax
80106a0d: e8 64 f3 ff ff call 80105d76 <fdalloc>
80106a12: 83 c4 10 add $0x10,%esp
80106a15: 89 45 f0 mov %eax,-0x10(%ebp)
80106a18: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80106a1c: 79 3f jns 80106a5d <sys_pipe+0xbe>
if(fd0 >= 0)
80106a1e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80106a22: 78 14 js 80106a38 <sys_pipe+0x99>
proc->ofile[fd0] = 0;
80106a24: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106a2a: 8b 55 f4 mov -0xc(%ebp),%edx
80106a2d: 83 c2 08 add $0x8,%edx
80106a30: c7 44 90 08 00 00 00 movl $0x0,0x8(%eax,%edx,4)
80106a37: 00
fileclose(rf);
80106a38: 8b 45 e8 mov -0x18(%ebp),%eax
80106a3b: 83 ec 0c sub $0xc,%esp
80106a3e: 50 push %eax
80106a3f: e8 0d a6 ff ff call 80101051 <fileclose>
80106a44: 83 c4 10 add $0x10,%esp
fileclose(wf);
80106a47: 8b 45 e4 mov -0x1c(%ebp),%eax
80106a4a: 83 ec 0c sub $0xc,%esp
80106a4d: 50 push %eax
80106a4e: e8 fe a5 ff ff call 80101051 <fileclose>
80106a53: 83 c4 10 add $0x10,%esp
return -1;
80106a56: b8 ff ff ff ff mov $0xffffffff,%eax
80106a5b: eb 18 jmp 80106a75 <sys_pipe+0xd6>
}
fd[0] = fd0;
80106a5d: 8b 45 ec mov -0x14(%ebp),%eax
80106a60: 8b 55 f4 mov -0xc(%ebp),%edx
80106a63: 89 10 mov %edx,(%eax)
fd[1] = fd1;
80106a65: 8b 45 ec mov -0x14(%ebp),%eax
80106a68: 8d 50 04 lea 0x4(%eax),%edx
80106a6b: 8b 45 f0 mov -0x10(%ebp),%eax
80106a6e: 89 02 mov %eax,(%edx)
return 0;
80106a70: b8 00 00 00 00 mov $0x0,%eax
}
80106a75: c9 leave
80106a76: c3 ret
80106a77 <sys_fork>:
#include "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
80106a77: 55 push %ebp
80106a78: 89 e5 mov %esp,%ebp
80106a7a: 83 ec 08 sub $0x8,%esp
return fork();
80106a7d: e8 e2 dd ff ff call 80104864 <fork>
}
80106a82: c9 leave
80106a83: c3 ret
80106a84 <sys_exit>:
int
sys_exit(void)
{
80106a84: 55 push %ebp
80106a85: 89 e5 mov %esp,%ebp
80106a87: 83 ec 08 sub $0x8,%esp
exit();
80106a8a: e8 66 df ff ff call 801049f5 <exit>
return 0; // not reached
80106a8f: b8 00 00 00 00 mov $0x0,%eax
}
80106a94: c9 leave
80106a95: c3 ret
80106a96 <sys_wait>:
int
sys_wait(void)
{
80106a96: 55 push %ebp
80106a97: 89 e5 mov %esp,%ebp
80106a99: 83 ec 08 sub $0x8,%esp
return wait();
80106a9c: e8 8f e0 ff ff call 80104b30 <wait>
}
80106aa1: c9 leave
80106aa2: c3 ret
80106aa3 <sys_kill>:
int
sys_kill(void)
{
80106aa3: 55 push %ebp
80106aa4: 89 e5 mov %esp,%ebp
80106aa6: 83 ec 18 sub $0x18,%esp
int pid;
if(argint(0, &pid) < 0)
80106aa9: 83 ec 08 sub $0x8,%esp
80106aac: 8d 45 f4 lea -0xc(%ebp),%eax
80106aaf: 50 push %eax
80106ab0: 6a 00 push $0x0
80106ab2: e8 0e f1 ff ff call 80105bc5 <argint>
80106ab7: 83 c4 10 add $0x10,%esp
80106aba: 85 c0 test %eax,%eax
80106abc: 79 07 jns 80106ac5 <sys_kill+0x22>
return -1;
80106abe: b8 ff ff ff ff mov $0xffffffff,%eax
80106ac3: eb 0f jmp 80106ad4 <sys_kill+0x31>
return kill(pid);
80106ac5: 8b 45 f4 mov -0xc(%ebp),%eax
80106ac8: 83 ec 0c sub $0xc,%esp
80106acb: 50 push %eax
80106acc: e8 8f e9 ff ff call 80105460 <kill>
80106ad1: 83 c4 10 add $0x10,%esp
}
80106ad4: c9 leave
80106ad5: c3 ret
80106ad6 <sys_getpid>:
int
sys_getpid(void)
{
80106ad6: 55 push %ebp
80106ad7: 89 e5 mov %esp,%ebp
return proc->pid;
80106ad9: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106adf: 8b 40 10 mov 0x10(%eax),%eax
}
80106ae2: 5d pop %ebp
80106ae3: c3 ret
80106ae4 <sys_sbrk>:
int
sys_sbrk(void)
{
80106ae4: 55 push %ebp
80106ae5: 89 e5 mov %esp,%ebp
80106ae7: 83 ec 18 sub $0x18,%esp
int addr;
int n;
if(argint(0, &n) < 0)
80106aea: 83 ec 08 sub $0x8,%esp
80106aed: 8d 45 f0 lea -0x10(%ebp),%eax
80106af0: 50 push %eax
80106af1: 6a 00 push $0x0
80106af3: e8 cd f0 ff ff call 80105bc5 <argint>
80106af8: 83 c4 10 add $0x10,%esp
80106afb: 85 c0 test %eax,%eax
80106afd: 79 07 jns 80106b06 <sys_sbrk+0x22>
return -1;
80106aff: b8 ff ff ff ff mov $0xffffffff,%eax
80106b04: eb 28 jmp 80106b2e <sys_sbrk+0x4a>
addr = proc->sz;
80106b06: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106b0c: 8b 00 mov (%eax),%eax
80106b0e: 89 45 f4 mov %eax,-0xc(%ebp)
if(growproc(n) < 0)
80106b11: 8b 45 f0 mov -0x10(%ebp),%eax
80106b14: 83 ec 0c sub $0xc,%esp
80106b17: 50 push %eax
80106b18: e8 a4 dc ff ff call 801047c1 <growproc>
80106b1d: 83 c4 10 add $0x10,%esp
80106b20: 85 c0 test %eax,%eax
80106b22: 79 07 jns 80106b2b <sys_sbrk+0x47>
return -1;
80106b24: b8 ff ff ff ff mov $0xffffffff,%eax
80106b29: eb 03 jmp 80106b2e <sys_sbrk+0x4a>
return addr;
80106b2b: 8b 45 f4 mov -0xc(%ebp),%eax
}
80106b2e: c9 leave
80106b2f: c3 ret
80106b30 <sys_sleep>:
int
sys_sleep(void)
{
80106b30: 55 push %ebp
80106b31: 89 e5 mov %esp,%ebp
80106b33: 83 ec 18 sub $0x18,%esp
int n;
uint ticks0;
if(argint(0, &n) < 0)
80106b36: 83 ec 08 sub $0x8,%esp
80106b39: 8d 45 f0 lea -0x10(%ebp),%eax
80106b3c: 50 push %eax
80106b3d: 6a 00 push $0x0
80106b3f: e8 81 f0 ff ff call 80105bc5 <argint>
80106b44: 83 c4 10 add $0x10,%esp
80106b47: 85 c0 test %eax,%eax
80106b49: 79 07 jns 80106b52 <sys_sleep+0x22>
return -1;
80106b4b: b8 ff ff ff ff mov $0xffffffff,%eax
80106b50: eb 77 jmp 80106bc9 <sys_sleep+0x99>
acquire(&tickslock);
80106b52: 83 ec 0c sub $0xc,%esp
80106b55: 68 a0 5a 11 80 push $0x80115aa0
80106b5a: e8 de ea ff ff call 8010563d <acquire>
80106b5f: 83 c4 10 add $0x10,%esp
ticks0 = ticks;
80106b62: a1 e0 62 11 80 mov 0x801162e0,%eax
80106b67: 89 45 f4 mov %eax,-0xc(%ebp)
while(ticks - ticks0 < n){
80106b6a: eb 39 jmp 80106ba5 <sys_sleep+0x75>
if(proc->killed){
80106b6c: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106b72: 8b 40 24 mov 0x24(%eax),%eax
80106b75: 85 c0 test %eax,%eax
80106b77: 74 17 je 80106b90 <sys_sleep+0x60>
release(&tickslock);
80106b79: 83 ec 0c sub $0xc,%esp
80106b7c: 68 a0 5a 11 80 push $0x80115aa0
80106b81: e8 1e eb ff ff call 801056a4 <release>
80106b86: 83 c4 10 add $0x10,%esp
return -1;
80106b89: b8 ff ff ff ff mov $0xffffffff,%eax
80106b8e: eb 39 jmp 80106bc9 <sys_sleep+0x99>
}
sleep(&ticks, &tickslock);
80106b90: 83 ec 08 sub $0x8,%esp
80106b93: 68 a0 5a 11 80 push $0x80115aa0
80106b98: 68 e0 62 11 80 push $0x801162e0
80106b9d: e8 99 e7 ff ff call 8010533b <sleep>
80106ba2: 83 c4 10 add $0x10,%esp
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
80106ba5: a1 e0 62 11 80 mov 0x801162e0,%eax
80106baa: 2b 45 f4 sub -0xc(%ebp),%eax
80106bad: 8b 55 f0 mov -0x10(%ebp),%edx
80106bb0: 39 d0 cmp %edx,%eax
80106bb2: 72 b8 jb 80106b6c <sys_sleep+0x3c>
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
80106bb4: 83 ec 0c sub $0xc,%esp
80106bb7: 68 a0 5a 11 80 push $0x80115aa0
80106bbc: e8 e3 ea ff ff call 801056a4 <release>
80106bc1: 83 c4 10 add $0x10,%esp
return 0;
80106bc4: b8 00 00 00 00 mov $0x0,%eax
}
80106bc9: c9 leave
80106bca: c3 ret
80106bcb <sys_uptime>:
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
80106bcb: 55 push %ebp
80106bcc: 89 e5 mov %esp,%ebp
80106bce: 83 ec 18 sub $0x18,%esp
uint xticks;
acquire(&tickslock);
80106bd1: 83 ec 0c sub $0xc,%esp
80106bd4: 68 a0 5a 11 80 push $0x80115aa0
80106bd9: e8 5f ea ff ff call 8010563d <acquire>
80106bde: 83 c4 10 add $0x10,%esp
xticks = ticks;
80106be1: a1 e0 62 11 80 mov 0x801162e0,%eax
80106be6: 89 45 f4 mov %eax,-0xc(%ebp)
release(&tickslock);
80106be9: 83 ec 0c sub $0xc,%esp
80106bec: 68 a0 5a 11 80 push $0x80115aa0
80106bf1: e8 ae ea ff ff call 801056a4 <release>
80106bf6: 83 c4 10 add $0x10,%esp
return xticks;
80106bf9: 8b 45 f4 mov -0xc(%ebp),%eax
}
80106bfc: c9 leave
80106bfd: c3 ret
80106bfe <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
80106bfe: 55 push %ebp
80106bff: 89 e5 mov %esp,%ebp
80106c01: 83 ec 08 sub $0x8,%esp
80106c04: 8b 55 08 mov 0x8(%ebp),%edx
80106c07: 8b 45 0c mov 0xc(%ebp),%eax
80106c0a: 66 89 55 fc mov %dx,-0x4(%ebp)
80106c0e: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
80106c11: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
80106c15: 0f b7 55 fc movzwl -0x4(%ebp),%edx
80106c19: ee out %al,(%dx)
}
80106c1a: 90 nop
80106c1b: c9 leave
80106c1c: c3 ret
80106c1d <timerinit>:
#define TIMER_RATEGEN 0x04 // mode 2, rate generator
#define TIMER_16BIT 0x30 // r/w counter 16 bits, LSB first
void
timerinit(void)
{
80106c1d: 55 push %ebp
80106c1e: 89 e5 mov %esp,%ebp
80106c20: 83 ec 08 sub $0x8,%esp
// Interrupt 100 times/sec.
outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
80106c23: 6a 34 push $0x34
80106c25: 6a 43 push $0x43
80106c27: e8 d2 ff ff ff call 80106bfe <outb>
80106c2c: 83 c4 08 add $0x8,%esp
outb(IO_TIMER1, TIMER_DIV(100) % 256);
80106c2f: 68 9c 00 00 00 push $0x9c
80106c34: 6a 40 push $0x40
80106c36: e8 c3 ff ff ff call 80106bfe <outb>
80106c3b: 83 c4 08 add $0x8,%esp
outb(IO_TIMER1, TIMER_DIV(100) / 256);
80106c3e: 6a 2e push $0x2e
80106c40: 6a 40 push $0x40
80106c42: e8 b7 ff ff ff call 80106bfe <outb>
80106c47: 83 c4 08 add $0x8,%esp
picenable(IRQ_TIMER);
80106c4a: 83 ec 0c sub $0xc,%esp
80106c4d: 6a 00 push $0x0
80106c4f: e8 d7 d2 ff ff call 80103f2b <picenable>
80106c54: 83 c4 10 add $0x10,%esp
}
80106c57: 90 nop
80106c58: c9 leave
80106c59: c3 ret
80106c5a <alltraps>:
# vectors.S sends all traps here.
.globl alltraps
alltraps:
# Build trap frame.
pushl %ds
80106c5a: 1e push %ds
pushl %es
80106c5b: 06 push %es
pushl %fs
80106c5c: 0f a0 push %fs
pushl %gs
80106c5e: 0f a8 push %gs
pushal
80106c60: 60 pusha
# Set up data and per-cpu segments.
movw $(SEG_KDATA<<3), %ax
80106c61: 66 b8 10 00 mov $0x10,%ax
movw %ax, %ds
80106c65: 8e d8 mov %eax,%ds
movw %ax, %es
80106c67: 8e c0 mov %eax,%es
movw $(SEG_KCPU<<3), %ax
80106c69: 66 b8 18 00 mov $0x18,%ax
movw %ax, %fs
80106c6d: 8e e0 mov %eax,%fs
movw %ax, %gs
80106c6f: 8e e8 mov %eax,%gs
# Call trap(tf), where tf=%esp
pushl %esp
80106c71: 54 push %esp
call trap
80106c72: e8 d7 01 00 00 call 80106e4e <trap>
addl $4, %esp
80106c77: 83 c4 04 add $0x4,%esp
80106c7a <trapret>:
# Return falls through to trapret...
.globl trapret
trapret:
popal
80106c7a: 61 popa
popl %gs
80106c7b: 0f a9 pop %gs
popl %fs
80106c7d: 0f a1 pop %fs
popl %es
80106c7f: 07 pop %es
popl %ds
80106c80: 1f pop %ds
addl $0x8, %esp # trapno and errcode
80106c81: 83 c4 08 add $0x8,%esp
iret
80106c84: cf iret
80106c85 <lidt>:
struct gatedesc;
static inline void
lidt(struct gatedesc *p, int size)
{
80106c85: 55 push %ebp
80106c86: 89 e5 mov %esp,%ebp
80106c88: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
80106c8b: 8b 45 0c mov 0xc(%ebp),%eax
80106c8e: 83 e8 01 sub $0x1,%eax
80106c91: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
80106c95: 8b 45 08 mov 0x8(%ebp),%eax
80106c98: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80106c9c: 8b 45 08 mov 0x8(%ebp),%eax
80106c9f: c1 e8 10 shr $0x10,%eax
80106ca2: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lidt (%0)" : : "r" (pd));
80106ca6: 8d 45 fa lea -0x6(%ebp),%eax
80106ca9: 0f 01 18 lidtl (%eax)
}
80106cac: 90 nop
80106cad: c9 leave
80106cae: c3 ret
80106caf <rcr2>:
return result;
}
static inline uint
rcr2(void)
{
80106caf: 55 push %ebp
80106cb0: 89 e5 mov %esp,%ebp
80106cb2: 83 ec 10 sub $0x10,%esp
uint val;
asm volatile("movl %%cr2,%0" : "=r" (val));
80106cb5: 0f 20 d0 mov %cr2,%eax
80106cb8: 89 45 fc mov %eax,-0x4(%ebp)
return val;
80106cbb: 8b 45 fc mov -0x4(%ebp),%eax
}
80106cbe: c9 leave
80106cbf: c3 ret
80106cc0 <tvinit>:
struct spinlock tickslock;
uint ticks;
void
tvinit(void)
{
80106cc0: 55 push %ebp
80106cc1: 89 e5 mov %esp,%ebp
80106cc3: 83 ec 18 sub $0x18,%esp
int i;
for(i = 0; i < 256; i++)
80106cc6: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80106ccd: e9 c3 00 00 00 jmp 80106d95 <tvinit+0xd5>
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
80106cd2: 8b 45 f4 mov -0xc(%ebp),%eax
80106cd5: 8b 04 85 98 c0 10 80 mov -0x7fef3f68(,%eax,4),%eax
80106cdc: 89 c2 mov %eax,%edx
80106cde: 8b 45 f4 mov -0xc(%ebp),%eax
80106ce1: 66 89 14 c5 e0 5a 11 mov %dx,-0x7feea520(,%eax,8)
80106ce8: 80
80106ce9: 8b 45 f4 mov -0xc(%ebp),%eax
80106cec: 66 c7 04 c5 e2 5a 11 movw $0x8,-0x7feea51e(,%eax,8)
80106cf3: 80 08 00
80106cf6: 8b 45 f4 mov -0xc(%ebp),%eax
80106cf9: 0f b6 14 c5 e4 5a 11 movzbl -0x7feea51c(,%eax,8),%edx
80106d00: 80
80106d01: 83 e2 e0 and $0xffffffe0,%edx
80106d04: 88 14 c5 e4 5a 11 80 mov %dl,-0x7feea51c(,%eax,8)
80106d0b: 8b 45 f4 mov -0xc(%ebp),%eax
80106d0e: 0f b6 14 c5 e4 5a 11 movzbl -0x7feea51c(,%eax,8),%edx
80106d15: 80
80106d16: 83 e2 1f and $0x1f,%edx
80106d19: 88 14 c5 e4 5a 11 80 mov %dl,-0x7feea51c(,%eax,8)
80106d20: 8b 45 f4 mov -0xc(%ebp),%eax
80106d23: 0f b6 14 c5 e5 5a 11 movzbl -0x7feea51b(,%eax,8),%edx
80106d2a: 80
80106d2b: 83 e2 f0 and $0xfffffff0,%edx
80106d2e: 83 ca 0e or $0xe,%edx
80106d31: 88 14 c5 e5 5a 11 80 mov %dl,-0x7feea51b(,%eax,8)
80106d38: 8b 45 f4 mov -0xc(%ebp),%eax
80106d3b: 0f b6 14 c5 e5 5a 11 movzbl -0x7feea51b(,%eax,8),%edx
80106d42: 80
80106d43: 83 e2 ef and $0xffffffef,%edx
80106d46: 88 14 c5 e5 5a 11 80 mov %dl,-0x7feea51b(,%eax,8)
80106d4d: 8b 45 f4 mov -0xc(%ebp),%eax
80106d50: 0f b6 14 c5 e5 5a 11 movzbl -0x7feea51b(,%eax,8),%edx
80106d57: 80
80106d58: 83 e2 9f and $0xffffff9f,%edx
80106d5b: 88 14 c5 e5 5a 11 80 mov %dl,-0x7feea51b(,%eax,8)
80106d62: 8b 45 f4 mov -0xc(%ebp),%eax
80106d65: 0f b6 14 c5 e5 5a 11 movzbl -0x7feea51b(,%eax,8),%edx
80106d6c: 80
80106d6d: 83 ca 80 or $0xffffff80,%edx
80106d70: 88 14 c5 e5 5a 11 80 mov %dl,-0x7feea51b(,%eax,8)
80106d77: 8b 45 f4 mov -0xc(%ebp),%eax
80106d7a: 8b 04 85 98 c0 10 80 mov -0x7fef3f68(,%eax,4),%eax
80106d81: c1 e8 10 shr $0x10,%eax
80106d84: 89 c2 mov %eax,%edx
80106d86: 8b 45 f4 mov -0xc(%ebp),%eax
80106d89: 66 89 14 c5 e6 5a 11 mov %dx,-0x7feea51a(,%eax,8)
80106d90: 80
void
tvinit(void)
{
int i;
for(i = 0; i < 256; i++)
80106d91: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80106d95: 81 7d f4 ff 00 00 00 cmpl $0xff,-0xc(%ebp)
80106d9c: 0f 8e 30 ff ff ff jle 80106cd2 <tvinit+0x12>
SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
80106da2: a1 98 c1 10 80 mov 0x8010c198,%eax
80106da7: 66 a3 e0 5c 11 80 mov %ax,0x80115ce0
80106dad: 66 c7 05 e2 5c 11 80 movw $0x8,0x80115ce2
80106db4: 08 00
80106db6: 0f b6 05 e4 5c 11 80 movzbl 0x80115ce4,%eax
80106dbd: 83 e0 e0 and $0xffffffe0,%eax
80106dc0: a2 e4 5c 11 80 mov %al,0x80115ce4
80106dc5: 0f b6 05 e4 5c 11 80 movzbl 0x80115ce4,%eax
80106dcc: 83 e0 1f and $0x1f,%eax
80106dcf: a2 e4 5c 11 80 mov %al,0x80115ce4
80106dd4: 0f b6 05 e5 5c 11 80 movzbl 0x80115ce5,%eax
80106ddb: 83 c8 0f or $0xf,%eax
80106dde: a2 e5 5c 11 80 mov %al,0x80115ce5
80106de3: 0f b6 05 e5 5c 11 80 movzbl 0x80115ce5,%eax
80106dea: 83 e0 ef and $0xffffffef,%eax
80106ded: a2 e5 5c 11 80 mov %al,0x80115ce5
80106df2: 0f b6 05 e5 5c 11 80 movzbl 0x80115ce5,%eax
80106df9: 83 c8 60 or $0x60,%eax
80106dfc: a2 e5 5c 11 80 mov %al,0x80115ce5
80106e01: 0f b6 05 e5 5c 11 80 movzbl 0x80115ce5,%eax
80106e08: 83 c8 80 or $0xffffff80,%eax
80106e0b: a2 e5 5c 11 80 mov %al,0x80115ce5
80106e10: a1 98 c1 10 80 mov 0x8010c198,%eax
80106e15: c1 e8 10 shr $0x10,%eax
80106e18: 66 a3 e6 5c 11 80 mov %ax,0x80115ce6
initlock(&tickslock, "time");
80106e1e: 83 ec 08 sub $0x8,%esp
80106e21: 68 fc 90 10 80 push $0x801090fc
80106e26: 68 a0 5a 11 80 push $0x80115aa0
80106e2b: e8 eb e7 ff ff call 8010561b <initlock>
80106e30: 83 c4 10 add $0x10,%esp
}
80106e33: 90 nop
80106e34: c9 leave
80106e35: c3 ret
80106e36 <idtinit>:
void
idtinit(void)
{
80106e36: 55 push %ebp
80106e37: 89 e5 mov %esp,%ebp
lidt(idt, sizeof(idt));
80106e39: 68 00 08 00 00 push $0x800
80106e3e: 68 e0 5a 11 80 push $0x80115ae0
80106e43: e8 3d fe ff ff call 80106c85 <lidt>
80106e48: 83 c4 08 add $0x8,%esp
}
80106e4b: 90 nop
80106e4c: c9 leave
80106e4d: c3 ret
80106e4e <trap>:
//PAGEBREAK: 41
void
trap(struct trapframe *tf)
{
80106e4e: 55 push %ebp
80106e4f: 89 e5 mov %esp,%ebp
80106e51: 57 push %edi
80106e52: 56 push %esi
80106e53: 53 push %ebx
80106e54: 83 ec 1c sub $0x1c,%esp
if(tf->trapno == T_SYSCALL){
80106e57: 8b 45 08 mov 0x8(%ebp),%eax
80106e5a: 8b 40 30 mov 0x30(%eax),%eax
80106e5d: 83 f8 40 cmp $0x40,%eax
80106e60: 75 3e jne 80106ea0 <trap+0x52>
if(proc->killed)
80106e62: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106e68: 8b 40 24 mov 0x24(%eax),%eax
80106e6b: 85 c0 test %eax,%eax
80106e6d: 74 05 je 80106e74 <trap+0x26>
exit();
80106e6f: e8 81 db ff ff call 801049f5 <exit>
proc->tf = tf;
80106e74: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106e7a: 8b 55 08 mov 0x8(%ebp),%edx
80106e7d: 89 50 18 mov %edx,0x18(%eax)
syscall();
80106e80: e8 f6 ed ff ff call 80105c7b <syscall>
if(proc->killed)
80106e85: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106e8b: 8b 40 24 mov 0x24(%eax),%eax
80106e8e: 85 c0 test %eax,%eax
80106e90: 0f 84 1b 02 00 00 je 801070b1 <trap+0x263>
exit();
80106e96: e8 5a db ff ff call 801049f5 <exit>
return;
80106e9b: e9 11 02 00 00 jmp 801070b1 <trap+0x263>
}
switch(tf->trapno){
80106ea0: 8b 45 08 mov 0x8(%ebp),%eax
80106ea3: 8b 40 30 mov 0x30(%eax),%eax
80106ea6: 83 e8 20 sub $0x20,%eax
80106ea9: 83 f8 1f cmp $0x1f,%eax
80106eac: 0f 87 c0 00 00 00 ja 80106f72 <trap+0x124>
80106eb2: 8b 04 85 a4 91 10 80 mov -0x7fef6e5c(,%eax,4),%eax
80106eb9: ff e0 jmp *%eax
case T_IRQ0 + IRQ_TIMER:
if(cpu->id == 0){
80106ebb: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106ec1: 0f b6 00 movzbl (%eax),%eax
80106ec4: 84 c0 test %al,%al
80106ec6: 75 3d jne 80106f05 <trap+0xb7>
acquire(&tickslock);
80106ec8: 83 ec 0c sub $0xc,%esp
80106ecb: 68 a0 5a 11 80 push $0x80115aa0
80106ed0: e8 68 e7 ff ff call 8010563d <acquire>
80106ed5: 83 c4 10 add $0x10,%esp
ticks++;
80106ed8: a1 e0 62 11 80 mov 0x801162e0,%eax
80106edd: 83 c0 01 add $0x1,%eax
80106ee0: a3 e0 62 11 80 mov %eax,0x801162e0
wakeup(&ticks);
80106ee5: 83 ec 0c sub $0xc,%esp
80106ee8: 68 e0 62 11 80 push $0x801162e0
80106eed: e8 37 e5 ff ff call 80105429 <wakeup>
80106ef2: 83 c4 10 add $0x10,%esp
release(&tickslock);
80106ef5: 83 ec 0c sub $0xc,%esp
80106ef8: 68 a0 5a 11 80 push $0x80115aa0
80106efd: e8 a2 e7 ff ff call 801056a4 <release>
80106f02: 83 c4 10 add $0x10,%esp
}
lapiceoi();
80106f05: e8 1b c1 ff ff call 80103025 <lapiceoi>
break;
80106f0a: e9 1c 01 00 00 jmp 8010702b <trap+0x1dd>
case T_IRQ0 + IRQ_IDE:
ideintr();
80106f0f: e8 24 b9 ff ff call 80102838 <ideintr>
lapiceoi();
80106f14: e8 0c c1 ff ff call 80103025 <lapiceoi>
break;
80106f19: e9 0d 01 00 00 jmp 8010702b <trap+0x1dd>
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
case T_IRQ0 + IRQ_KBD:
kbdintr();
80106f1e: e8 04 bf ff ff call 80102e27 <kbdintr>
lapiceoi();
80106f23: e8 fd c0 ff ff call 80103025 <lapiceoi>
break;
80106f28: e9 fe 00 00 00 jmp 8010702b <trap+0x1dd>
case T_IRQ0 + IRQ_COM1:
uartintr();
80106f2d: e8 60 03 00 00 call 80107292 <uartintr>
lapiceoi();
80106f32: e8 ee c0 ff ff call 80103025 <lapiceoi>
break;
80106f37: e9 ef 00 00 00 jmp 8010702b <trap+0x1dd>
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106f3c: 8b 45 08 mov 0x8(%ebp),%eax
80106f3f: 8b 48 38 mov 0x38(%eax),%ecx
cpu->id, tf->cs, tf->eip);
80106f42: 8b 45 08 mov 0x8(%ebp),%eax
80106f45: 0f b7 40 3c movzwl 0x3c(%eax),%eax
uartintr();
lapiceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106f49: 0f b7 d0 movzwl %ax,%edx
cpu->id, tf->cs, tf->eip);
80106f4c: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106f52: 0f b6 00 movzbl (%eax),%eax
uartintr();
lapiceoi();
break;
case T_IRQ0 + 7:
case T_IRQ0 + IRQ_SPURIOUS:
cprintf("cpu%d: spurious interrupt at %x:%x\n",
80106f55: 0f b6 c0 movzbl %al,%eax
80106f58: 51 push %ecx
80106f59: 52 push %edx
80106f5a: 50 push %eax
80106f5b: 68 04 91 10 80 push $0x80109104
80106f60: e8 61 94 ff ff call 801003c6 <cprintf>
80106f65: 83 c4 10 add $0x10,%esp
cpu->id, tf->cs, tf->eip);
lapiceoi();
80106f68: e8 b8 c0 ff ff call 80103025 <lapiceoi>
break;
80106f6d: e9 b9 00 00 00 jmp 8010702b <trap+0x1dd>
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
80106f72: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106f78: 85 c0 test %eax,%eax
80106f7a: 74 11 je 80106f8d <trap+0x13f>
80106f7c: 8b 45 08 mov 0x8(%ebp),%eax
80106f7f: 0f b7 40 3c movzwl 0x3c(%eax),%eax
80106f83: 0f b7 c0 movzwl %ax,%eax
80106f86: 83 e0 03 and $0x3,%eax
80106f89: 85 c0 test %eax,%eax
80106f8b: 75 40 jne 80106fcd <trap+0x17f>
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106f8d: e8 1d fd ff ff call 80106caf <rcr2>
80106f92: 89 c3 mov %eax,%ebx
80106f94: 8b 45 08 mov 0x8(%ebp),%eax
80106f97: 8b 48 38 mov 0x38(%eax),%ecx
tf->trapno, cpu->id, tf->eip, rcr2());
80106f9a: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106fa0: 0f b6 00 movzbl (%eax),%eax
//PAGEBREAK: 13
default:
if(proc == 0 || (tf->cs&3) == 0){
// In kernel, it must be our mistake.
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
80106fa3: 0f b6 d0 movzbl %al,%edx
80106fa6: 8b 45 08 mov 0x8(%ebp),%eax
80106fa9: 8b 40 30 mov 0x30(%eax),%eax
80106fac: 83 ec 0c sub $0xc,%esp
80106faf: 53 push %ebx
80106fb0: 51 push %ecx
80106fb1: 52 push %edx
80106fb2: 50 push %eax
80106fb3: 68 28 91 10 80 push $0x80109128
80106fb8: e8 09 94 ff ff call 801003c6 <cprintf>
80106fbd: 83 c4 20 add $0x20,%esp
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
80106fc0: 83 ec 0c sub $0xc,%esp
80106fc3: 68 5a 91 10 80 push $0x8010915a
80106fc8: e8 99 95 ff ff call 80100566 <panic>
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
80106fcd: e8 dd fc ff ff call 80106caf <rcr2>
80106fd2: 89 45 e4 mov %eax,-0x1c(%ebp)
80106fd5: 8b 45 08 mov 0x8(%ebp),%eax
80106fd8: 8b 70 38 mov 0x38(%eax),%esi
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
80106fdb: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80106fe1: 0f b6 00 movzbl (%eax),%eax
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
80106fe4: 0f b6 d8 movzbl %al,%ebx
80106fe7: 8b 45 08 mov 0x8(%ebp),%eax
80106fea: 8b 48 34 mov 0x34(%eax),%ecx
80106fed: 8b 45 08 mov 0x8(%ebp),%eax
80106ff0: 8b 50 30 mov 0x30(%eax),%edx
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
80106ff3: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80106ff9: 8d 78 6c lea 0x6c(%eax),%edi
80106ffc: 65 a1 04 00 00 00 mov %gs:0x4,%eax
cprintf("unexpected trap %d from cpu %d eip %x (cr2=0x%x)\n",
tf->trapno, cpu->id, tf->eip, rcr2());
panic("trap");
}
// In user space, assume process misbehaved.
cprintf("pid %d %s: trap %d err %d on cpu %d "
80107002: 8b 40 10 mov 0x10(%eax),%eax
80107005: ff 75 e4 pushl -0x1c(%ebp)
80107008: 56 push %esi
80107009: 53 push %ebx
8010700a: 51 push %ecx
8010700b: 52 push %edx
8010700c: 57 push %edi
8010700d: 50 push %eax
8010700e: 68 60 91 10 80 push $0x80109160
80107013: e8 ae 93 ff ff call 801003c6 <cprintf>
80107018: 83 c4 20 add $0x20,%esp
"eip 0x%x addr 0x%x--kill proc\n",
proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip,
rcr2());
proc->killed = 1;
8010701b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80107021: c7 40 24 01 00 00 00 movl $0x1,0x24(%eax)
80107028: eb 01 jmp 8010702b <trap+0x1dd>
ideintr();
lapiceoi();
break;
case T_IRQ0 + IRQ_IDE+1:
// Bochs generates spurious IDE1 interrupts.
break;
8010702a: 90 nop
}
// Force process exit if it has been killed and is in user space.
// (If it is still executing in the kernel, let it keep running
// until it gets to the regular system call return.)
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
8010702b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80107031: 85 c0 test %eax,%eax
80107033: 74 24 je 80107059 <trap+0x20b>
80107035: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010703b: 8b 40 24 mov 0x24(%eax),%eax
8010703e: 85 c0 test %eax,%eax
80107040: 74 17 je 80107059 <trap+0x20b>
80107042: 8b 45 08 mov 0x8(%ebp),%eax
80107045: 0f b7 40 3c movzwl 0x3c(%eax),%eax
80107049: 0f b7 c0 movzwl %ax,%eax
8010704c: 83 e0 03 and $0x3,%eax
8010704f: 83 f8 03 cmp $0x3,%eax
80107052: 75 05 jne 80107059 <trap+0x20b>
exit();
80107054: e8 9c d9 ff ff call 801049f5 <exit>
// Force process to give up CPU on clock tick.
// If interrupts were on while locks held, would need to check nlock.
if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
80107059: 65 a1 04 00 00 00 mov %gs:0x4,%eax
8010705f: 85 c0 test %eax,%eax
80107061: 74 1e je 80107081 <trap+0x233>
80107063: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80107069: 8b 40 0c mov 0xc(%eax),%eax
8010706c: 83 f8 04 cmp $0x4,%eax
8010706f: 75 10 jne 80107081 <trap+0x233>
80107071: 8b 45 08 mov 0x8(%ebp),%eax
80107074: 8b 40 30 mov 0x30(%eax),%eax
80107077: 83 f8 20 cmp $0x20,%eax
8010707a: 75 05 jne 80107081 <trap+0x233>
yield();
8010707c: e8 39 e2 ff ff call 801052ba <yield>
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
80107081: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80107087: 85 c0 test %eax,%eax
80107089: 74 27 je 801070b2 <trap+0x264>
8010708b: 65 a1 04 00 00 00 mov %gs:0x4,%eax
80107091: 8b 40 24 mov 0x24(%eax),%eax
80107094: 85 c0 test %eax,%eax
80107096: 74 1a je 801070b2 <trap+0x264>
80107098: 8b 45 08 mov 0x8(%ebp),%eax
8010709b: 0f b7 40 3c movzwl 0x3c(%eax),%eax
8010709f: 0f b7 c0 movzwl %ax,%eax
801070a2: 83 e0 03 and $0x3,%eax
801070a5: 83 f8 03 cmp $0x3,%eax
801070a8: 75 08 jne 801070b2 <trap+0x264>
exit();
801070aa: e8 46 d9 ff ff call 801049f5 <exit>
801070af: eb 01 jmp 801070b2 <trap+0x264>
exit();
proc->tf = tf;
syscall();
if(proc->killed)
exit();
return;
801070b1: 90 nop
yield();
// Check if the process has been killed since we yielded
if(proc && proc->killed && (tf->cs&3) == DPL_USER)
exit();
}
801070b2: 8d 65 f4 lea -0xc(%ebp),%esp
801070b5: 5b pop %ebx
801070b6: 5e pop %esi
801070b7: 5f pop %edi
801070b8: 5d pop %ebp
801070b9: c3 ret
801070ba <inb>:
// Routines to let C code use special x86 instructions.
static inline uchar
inb(ushort port)
{
801070ba: 55 push %ebp
801070bb: 89 e5 mov %esp,%ebp
801070bd: 83 ec 14 sub $0x14,%esp
801070c0: 8b 45 08 mov 0x8(%ebp),%eax
801070c3: 66 89 45 ec mov %ax,-0x14(%ebp)
uchar data;
asm volatile("in %1,%0" : "=a" (data) : "d" (port));
801070c7: 0f b7 45 ec movzwl -0x14(%ebp),%eax
801070cb: 89 c2 mov %eax,%edx
801070cd: ec in (%dx),%al
801070ce: 88 45 ff mov %al,-0x1(%ebp)
return data;
801070d1: 0f b6 45 ff movzbl -0x1(%ebp),%eax
}
801070d5: c9 leave
801070d6: c3 ret
801070d7 <outb>:
"memory", "cc");
}
static inline void
outb(ushort port, uchar data)
{
801070d7: 55 push %ebp
801070d8: 89 e5 mov %esp,%ebp
801070da: 83 ec 08 sub $0x8,%esp
801070dd: 8b 55 08 mov 0x8(%ebp),%edx
801070e0: 8b 45 0c mov 0xc(%ebp),%eax
801070e3: 66 89 55 fc mov %dx,-0x4(%ebp)
801070e7: 88 45 f8 mov %al,-0x8(%ebp)
asm volatile("out %0,%1" : : "a" (data), "d" (port));
801070ea: 0f b6 45 f8 movzbl -0x8(%ebp),%eax
801070ee: 0f b7 55 fc movzwl -0x4(%ebp),%edx
801070f2: ee out %al,(%dx)
}
801070f3: 90 nop
801070f4: c9 leave
801070f5: c3 ret
801070f6 <uartinit>:
static int uart; // is there a uart?
void
uartinit(void)
{
801070f6: 55 push %ebp
801070f7: 89 e5 mov %esp,%ebp
801070f9: 83 ec 18 sub $0x18,%esp
char *p;
// Turn off the FIFO
outb(COM1+2, 0);
801070fc: 6a 00 push $0x0
801070fe: 68 fa 03 00 00 push $0x3fa
80107103: e8 cf ff ff ff call 801070d7 <outb>
80107108: 83 c4 08 add $0x8,%esp
// 9600 baud, 8 data bits, 1 stop bit, parity off.
outb(COM1+3, 0x80); // Unlock divisor
8010710b: 68 80 00 00 00 push $0x80
80107110: 68 fb 03 00 00 push $0x3fb
80107115: e8 bd ff ff ff call 801070d7 <outb>
8010711a: 83 c4 08 add $0x8,%esp
outb(COM1+0, 115200/9600);
8010711d: 6a 0c push $0xc
8010711f: 68 f8 03 00 00 push $0x3f8
80107124: e8 ae ff ff ff call 801070d7 <outb>
80107129: 83 c4 08 add $0x8,%esp
outb(COM1+1, 0);
8010712c: 6a 00 push $0x0
8010712e: 68 f9 03 00 00 push $0x3f9
80107133: e8 9f ff ff ff call 801070d7 <outb>
80107138: 83 c4 08 add $0x8,%esp
outb(COM1+3, 0x03); // Lock divisor, 8 data bits.
8010713b: 6a 03 push $0x3
8010713d: 68 fb 03 00 00 push $0x3fb
80107142: e8 90 ff ff ff call 801070d7 <outb>
80107147: 83 c4 08 add $0x8,%esp
outb(COM1+4, 0);
8010714a: 6a 00 push $0x0
8010714c: 68 fc 03 00 00 push $0x3fc
80107151: e8 81 ff ff ff call 801070d7 <outb>
80107156: 83 c4 08 add $0x8,%esp
outb(COM1+1, 0x01); // Enable receive interrupts.
80107159: 6a 01 push $0x1
8010715b: 68 f9 03 00 00 push $0x3f9
80107160: e8 72 ff ff ff call 801070d7 <outb>
80107165: 83 c4 08 add $0x8,%esp
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
80107168: 68 fd 03 00 00 push $0x3fd
8010716d: e8 48 ff ff ff call 801070ba <inb>
80107172: 83 c4 04 add $0x4,%esp
80107175: 3c ff cmp $0xff,%al
80107177: 74 6e je 801071e7 <uartinit+0xf1>
return;
uart = 1;
80107179: c7 05 4c c6 10 80 01 movl $0x1,0x8010c64c
80107180: 00 00 00
// Acknowledge pre-existing interrupt conditions;
// enable interrupts.
inb(COM1+2);
80107183: 68 fa 03 00 00 push $0x3fa
80107188: e8 2d ff ff ff call 801070ba <inb>
8010718d: 83 c4 04 add $0x4,%esp
inb(COM1+0);
80107190: 68 f8 03 00 00 push $0x3f8
80107195: e8 20 ff ff ff call 801070ba <inb>
8010719a: 83 c4 04 add $0x4,%esp
picenable(IRQ_COM1);
8010719d: 83 ec 0c sub $0xc,%esp
801071a0: 6a 04 push $0x4
801071a2: e8 84 cd ff ff call 80103f2b <picenable>
801071a7: 83 c4 10 add $0x10,%esp
ioapicenable(IRQ_COM1, 0);
801071aa: 83 ec 08 sub $0x8,%esp
801071ad: 6a 00 push $0x0
801071af: 6a 04 push $0x4
801071b1: e8 24 b9 ff ff call 80102ada <ioapicenable>
801071b6: 83 c4 10 add $0x10,%esp
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
801071b9: c7 45 f4 24 92 10 80 movl $0x80109224,-0xc(%ebp)
801071c0: eb 19 jmp 801071db <uartinit+0xe5>
uartputc(*p);
801071c2: 8b 45 f4 mov -0xc(%ebp),%eax
801071c5: 0f b6 00 movzbl (%eax),%eax
801071c8: 0f be c0 movsbl %al,%eax
801071cb: 83 ec 0c sub $0xc,%esp
801071ce: 50 push %eax
801071cf: e8 16 00 00 00 call 801071ea <uartputc>
801071d4: 83 c4 10 add $0x10,%esp
inb(COM1+0);
picenable(IRQ_COM1);
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
801071d7: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801071db: 8b 45 f4 mov -0xc(%ebp),%eax
801071de: 0f b6 00 movzbl (%eax),%eax
801071e1: 84 c0 test %al,%al
801071e3: 75 dd jne 801071c2 <uartinit+0xcc>
801071e5: eb 01 jmp 801071e8 <uartinit+0xf2>
outb(COM1+4, 0);
outb(COM1+1, 0x01); // Enable receive interrupts.
// If status is 0xFF, no serial port.
if(inb(COM1+5) == 0xFF)
return;
801071e7: 90 nop
ioapicenable(IRQ_COM1, 0);
// Announce that we're here.
for(p="xv6...\n"; *p; p++)
uartputc(*p);
}
801071e8: c9 leave
801071e9: c3 ret
801071ea <uartputc>:
void
uartputc(int c)
{
801071ea: 55 push %ebp
801071eb: 89 e5 mov %esp,%ebp
801071ed: 83 ec 18 sub $0x18,%esp
int i;
if(!uart)
801071f0: a1 4c c6 10 80 mov 0x8010c64c,%eax
801071f5: 85 c0 test %eax,%eax
801071f7: 74 53 je 8010724c <uartputc+0x62>
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
801071f9: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80107200: eb 11 jmp 80107213 <uartputc+0x29>
microdelay(10);
80107202: 83 ec 0c sub $0xc,%esp
80107205: 6a 0a push $0xa
80107207: e8 34 be ff ff call 80103040 <microdelay>
8010720c: 83 c4 10 add $0x10,%esp
{
int i;
if(!uart)
return;
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
8010720f: 83 45 f4 01 addl $0x1,-0xc(%ebp)
80107213: 83 7d f4 7f cmpl $0x7f,-0xc(%ebp)
80107217: 7f 1a jg 80107233 <uartputc+0x49>
80107219: 83 ec 0c sub $0xc,%esp
8010721c: 68 fd 03 00 00 push $0x3fd
80107221: e8 94 fe ff ff call 801070ba <inb>
80107226: 83 c4 10 add $0x10,%esp
80107229: 0f b6 c0 movzbl %al,%eax
8010722c: 83 e0 20 and $0x20,%eax
8010722f: 85 c0 test %eax,%eax
80107231: 74 cf je 80107202 <uartputc+0x18>
microdelay(10);
outb(COM1+0, c);
80107233: 8b 45 08 mov 0x8(%ebp),%eax
80107236: 0f b6 c0 movzbl %al,%eax
80107239: 83 ec 08 sub $0x8,%esp
8010723c: 50 push %eax
8010723d: 68 f8 03 00 00 push $0x3f8
80107242: e8 90 fe ff ff call 801070d7 <outb>
80107247: 83 c4 10 add $0x10,%esp
8010724a: eb 01 jmp 8010724d <uartputc+0x63>
uartputc(int c)
{
int i;
if(!uart)
return;
8010724c: 90 nop
for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
microdelay(10);
outb(COM1+0, c);
}
8010724d: c9 leave
8010724e: c3 ret
8010724f <uartgetc>:
static int
uartgetc(void)
{
8010724f: 55 push %ebp
80107250: 89 e5 mov %esp,%ebp
if(!uart)
80107252: a1 4c c6 10 80 mov 0x8010c64c,%eax
80107257: 85 c0 test %eax,%eax
80107259: 75 07 jne 80107262 <uartgetc+0x13>
return -1;
8010725b: b8 ff ff ff ff mov $0xffffffff,%eax
80107260: eb 2e jmp 80107290 <uartgetc+0x41>
if(!(inb(COM1+5) & 0x01))
80107262: 68 fd 03 00 00 push $0x3fd
80107267: e8 4e fe ff ff call 801070ba <inb>
8010726c: 83 c4 04 add $0x4,%esp
8010726f: 0f b6 c0 movzbl %al,%eax
80107272: 83 e0 01 and $0x1,%eax
80107275: 85 c0 test %eax,%eax
80107277: 75 07 jne 80107280 <uartgetc+0x31>
return -1;
80107279: b8 ff ff ff ff mov $0xffffffff,%eax
8010727e: eb 10 jmp 80107290 <uartgetc+0x41>
return inb(COM1+0);
80107280: 68 f8 03 00 00 push $0x3f8
80107285: e8 30 fe ff ff call 801070ba <inb>
8010728a: 83 c4 04 add $0x4,%esp
8010728d: 0f b6 c0 movzbl %al,%eax
}
80107290: c9 leave
80107291: c3 ret
80107292 <uartintr>:
void
uartintr(void)
{
80107292: 55 push %ebp
80107293: 89 e5 mov %esp,%ebp
80107295: 83 ec 08 sub $0x8,%esp
consoleintr(uartgetc);
80107298: 83 ec 0c sub $0xc,%esp
8010729b: 68 4f 72 10 80 push $0x8010724f
801072a0: e8 54 95 ff ff call 801007f9 <consoleintr>
801072a5: 83 c4 10 add $0x10,%esp
}
801072a8: 90 nop
801072a9: c9 leave
801072aa: c3 ret
801072ab <vector0>:
# generated by vectors.pl - do not edit
# handlers
.globl alltraps
.globl vector0
vector0:
pushl $0
801072ab: 6a 00 push $0x0
pushl $0
801072ad: 6a 00 push $0x0
jmp alltraps
801072af: e9 a6 f9 ff ff jmp 80106c5a <alltraps>
801072b4 <vector1>:
.globl vector1
vector1:
pushl $0
801072b4: 6a 00 push $0x0
pushl $1
801072b6: 6a 01 push $0x1
jmp alltraps
801072b8: e9 9d f9 ff ff jmp 80106c5a <alltraps>
801072bd <vector2>:
.globl vector2
vector2:
pushl $0
801072bd: 6a 00 push $0x0
pushl $2
801072bf: 6a 02 push $0x2
jmp alltraps
801072c1: e9 94 f9 ff ff jmp 80106c5a <alltraps>
801072c6 <vector3>:
.globl vector3
vector3:
pushl $0
801072c6: 6a 00 push $0x0
pushl $3
801072c8: 6a 03 push $0x3
jmp alltraps
801072ca: e9 8b f9 ff ff jmp 80106c5a <alltraps>
801072cf <vector4>:
.globl vector4
vector4:
pushl $0
801072cf: 6a 00 push $0x0
pushl $4
801072d1: 6a 04 push $0x4
jmp alltraps
801072d3: e9 82 f9 ff ff jmp 80106c5a <alltraps>
801072d8 <vector5>:
.globl vector5
vector5:
pushl $0
801072d8: 6a 00 push $0x0
pushl $5
801072da: 6a 05 push $0x5
jmp alltraps
801072dc: e9 79 f9 ff ff jmp 80106c5a <alltraps>
801072e1 <vector6>:
.globl vector6
vector6:
pushl $0
801072e1: 6a 00 push $0x0
pushl $6
801072e3: 6a 06 push $0x6
jmp alltraps
801072e5: e9 70 f9 ff ff jmp 80106c5a <alltraps>
801072ea <vector7>:
.globl vector7
vector7:
pushl $0
801072ea: 6a 00 push $0x0
pushl $7
801072ec: 6a 07 push $0x7
jmp alltraps
801072ee: e9 67 f9 ff ff jmp 80106c5a <alltraps>
801072f3 <vector8>:
.globl vector8
vector8:
pushl $8
801072f3: 6a 08 push $0x8
jmp alltraps
801072f5: e9 60 f9 ff ff jmp 80106c5a <alltraps>
801072fa <vector9>:
.globl vector9
vector9:
pushl $0
801072fa: 6a 00 push $0x0
pushl $9
801072fc: 6a 09 push $0x9
jmp alltraps
801072fe: e9 57 f9 ff ff jmp 80106c5a <alltraps>
80107303 <vector10>:
.globl vector10
vector10:
pushl $10
80107303: 6a 0a push $0xa
jmp alltraps
80107305: e9 50 f9 ff ff jmp 80106c5a <alltraps>
8010730a <vector11>:
.globl vector11
vector11:
pushl $11
8010730a: 6a 0b push $0xb
jmp alltraps
8010730c: e9 49 f9 ff ff jmp 80106c5a <alltraps>
80107311 <vector12>:
.globl vector12
vector12:
pushl $12
80107311: 6a 0c push $0xc
jmp alltraps
80107313: e9 42 f9 ff ff jmp 80106c5a <alltraps>
80107318 <vector13>:
.globl vector13
vector13:
pushl $13
80107318: 6a 0d push $0xd
jmp alltraps
8010731a: e9 3b f9 ff ff jmp 80106c5a <alltraps>
8010731f <vector14>:
.globl vector14
vector14:
pushl $14
8010731f: 6a 0e push $0xe
jmp alltraps
80107321: e9 34 f9 ff ff jmp 80106c5a <alltraps>
80107326 <vector15>:
.globl vector15
vector15:
pushl $0
80107326: 6a 00 push $0x0
pushl $15
80107328: 6a 0f push $0xf
jmp alltraps
8010732a: e9 2b f9 ff ff jmp 80106c5a <alltraps>
8010732f <vector16>:
.globl vector16
vector16:
pushl $0
8010732f: 6a 00 push $0x0
pushl $16
80107331: 6a 10 push $0x10
jmp alltraps
80107333: e9 22 f9 ff ff jmp 80106c5a <alltraps>
80107338 <vector17>:
.globl vector17
vector17:
pushl $17
80107338: 6a 11 push $0x11
jmp alltraps
8010733a: e9 1b f9 ff ff jmp 80106c5a <alltraps>
8010733f <vector18>:
.globl vector18
vector18:
pushl $0
8010733f: 6a 00 push $0x0
pushl $18
80107341: 6a 12 push $0x12
jmp alltraps
80107343: e9 12 f9 ff ff jmp 80106c5a <alltraps>
80107348 <vector19>:
.globl vector19
vector19:
pushl $0
80107348: 6a 00 push $0x0
pushl $19
8010734a: 6a 13 push $0x13
jmp alltraps
8010734c: e9 09 f9 ff ff jmp 80106c5a <alltraps>
80107351 <vector20>:
.globl vector20
vector20:
pushl $0
80107351: 6a 00 push $0x0
pushl $20
80107353: 6a 14 push $0x14
jmp alltraps
80107355: e9 00 f9 ff ff jmp 80106c5a <alltraps>
8010735a <vector21>:
.globl vector21
vector21:
pushl $0
8010735a: 6a 00 push $0x0
pushl $21
8010735c: 6a 15 push $0x15
jmp alltraps
8010735e: e9 f7 f8 ff ff jmp 80106c5a <alltraps>
80107363 <vector22>:
.globl vector22
vector22:
pushl $0
80107363: 6a 00 push $0x0
pushl $22
80107365: 6a 16 push $0x16
jmp alltraps
80107367: e9 ee f8 ff ff jmp 80106c5a <alltraps>
8010736c <vector23>:
.globl vector23
vector23:
pushl $0
8010736c: 6a 00 push $0x0
pushl $23
8010736e: 6a 17 push $0x17
jmp alltraps
80107370: e9 e5 f8 ff ff jmp 80106c5a <alltraps>
80107375 <vector24>:
.globl vector24
vector24:
pushl $0
80107375: 6a 00 push $0x0
pushl $24
80107377: 6a 18 push $0x18
jmp alltraps
80107379: e9 dc f8 ff ff jmp 80106c5a <alltraps>
8010737e <vector25>:
.globl vector25
vector25:
pushl $0
8010737e: 6a 00 push $0x0
pushl $25
80107380: 6a 19 push $0x19
jmp alltraps
80107382: e9 d3 f8 ff ff jmp 80106c5a <alltraps>
80107387 <vector26>:
.globl vector26
vector26:
pushl $0
80107387: 6a 00 push $0x0
pushl $26
80107389: 6a 1a push $0x1a
jmp alltraps
8010738b: e9 ca f8 ff ff jmp 80106c5a <alltraps>
80107390 <vector27>:
.globl vector27
vector27:
pushl $0
80107390: 6a 00 push $0x0
pushl $27
80107392: 6a 1b push $0x1b
jmp alltraps
80107394: e9 c1 f8 ff ff jmp 80106c5a <alltraps>
80107399 <vector28>:
.globl vector28
vector28:
pushl $0
80107399: 6a 00 push $0x0
pushl $28
8010739b: 6a 1c push $0x1c
jmp alltraps
8010739d: e9 b8 f8 ff ff jmp 80106c5a <alltraps>
801073a2 <vector29>:
.globl vector29
vector29:
pushl $0
801073a2: 6a 00 push $0x0
pushl $29
801073a4: 6a 1d push $0x1d
jmp alltraps
801073a6: e9 af f8 ff ff jmp 80106c5a <alltraps>
801073ab <vector30>:
.globl vector30
vector30:
pushl $0
801073ab: 6a 00 push $0x0
pushl $30
801073ad: 6a 1e push $0x1e
jmp alltraps
801073af: e9 a6 f8 ff ff jmp 80106c5a <alltraps>
801073b4 <vector31>:
.globl vector31
vector31:
pushl $0
801073b4: 6a 00 push $0x0
pushl $31
801073b6: 6a 1f push $0x1f
jmp alltraps
801073b8: e9 9d f8 ff ff jmp 80106c5a <alltraps>
801073bd <vector32>:
.globl vector32
vector32:
pushl $0
801073bd: 6a 00 push $0x0
pushl $32
801073bf: 6a 20 push $0x20
jmp alltraps
801073c1: e9 94 f8 ff ff jmp 80106c5a <alltraps>
801073c6 <vector33>:
.globl vector33
vector33:
pushl $0
801073c6: 6a 00 push $0x0
pushl $33
801073c8: 6a 21 push $0x21
jmp alltraps
801073ca: e9 8b f8 ff ff jmp 80106c5a <alltraps>
801073cf <vector34>:
.globl vector34
vector34:
pushl $0
801073cf: 6a 00 push $0x0
pushl $34
801073d1: 6a 22 push $0x22
jmp alltraps
801073d3: e9 82 f8 ff ff jmp 80106c5a <alltraps>
801073d8 <vector35>:
.globl vector35
vector35:
pushl $0
801073d8: 6a 00 push $0x0
pushl $35
801073da: 6a 23 push $0x23
jmp alltraps
801073dc: e9 79 f8 ff ff jmp 80106c5a <alltraps>
801073e1 <vector36>:
.globl vector36
vector36:
pushl $0
801073e1: 6a 00 push $0x0
pushl $36
801073e3: 6a 24 push $0x24
jmp alltraps
801073e5: e9 70 f8 ff ff jmp 80106c5a <alltraps>
801073ea <vector37>:
.globl vector37
vector37:
pushl $0
801073ea: 6a 00 push $0x0
pushl $37
801073ec: 6a 25 push $0x25
jmp alltraps
801073ee: e9 67 f8 ff ff jmp 80106c5a <alltraps>
801073f3 <vector38>:
.globl vector38
vector38:
pushl $0
801073f3: 6a 00 push $0x0
pushl $38
801073f5: 6a 26 push $0x26
jmp alltraps
801073f7: e9 5e f8 ff ff jmp 80106c5a <alltraps>
801073fc <vector39>:
.globl vector39
vector39:
pushl $0
801073fc: 6a 00 push $0x0
pushl $39
801073fe: 6a 27 push $0x27
jmp alltraps
80107400: e9 55 f8 ff ff jmp 80106c5a <alltraps>
80107405 <vector40>:
.globl vector40
vector40:
pushl $0
80107405: 6a 00 push $0x0
pushl $40
80107407: 6a 28 push $0x28
jmp alltraps
80107409: e9 4c f8 ff ff jmp 80106c5a <alltraps>
8010740e <vector41>:
.globl vector41
vector41:
pushl $0
8010740e: 6a 00 push $0x0
pushl $41
80107410: 6a 29 push $0x29
jmp alltraps
80107412: e9 43 f8 ff ff jmp 80106c5a <alltraps>
80107417 <vector42>:
.globl vector42
vector42:
pushl $0
80107417: 6a 00 push $0x0
pushl $42
80107419: 6a 2a push $0x2a
jmp alltraps
8010741b: e9 3a f8 ff ff jmp 80106c5a <alltraps>
80107420 <vector43>:
.globl vector43
vector43:
pushl $0
80107420: 6a 00 push $0x0
pushl $43
80107422: 6a 2b push $0x2b
jmp alltraps
80107424: e9 31 f8 ff ff jmp 80106c5a <alltraps>
80107429 <vector44>:
.globl vector44
vector44:
pushl $0
80107429: 6a 00 push $0x0
pushl $44
8010742b: 6a 2c push $0x2c
jmp alltraps
8010742d: e9 28 f8 ff ff jmp 80106c5a <alltraps>
80107432 <vector45>:
.globl vector45
vector45:
pushl $0
80107432: 6a 00 push $0x0
pushl $45
80107434: 6a 2d push $0x2d
jmp alltraps
80107436: e9 1f f8 ff ff jmp 80106c5a <alltraps>
8010743b <vector46>:
.globl vector46
vector46:
pushl $0
8010743b: 6a 00 push $0x0
pushl $46
8010743d: 6a 2e push $0x2e
jmp alltraps
8010743f: e9 16 f8 ff ff jmp 80106c5a <alltraps>
80107444 <vector47>:
.globl vector47
vector47:
pushl $0
80107444: 6a 00 push $0x0
pushl $47
80107446: 6a 2f push $0x2f
jmp alltraps
80107448: e9 0d f8 ff ff jmp 80106c5a <alltraps>
8010744d <vector48>:
.globl vector48
vector48:
pushl $0
8010744d: 6a 00 push $0x0
pushl $48
8010744f: 6a 30 push $0x30
jmp alltraps
80107451: e9 04 f8 ff ff jmp 80106c5a <alltraps>
80107456 <vector49>:
.globl vector49
vector49:
pushl $0
80107456: 6a 00 push $0x0
pushl $49
80107458: 6a 31 push $0x31
jmp alltraps
8010745a: e9 fb f7 ff ff jmp 80106c5a <alltraps>
8010745f <vector50>:
.globl vector50
vector50:
pushl $0
8010745f: 6a 00 push $0x0
pushl $50
80107461: 6a 32 push $0x32
jmp alltraps
80107463: e9 f2 f7 ff ff jmp 80106c5a <alltraps>
80107468 <vector51>:
.globl vector51
vector51:
pushl $0
80107468: 6a 00 push $0x0
pushl $51
8010746a: 6a 33 push $0x33
jmp alltraps
8010746c: e9 e9 f7 ff ff jmp 80106c5a <alltraps>
80107471 <vector52>:
.globl vector52
vector52:
pushl $0
80107471: 6a 00 push $0x0
pushl $52
80107473: 6a 34 push $0x34
jmp alltraps
80107475: e9 e0 f7 ff ff jmp 80106c5a <alltraps>
8010747a <vector53>:
.globl vector53
vector53:
pushl $0
8010747a: 6a 00 push $0x0
pushl $53
8010747c: 6a 35 push $0x35
jmp alltraps
8010747e: e9 d7 f7 ff ff jmp 80106c5a <alltraps>
80107483 <vector54>:
.globl vector54
vector54:
pushl $0
80107483: 6a 00 push $0x0
pushl $54
80107485: 6a 36 push $0x36
jmp alltraps
80107487: e9 ce f7 ff ff jmp 80106c5a <alltraps>
8010748c <vector55>:
.globl vector55
vector55:
pushl $0
8010748c: 6a 00 push $0x0
pushl $55
8010748e: 6a 37 push $0x37
jmp alltraps
80107490: e9 c5 f7 ff ff jmp 80106c5a <alltraps>
80107495 <vector56>:
.globl vector56
vector56:
pushl $0
80107495: 6a 00 push $0x0
pushl $56
80107497: 6a 38 push $0x38
jmp alltraps
80107499: e9 bc f7 ff ff jmp 80106c5a <alltraps>
8010749e <vector57>:
.globl vector57
vector57:
pushl $0
8010749e: 6a 00 push $0x0
pushl $57
801074a0: 6a 39 push $0x39
jmp alltraps
801074a2: e9 b3 f7 ff ff jmp 80106c5a <alltraps>
801074a7 <vector58>:
.globl vector58
vector58:
pushl $0
801074a7: 6a 00 push $0x0
pushl $58
801074a9: 6a 3a push $0x3a
jmp alltraps
801074ab: e9 aa f7 ff ff jmp 80106c5a <alltraps>
801074b0 <vector59>:
.globl vector59
vector59:
pushl $0
801074b0: 6a 00 push $0x0
pushl $59
801074b2: 6a 3b push $0x3b
jmp alltraps
801074b4: e9 a1 f7 ff ff jmp 80106c5a <alltraps>
801074b9 <vector60>:
.globl vector60
vector60:
pushl $0
801074b9: 6a 00 push $0x0
pushl $60
801074bb: 6a 3c push $0x3c
jmp alltraps
801074bd: e9 98 f7 ff ff jmp 80106c5a <alltraps>
801074c2 <vector61>:
.globl vector61
vector61:
pushl $0
801074c2: 6a 00 push $0x0
pushl $61
801074c4: 6a 3d push $0x3d
jmp alltraps
801074c6: e9 8f f7 ff ff jmp 80106c5a <alltraps>
801074cb <vector62>:
.globl vector62
vector62:
pushl $0
801074cb: 6a 00 push $0x0
pushl $62
801074cd: 6a 3e push $0x3e
jmp alltraps
801074cf: e9 86 f7 ff ff jmp 80106c5a <alltraps>
801074d4 <vector63>:
.globl vector63
vector63:
pushl $0
801074d4: 6a 00 push $0x0
pushl $63
801074d6: 6a 3f push $0x3f
jmp alltraps
801074d8: e9 7d f7 ff ff jmp 80106c5a <alltraps>
801074dd <vector64>:
.globl vector64
vector64:
pushl $0
801074dd: 6a 00 push $0x0
pushl $64
801074df: 6a 40 push $0x40
jmp alltraps
801074e1: e9 74 f7 ff ff jmp 80106c5a <alltraps>
801074e6 <vector65>:
.globl vector65
vector65:
pushl $0
801074e6: 6a 00 push $0x0
pushl $65
801074e8: 6a 41 push $0x41
jmp alltraps
801074ea: e9 6b f7 ff ff jmp 80106c5a <alltraps>
801074ef <vector66>:
.globl vector66
vector66:
pushl $0
801074ef: 6a 00 push $0x0
pushl $66
801074f1: 6a 42 push $0x42
jmp alltraps
801074f3: e9 62 f7 ff ff jmp 80106c5a <alltraps>
801074f8 <vector67>:
.globl vector67
vector67:
pushl $0
801074f8: 6a 00 push $0x0
pushl $67
801074fa: 6a 43 push $0x43
jmp alltraps
801074fc: e9 59 f7 ff ff jmp 80106c5a <alltraps>
80107501 <vector68>:
.globl vector68
vector68:
pushl $0
80107501: 6a 00 push $0x0
pushl $68
80107503: 6a 44 push $0x44
jmp alltraps
80107505: e9 50 f7 ff ff jmp 80106c5a <alltraps>
8010750a <vector69>:
.globl vector69
vector69:
pushl $0
8010750a: 6a 00 push $0x0
pushl $69
8010750c: 6a 45 push $0x45
jmp alltraps
8010750e: e9 47 f7 ff ff jmp 80106c5a <alltraps>
80107513 <vector70>:
.globl vector70
vector70:
pushl $0
80107513: 6a 00 push $0x0
pushl $70
80107515: 6a 46 push $0x46
jmp alltraps
80107517: e9 3e f7 ff ff jmp 80106c5a <alltraps>
8010751c <vector71>:
.globl vector71
vector71:
pushl $0
8010751c: 6a 00 push $0x0
pushl $71
8010751e: 6a 47 push $0x47
jmp alltraps
80107520: e9 35 f7 ff ff jmp 80106c5a <alltraps>
80107525 <vector72>:
.globl vector72
vector72:
pushl $0
80107525: 6a 00 push $0x0
pushl $72
80107527: 6a 48 push $0x48
jmp alltraps
80107529: e9 2c f7 ff ff jmp 80106c5a <alltraps>
8010752e <vector73>:
.globl vector73
vector73:
pushl $0
8010752e: 6a 00 push $0x0
pushl $73
80107530: 6a 49 push $0x49
jmp alltraps
80107532: e9 23 f7 ff ff jmp 80106c5a <alltraps>
80107537 <vector74>:
.globl vector74
vector74:
pushl $0
80107537: 6a 00 push $0x0
pushl $74
80107539: 6a 4a push $0x4a
jmp alltraps
8010753b: e9 1a f7 ff ff jmp 80106c5a <alltraps>
80107540 <vector75>:
.globl vector75
vector75:
pushl $0
80107540: 6a 00 push $0x0
pushl $75
80107542: 6a 4b push $0x4b
jmp alltraps
80107544: e9 11 f7 ff ff jmp 80106c5a <alltraps>
80107549 <vector76>:
.globl vector76
vector76:
pushl $0
80107549: 6a 00 push $0x0
pushl $76
8010754b: 6a 4c push $0x4c
jmp alltraps
8010754d: e9 08 f7 ff ff jmp 80106c5a <alltraps>
80107552 <vector77>:
.globl vector77
vector77:
pushl $0
80107552: 6a 00 push $0x0
pushl $77
80107554: 6a 4d push $0x4d
jmp alltraps
80107556: e9 ff f6 ff ff jmp 80106c5a <alltraps>
8010755b <vector78>:
.globl vector78
vector78:
pushl $0
8010755b: 6a 00 push $0x0
pushl $78
8010755d: 6a 4e push $0x4e
jmp alltraps
8010755f: e9 f6 f6 ff ff jmp 80106c5a <alltraps>
80107564 <vector79>:
.globl vector79
vector79:
pushl $0
80107564: 6a 00 push $0x0
pushl $79
80107566: 6a 4f push $0x4f
jmp alltraps
80107568: e9 ed f6 ff ff jmp 80106c5a <alltraps>
8010756d <vector80>:
.globl vector80
vector80:
pushl $0
8010756d: 6a 00 push $0x0
pushl $80
8010756f: 6a 50 push $0x50
jmp alltraps
80107571: e9 e4 f6 ff ff jmp 80106c5a <alltraps>
80107576 <vector81>:
.globl vector81
vector81:
pushl $0
80107576: 6a 00 push $0x0
pushl $81
80107578: 6a 51 push $0x51
jmp alltraps
8010757a: e9 db f6 ff ff jmp 80106c5a <alltraps>
8010757f <vector82>:
.globl vector82
vector82:
pushl $0
8010757f: 6a 00 push $0x0
pushl $82
80107581: 6a 52 push $0x52
jmp alltraps
80107583: e9 d2 f6 ff ff jmp 80106c5a <alltraps>
80107588 <vector83>:
.globl vector83
vector83:
pushl $0
80107588: 6a 00 push $0x0
pushl $83
8010758a: 6a 53 push $0x53
jmp alltraps
8010758c: e9 c9 f6 ff ff jmp 80106c5a <alltraps>
80107591 <vector84>:
.globl vector84
vector84:
pushl $0
80107591: 6a 00 push $0x0
pushl $84
80107593: 6a 54 push $0x54
jmp alltraps
80107595: e9 c0 f6 ff ff jmp 80106c5a <alltraps>
8010759a <vector85>:
.globl vector85
vector85:
pushl $0
8010759a: 6a 00 push $0x0
pushl $85
8010759c: 6a 55 push $0x55
jmp alltraps
8010759e: e9 b7 f6 ff ff jmp 80106c5a <alltraps>
801075a3 <vector86>:
.globl vector86
vector86:
pushl $0
801075a3: 6a 00 push $0x0
pushl $86
801075a5: 6a 56 push $0x56
jmp alltraps
801075a7: e9 ae f6 ff ff jmp 80106c5a <alltraps>
801075ac <vector87>:
.globl vector87
vector87:
pushl $0
801075ac: 6a 00 push $0x0
pushl $87
801075ae: 6a 57 push $0x57
jmp alltraps
801075b0: e9 a5 f6 ff ff jmp 80106c5a <alltraps>
801075b5 <vector88>:
.globl vector88
vector88:
pushl $0
801075b5: 6a 00 push $0x0
pushl $88
801075b7: 6a 58 push $0x58
jmp alltraps
801075b9: e9 9c f6 ff ff jmp 80106c5a <alltraps>
801075be <vector89>:
.globl vector89
vector89:
pushl $0
801075be: 6a 00 push $0x0
pushl $89
801075c0: 6a 59 push $0x59
jmp alltraps
801075c2: e9 93 f6 ff ff jmp 80106c5a <alltraps>
801075c7 <vector90>:
.globl vector90
vector90:
pushl $0
801075c7: 6a 00 push $0x0
pushl $90
801075c9: 6a 5a push $0x5a
jmp alltraps
801075cb: e9 8a f6 ff ff jmp 80106c5a <alltraps>
801075d0 <vector91>:
.globl vector91
vector91:
pushl $0
801075d0: 6a 00 push $0x0
pushl $91
801075d2: 6a 5b push $0x5b
jmp alltraps
801075d4: e9 81 f6 ff ff jmp 80106c5a <alltraps>
801075d9 <vector92>:
.globl vector92
vector92:
pushl $0
801075d9: 6a 00 push $0x0
pushl $92
801075db: 6a 5c push $0x5c
jmp alltraps
801075dd: e9 78 f6 ff ff jmp 80106c5a <alltraps>
801075e2 <vector93>:
.globl vector93
vector93:
pushl $0
801075e2: 6a 00 push $0x0
pushl $93
801075e4: 6a 5d push $0x5d
jmp alltraps
801075e6: e9 6f f6 ff ff jmp 80106c5a <alltraps>
801075eb <vector94>:
.globl vector94
vector94:
pushl $0
801075eb: 6a 00 push $0x0
pushl $94
801075ed: 6a 5e push $0x5e
jmp alltraps
801075ef: e9 66 f6 ff ff jmp 80106c5a <alltraps>
801075f4 <vector95>:
.globl vector95
vector95:
pushl $0
801075f4: 6a 00 push $0x0
pushl $95
801075f6: 6a 5f push $0x5f
jmp alltraps
801075f8: e9 5d f6 ff ff jmp 80106c5a <alltraps>
801075fd <vector96>:
.globl vector96
vector96:
pushl $0
801075fd: 6a 00 push $0x0
pushl $96
801075ff: 6a 60 push $0x60
jmp alltraps
80107601: e9 54 f6 ff ff jmp 80106c5a <alltraps>
80107606 <vector97>:
.globl vector97
vector97:
pushl $0
80107606: 6a 00 push $0x0
pushl $97
80107608: 6a 61 push $0x61
jmp alltraps
8010760a: e9 4b f6 ff ff jmp 80106c5a <alltraps>
8010760f <vector98>:
.globl vector98
vector98:
pushl $0
8010760f: 6a 00 push $0x0
pushl $98
80107611: 6a 62 push $0x62
jmp alltraps
80107613: e9 42 f6 ff ff jmp 80106c5a <alltraps>
80107618 <vector99>:
.globl vector99
vector99:
pushl $0
80107618: 6a 00 push $0x0
pushl $99
8010761a: 6a 63 push $0x63
jmp alltraps
8010761c: e9 39 f6 ff ff jmp 80106c5a <alltraps>
80107621 <vector100>:
.globl vector100
vector100:
pushl $0
80107621: 6a 00 push $0x0
pushl $100
80107623: 6a 64 push $0x64
jmp alltraps
80107625: e9 30 f6 ff ff jmp 80106c5a <alltraps>
8010762a <vector101>:
.globl vector101
vector101:
pushl $0
8010762a: 6a 00 push $0x0
pushl $101
8010762c: 6a 65 push $0x65
jmp alltraps
8010762e: e9 27 f6 ff ff jmp 80106c5a <alltraps>
80107633 <vector102>:
.globl vector102
vector102:
pushl $0
80107633: 6a 00 push $0x0
pushl $102
80107635: 6a 66 push $0x66
jmp alltraps
80107637: e9 1e f6 ff ff jmp 80106c5a <alltraps>
8010763c <vector103>:
.globl vector103
vector103:
pushl $0
8010763c: 6a 00 push $0x0
pushl $103
8010763e: 6a 67 push $0x67
jmp alltraps
80107640: e9 15 f6 ff ff jmp 80106c5a <alltraps>
80107645 <vector104>:
.globl vector104
vector104:
pushl $0
80107645: 6a 00 push $0x0
pushl $104
80107647: 6a 68 push $0x68
jmp alltraps
80107649: e9 0c f6 ff ff jmp 80106c5a <alltraps>
8010764e <vector105>:
.globl vector105
vector105:
pushl $0
8010764e: 6a 00 push $0x0
pushl $105
80107650: 6a 69 push $0x69
jmp alltraps
80107652: e9 03 f6 ff ff jmp 80106c5a <alltraps>
80107657 <vector106>:
.globl vector106
vector106:
pushl $0
80107657: 6a 00 push $0x0
pushl $106
80107659: 6a 6a push $0x6a
jmp alltraps
8010765b: e9 fa f5 ff ff jmp 80106c5a <alltraps>
80107660 <vector107>:
.globl vector107
vector107:
pushl $0
80107660: 6a 00 push $0x0
pushl $107
80107662: 6a 6b push $0x6b
jmp alltraps
80107664: e9 f1 f5 ff ff jmp 80106c5a <alltraps>
80107669 <vector108>:
.globl vector108
vector108:
pushl $0
80107669: 6a 00 push $0x0
pushl $108
8010766b: 6a 6c push $0x6c
jmp alltraps
8010766d: e9 e8 f5 ff ff jmp 80106c5a <alltraps>
80107672 <vector109>:
.globl vector109
vector109:
pushl $0
80107672: 6a 00 push $0x0
pushl $109
80107674: 6a 6d push $0x6d
jmp alltraps
80107676: e9 df f5 ff ff jmp 80106c5a <alltraps>
8010767b <vector110>:
.globl vector110
vector110:
pushl $0
8010767b: 6a 00 push $0x0
pushl $110
8010767d: 6a 6e push $0x6e
jmp alltraps
8010767f: e9 d6 f5 ff ff jmp 80106c5a <alltraps>
80107684 <vector111>:
.globl vector111
vector111:
pushl $0
80107684: 6a 00 push $0x0
pushl $111
80107686: 6a 6f push $0x6f
jmp alltraps
80107688: e9 cd f5 ff ff jmp 80106c5a <alltraps>
8010768d <vector112>:
.globl vector112
vector112:
pushl $0
8010768d: 6a 00 push $0x0
pushl $112
8010768f: 6a 70 push $0x70
jmp alltraps
80107691: e9 c4 f5 ff ff jmp 80106c5a <alltraps>
80107696 <vector113>:
.globl vector113
vector113:
pushl $0
80107696: 6a 00 push $0x0
pushl $113
80107698: 6a 71 push $0x71
jmp alltraps
8010769a: e9 bb f5 ff ff jmp 80106c5a <alltraps>
8010769f <vector114>:
.globl vector114
vector114:
pushl $0
8010769f: 6a 00 push $0x0
pushl $114
801076a1: 6a 72 push $0x72
jmp alltraps
801076a3: e9 b2 f5 ff ff jmp 80106c5a <alltraps>
801076a8 <vector115>:
.globl vector115
vector115:
pushl $0
801076a8: 6a 00 push $0x0
pushl $115
801076aa: 6a 73 push $0x73
jmp alltraps
801076ac: e9 a9 f5 ff ff jmp 80106c5a <alltraps>
801076b1 <vector116>:
.globl vector116
vector116:
pushl $0
801076b1: 6a 00 push $0x0
pushl $116
801076b3: 6a 74 push $0x74
jmp alltraps
801076b5: e9 a0 f5 ff ff jmp 80106c5a <alltraps>
801076ba <vector117>:
.globl vector117
vector117:
pushl $0
801076ba: 6a 00 push $0x0
pushl $117
801076bc: 6a 75 push $0x75
jmp alltraps
801076be: e9 97 f5 ff ff jmp 80106c5a <alltraps>
801076c3 <vector118>:
.globl vector118
vector118:
pushl $0
801076c3: 6a 00 push $0x0
pushl $118
801076c5: 6a 76 push $0x76
jmp alltraps
801076c7: e9 8e f5 ff ff jmp 80106c5a <alltraps>
801076cc <vector119>:
.globl vector119
vector119:
pushl $0
801076cc: 6a 00 push $0x0
pushl $119
801076ce: 6a 77 push $0x77
jmp alltraps
801076d0: e9 85 f5 ff ff jmp 80106c5a <alltraps>
801076d5 <vector120>:
.globl vector120
vector120:
pushl $0
801076d5: 6a 00 push $0x0
pushl $120
801076d7: 6a 78 push $0x78
jmp alltraps
801076d9: e9 7c f5 ff ff jmp 80106c5a <alltraps>
801076de <vector121>:
.globl vector121
vector121:
pushl $0
801076de: 6a 00 push $0x0
pushl $121
801076e0: 6a 79 push $0x79
jmp alltraps
801076e2: e9 73 f5 ff ff jmp 80106c5a <alltraps>
801076e7 <vector122>:
.globl vector122
vector122:
pushl $0
801076e7: 6a 00 push $0x0
pushl $122
801076e9: 6a 7a push $0x7a
jmp alltraps
801076eb: e9 6a f5 ff ff jmp 80106c5a <alltraps>
801076f0 <vector123>:
.globl vector123
vector123:
pushl $0
801076f0: 6a 00 push $0x0
pushl $123
801076f2: 6a 7b push $0x7b
jmp alltraps
801076f4: e9 61 f5 ff ff jmp 80106c5a <alltraps>
801076f9 <vector124>:
.globl vector124
vector124:
pushl $0
801076f9: 6a 00 push $0x0
pushl $124
801076fb: 6a 7c push $0x7c
jmp alltraps
801076fd: e9 58 f5 ff ff jmp 80106c5a <alltraps>
80107702 <vector125>:
.globl vector125
vector125:
pushl $0
80107702: 6a 00 push $0x0
pushl $125
80107704: 6a 7d push $0x7d
jmp alltraps
80107706: e9 4f f5 ff ff jmp 80106c5a <alltraps>
8010770b <vector126>:
.globl vector126
vector126:
pushl $0
8010770b: 6a 00 push $0x0
pushl $126
8010770d: 6a 7e push $0x7e
jmp alltraps
8010770f: e9 46 f5 ff ff jmp 80106c5a <alltraps>
80107714 <vector127>:
.globl vector127
vector127:
pushl $0
80107714: 6a 00 push $0x0
pushl $127
80107716: 6a 7f push $0x7f
jmp alltraps
80107718: e9 3d f5 ff ff jmp 80106c5a <alltraps>
8010771d <vector128>:
.globl vector128
vector128:
pushl $0
8010771d: 6a 00 push $0x0
pushl $128
8010771f: 68 80 00 00 00 push $0x80
jmp alltraps
80107724: e9 31 f5 ff ff jmp 80106c5a <alltraps>
80107729 <vector129>:
.globl vector129
vector129:
pushl $0
80107729: 6a 00 push $0x0
pushl $129
8010772b: 68 81 00 00 00 push $0x81
jmp alltraps
80107730: e9 25 f5 ff ff jmp 80106c5a <alltraps>
80107735 <vector130>:
.globl vector130
vector130:
pushl $0
80107735: 6a 00 push $0x0
pushl $130
80107737: 68 82 00 00 00 push $0x82
jmp alltraps
8010773c: e9 19 f5 ff ff jmp 80106c5a <alltraps>
80107741 <vector131>:
.globl vector131
vector131:
pushl $0
80107741: 6a 00 push $0x0
pushl $131
80107743: 68 83 00 00 00 push $0x83
jmp alltraps
80107748: e9 0d f5 ff ff jmp 80106c5a <alltraps>
8010774d <vector132>:
.globl vector132
vector132:
pushl $0
8010774d: 6a 00 push $0x0
pushl $132
8010774f: 68 84 00 00 00 push $0x84
jmp alltraps
80107754: e9 01 f5 ff ff jmp 80106c5a <alltraps>
80107759 <vector133>:
.globl vector133
vector133:
pushl $0
80107759: 6a 00 push $0x0
pushl $133
8010775b: 68 85 00 00 00 push $0x85
jmp alltraps
80107760: e9 f5 f4 ff ff jmp 80106c5a <alltraps>
80107765 <vector134>:
.globl vector134
vector134:
pushl $0
80107765: 6a 00 push $0x0
pushl $134
80107767: 68 86 00 00 00 push $0x86
jmp alltraps
8010776c: e9 e9 f4 ff ff jmp 80106c5a <alltraps>
80107771 <vector135>:
.globl vector135
vector135:
pushl $0
80107771: 6a 00 push $0x0
pushl $135
80107773: 68 87 00 00 00 push $0x87
jmp alltraps
80107778: e9 dd f4 ff ff jmp 80106c5a <alltraps>
8010777d <vector136>:
.globl vector136
vector136:
pushl $0
8010777d: 6a 00 push $0x0
pushl $136
8010777f: 68 88 00 00 00 push $0x88
jmp alltraps
80107784: e9 d1 f4 ff ff jmp 80106c5a <alltraps>
80107789 <vector137>:
.globl vector137
vector137:
pushl $0
80107789: 6a 00 push $0x0
pushl $137
8010778b: 68 89 00 00 00 push $0x89
jmp alltraps
80107790: e9 c5 f4 ff ff jmp 80106c5a <alltraps>
80107795 <vector138>:
.globl vector138
vector138:
pushl $0
80107795: 6a 00 push $0x0
pushl $138
80107797: 68 8a 00 00 00 push $0x8a
jmp alltraps
8010779c: e9 b9 f4 ff ff jmp 80106c5a <alltraps>
801077a1 <vector139>:
.globl vector139
vector139:
pushl $0
801077a1: 6a 00 push $0x0
pushl $139
801077a3: 68 8b 00 00 00 push $0x8b
jmp alltraps
801077a8: e9 ad f4 ff ff jmp 80106c5a <alltraps>
801077ad <vector140>:
.globl vector140
vector140:
pushl $0
801077ad: 6a 00 push $0x0
pushl $140
801077af: 68 8c 00 00 00 push $0x8c
jmp alltraps
801077b4: e9 a1 f4 ff ff jmp 80106c5a <alltraps>
801077b9 <vector141>:
.globl vector141
vector141:
pushl $0
801077b9: 6a 00 push $0x0
pushl $141
801077bb: 68 8d 00 00 00 push $0x8d
jmp alltraps
801077c0: e9 95 f4 ff ff jmp 80106c5a <alltraps>
801077c5 <vector142>:
.globl vector142
vector142:
pushl $0
801077c5: 6a 00 push $0x0
pushl $142
801077c7: 68 8e 00 00 00 push $0x8e
jmp alltraps
801077cc: e9 89 f4 ff ff jmp 80106c5a <alltraps>
801077d1 <vector143>:
.globl vector143
vector143:
pushl $0
801077d1: 6a 00 push $0x0
pushl $143
801077d3: 68 8f 00 00 00 push $0x8f
jmp alltraps
801077d8: e9 7d f4 ff ff jmp 80106c5a <alltraps>
801077dd <vector144>:
.globl vector144
vector144:
pushl $0
801077dd: 6a 00 push $0x0
pushl $144
801077df: 68 90 00 00 00 push $0x90
jmp alltraps
801077e4: e9 71 f4 ff ff jmp 80106c5a <alltraps>
801077e9 <vector145>:
.globl vector145
vector145:
pushl $0
801077e9: 6a 00 push $0x0
pushl $145
801077eb: 68 91 00 00 00 push $0x91
jmp alltraps
801077f0: e9 65 f4 ff ff jmp 80106c5a <alltraps>
801077f5 <vector146>:
.globl vector146
vector146:
pushl $0
801077f5: 6a 00 push $0x0
pushl $146
801077f7: 68 92 00 00 00 push $0x92
jmp alltraps
801077fc: e9 59 f4 ff ff jmp 80106c5a <alltraps>
80107801 <vector147>:
.globl vector147
vector147:
pushl $0
80107801: 6a 00 push $0x0
pushl $147
80107803: 68 93 00 00 00 push $0x93
jmp alltraps
80107808: e9 4d f4 ff ff jmp 80106c5a <alltraps>
8010780d <vector148>:
.globl vector148
vector148:
pushl $0
8010780d: 6a 00 push $0x0
pushl $148
8010780f: 68 94 00 00 00 push $0x94
jmp alltraps
80107814: e9 41 f4 ff ff jmp 80106c5a <alltraps>
80107819 <vector149>:
.globl vector149
vector149:
pushl $0
80107819: 6a 00 push $0x0
pushl $149
8010781b: 68 95 00 00 00 push $0x95
jmp alltraps
80107820: e9 35 f4 ff ff jmp 80106c5a <alltraps>
80107825 <vector150>:
.globl vector150
vector150:
pushl $0
80107825: 6a 00 push $0x0
pushl $150
80107827: 68 96 00 00 00 push $0x96
jmp alltraps
8010782c: e9 29 f4 ff ff jmp 80106c5a <alltraps>
80107831 <vector151>:
.globl vector151
vector151:
pushl $0
80107831: 6a 00 push $0x0
pushl $151
80107833: 68 97 00 00 00 push $0x97
jmp alltraps
80107838: e9 1d f4 ff ff jmp 80106c5a <alltraps>
8010783d <vector152>:
.globl vector152
vector152:
pushl $0
8010783d: 6a 00 push $0x0
pushl $152
8010783f: 68 98 00 00 00 push $0x98
jmp alltraps
80107844: e9 11 f4 ff ff jmp 80106c5a <alltraps>
80107849 <vector153>:
.globl vector153
vector153:
pushl $0
80107849: 6a 00 push $0x0
pushl $153
8010784b: 68 99 00 00 00 push $0x99
jmp alltraps
80107850: e9 05 f4 ff ff jmp 80106c5a <alltraps>
80107855 <vector154>:
.globl vector154
vector154:
pushl $0
80107855: 6a 00 push $0x0
pushl $154
80107857: 68 9a 00 00 00 push $0x9a
jmp alltraps
8010785c: e9 f9 f3 ff ff jmp 80106c5a <alltraps>
80107861 <vector155>:
.globl vector155
vector155:
pushl $0
80107861: 6a 00 push $0x0
pushl $155
80107863: 68 9b 00 00 00 push $0x9b
jmp alltraps
80107868: e9 ed f3 ff ff jmp 80106c5a <alltraps>
8010786d <vector156>:
.globl vector156
vector156:
pushl $0
8010786d: 6a 00 push $0x0
pushl $156
8010786f: 68 9c 00 00 00 push $0x9c
jmp alltraps
80107874: e9 e1 f3 ff ff jmp 80106c5a <alltraps>
80107879 <vector157>:
.globl vector157
vector157:
pushl $0
80107879: 6a 00 push $0x0
pushl $157
8010787b: 68 9d 00 00 00 push $0x9d
jmp alltraps
80107880: e9 d5 f3 ff ff jmp 80106c5a <alltraps>
80107885 <vector158>:
.globl vector158
vector158:
pushl $0
80107885: 6a 00 push $0x0
pushl $158
80107887: 68 9e 00 00 00 push $0x9e
jmp alltraps
8010788c: e9 c9 f3 ff ff jmp 80106c5a <alltraps>
80107891 <vector159>:
.globl vector159
vector159:
pushl $0
80107891: 6a 00 push $0x0
pushl $159
80107893: 68 9f 00 00 00 push $0x9f
jmp alltraps
80107898: e9 bd f3 ff ff jmp 80106c5a <alltraps>
8010789d <vector160>:
.globl vector160
vector160:
pushl $0
8010789d: 6a 00 push $0x0
pushl $160
8010789f: 68 a0 00 00 00 push $0xa0
jmp alltraps
801078a4: e9 b1 f3 ff ff jmp 80106c5a <alltraps>
801078a9 <vector161>:
.globl vector161
vector161:
pushl $0
801078a9: 6a 00 push $0x0
pushl $161
801078ab: 68 a1 00 00 00 push $0xa1
jmp alltraps
801078b0: e9 a5 f3 ff ff jmp 80106c5a <alltraps>
801078b5 <vector162>:
.globl vector162
vector162:
pushl $0
801078b5: 6a 00 push $0x0
pushl $162
801078b7: 68 a2 00 00 00 push $0xa2
jmp alltraps
801078bc: e9 99 f3 ff ff jmp 80106c5a <alltraps>
801078c1 <vector163>:
.globl vector163
vector163:
pushl $0
801078c1: 6a 00 push $0x0
pushl $163
801078c3: 68 a3 00 00 00 push $0xa3
jmp alltraps
801078c8: e9 8d f3 ff ff jmp 80106c5a <alltraps>
801078cd <vector164>:
.globl vector164
vector164:
pushl $0
801078cd: 6a 00 push $0x0
pushl $164
801078cf: 68 a4 00 00 00 push $0xa4
jmp alltraps
801078d4: e9 81 f3 ff ff jmp 80106c5a <alltraps>
801078d9 <vector165>:
.globl vector165
vector165:
pushl $0
801078d9: 6a 00 push $0x0
pushl $165
801078db: 68 a5 00 00 00 push $0xa5
jmp alltraps
801078e0: e9 75 f3 ff ff jmp 80106c5a <alltraps>
801078e5 <vector166>:
.globl vector166
vector166:
pushl $0
801078e5: 6a 00 push $0x0
pushl $166
801078e7: 68 a6 00 00 00 push $0xa6
jmp alltraps
801078ec: e9 69 f3 ff ff jmp 80106c5a <alltraps>
801078f1 <vector167>:
.globl vector167
vector167:
pushl $0
801078f1: 6a 00 push $0x0
pushl $167
801078f3: 68 a7 00 00 00 push $0xa7
jmp alltraps
801078f8: e9 5d f3 ff ff jmp 80106c5a <alltraps>
801078fd <vector168>:
.globl vector168
vector168:
pushl $0
801078fd: 6a 00 push $0x0
pushl $168
801078ff: 68 a8 00 00 00 push $0xa8
jmp alltraps
80107904: e9 51 f3 ff ff jmp 80106c5a <alltraps>
80107909 <vector169>:
.globl vector169
vector169:
pushl $0
80107909: 6a 00 push $0x0
pushl $169
8010790b: 68 a9 00 00 00 push $0xa9
jmp alltraps
80107910: e9 45 f3 ff ff jmp 80106c5a <alltraps>
80107915 <vector170>:
.globl vector170
vector170:
pushl $0
80107915: 6a 00 push $0x0
pushl $170
80107917: 68 aa 00 00 00 push $0xaa
jmp alltraps
8010791c: e9 39 f3 ff ff jmp 80106c5a <alltraps>
80107921 <vector171>:
.globl vector171
vector171:
pushl $0
80107921: 6a 00 push $0x0
pushl $171
80107923: 68 ab 00 00 00 push $0xab
jmp alltraps
80107928: e9 2d f3 ff ff jmp 80106c5a <alltraps>
8010792d <vector172>:
.globl vector172
vector172:
pushl $0
8010792d: 6a 00 push $0x0
pushl $172
8010792f: 68 ac 00 00 00 push $0xac
jmp alltraps
80107934: e9 21 f3 ff ff jmp 80106c5a <alltraps>
80107939 <vector173>:
.globl vector173
vector173:
pushl $0
80107939: 6a 00 push $0x0
pushl $173
8010793b: 68 ad 00 00 00 push $0xad
jmp alltraps
80107940: e9 15 f3 ff ff jmp 80106c5a <alltraps>
80107945 <vector174>:
.globl vector174
vector174:
pushl $0
80107945: 6a 00 push $0x0
pushl $174
80107947: 68 ae 00 00 00 push $0xae
jmp alltraps
8010794c: e9 09 f3 ff ff jmp 80106c5a <alltraps>
80107951 <vector175>:
.globl vector175
vector175:
pushl $0
80107951: 6a 00 push $0x0
pushl $175
80107953: 68 af 00 00 00 push $0xaf
jmp alltraps
80107958: e9 fd f2 ff ff jmp 80106c5a <alltraps>
8010795d <vector176>:
.globl vector176
vector176:
pushl $0
8010795d: 6a 00 push $0x0
pushl $176
8010795f: 68 b0 00 00 00 push $0xb0
jmp alltraps
80107964: e9 f1 f2 ff ff jmp 80106c5a <alltraps>
80107969 <vector177>:
.globl vector177
vector177:
pushl $0
80107969: 6a 00 push $0x0
pushl $177
8010796b: 68 b1 00 00 00 push $0xb1
jmp alltraps
80107970: e9 e5 f2 ff ff jmp 80106c5a <alltraps>
80107975 <vector178>:
.globl vector178
vector178:
pushl $0
80107975: 6a 00 push $0x0
pushl $178
80107977: 68 b2 00 00 00 push $0xb2
jmp alltraps
8010797c: e9 d9 f2 ff ff jmp 80106c5a <alltraps>
80107981 <vector179>:
.globl vector179
vector179:
pushl $0
80107981: 6a 00 push $0x0
pushl $179
80107983: 68 b3 00 00 00 push $0xb3
jmp alltraps
80107988: e9 cd f2 ff ff jmp 80106c5a <alltraps>
8010798d <vector180>:
.globl vector180
vector180:
pushl $0
8010798d: 6a 00 push $0x0
pushl $180
8010798f: 68 b4 00 00 00 push $0xb4
jmp alltraps
80107994: e9 c1 f2 ff ff jmp 80106c5a <alltraps>
80107999 <vector181>:
.globl vector181
vector181:
pushl $0
80107999: 6a 00 push $0x0
pushl $181
8010799b: 68 b5 00 00 00 push $0xb5
jmp alltraps
801079a0: e9 b5 f2 ff ff jmp 80106c5a <alltraps>
801079a5 <vector182>:
.globl vector182
vector182:
pushl $0
801079a5: 6a 00 push $0x0
pushl $182
801079a7: 68 b6 00 00 00 push $0xb6
jmp alltraps
801079ac: e9 a9 f2 ff ff jmp 80106c5a <alltraps>
801079b1 <vector183>:
.globl vector183
vector183:
pushl $0
801079b1: 6a 00 push $0x0
pushl $183
801079b3: 68 b7 00 00 00 push $0xb7
jmp alltraps
801079b8: e9 9d f2 ff ff jmp 80106c5a <alltraps>
801079bd <vector184>:
.globl vector184
vector184:
pushl $0
801079bd: 6a 00 push $0x0
pushl $184
801079bf: 68 b8 00 00 00 push $0xb8
jmp alltraps
801079c4: e9 91 f2 ff ff jmp 80106c5a <alltraps>
801079c9 <vector185>:
.globl vector185
vector185:
pushl $0
801079c9: 6a 00 push $0x0
pushl $185
801079cb: 68 b9 00 00 00 push $0xb9
jmp alltraps
801079d0: e9 85 f2 ff ff jmp 80106c5a <alltraps>
801079d5 <vector186>:
.globl vector186
vector186:
pushl $0
801079d5: 6a 00 push $0x0
pushl $186
801079d7: 68 ba 00 00 00 push $0xba
jmp alltraps
801079dc: e9 79 f2 ff ff jmp 80106c5a <alltraps>
801079e1 <vector187>:
.globl vector187
vector187:
pushl $0
801079e1: 6a 00 push $0x0
pushl $187
801079e3: 68 bb 00 00 00 push $0xbb
jmp alltraps
801079e8: e9 6d f2 ff ff jmp 80106c5a <alltraps>
801079ed <vector188>:
.globl vector188
vector188:
pushl $0
801079ed: 6a 00 push $0x0
pushl $188
801079ef: 68 bc 00 00 00 push $0xbc
jmp alltraps
801079f4: e9 61 f2 ff ff jmp 80106c5a <alltraps>
801079f9 <vector189>:
.globl vector189
vector189:
pushl $0
801079f9: 6a 00 push $0x0
pushl $189
801079fb: 68 bd 00 00 00 push $0xbd
jmp alltraps
80107a00: e9 55 f2 ff ff jmp 80106c5a <alltraps>
80107a05 <vector190>:
.globl vector190
vector190:
pushl $0
80107a05: 6a 00 push $0x0
pushl $190
80107a07: 68 be 00 00 00 push $0xbe
jmp alltraps
80107a0c: e9 49 f2 ff ff jmp 80106c5a <alltraps>
80107a11 <vector191>:
.globl vector191
vector191:
pushl $0
80107a11: 6a 00 push $0x0
pushl $191
80107a13: 68 bf 00 00 00 push $0xbf
jmp alltraps
80107a18: e9 3d f2 ff ff jmp 80106c5a <alltraps>
80107a1d <vector192>:
.globl vector192
vector192:
pushl $0
80107a1d: 6a 00 push $0x0
pushl $192
80107a1f: 68 c0 00 00 00 push $0xc0
jmp alltraps
80107a24: e9 31 f2 ff ff jmp 80106c5a <alltraps>
80107a29 <vector193>:
.globl vector193
vector193:
pushl $0
80107a29: 6a 00 push $0x0
pushl $193
80107a2b: 68 c1 00 00 00 push $0xc1
jmp alltraps
80107a30: e9 25 f2 ff ff jmp 80106c5a <alltraps>
80107a35 <vector194>:
.globl vector194
vector194:
pushl $0
80107a35: 6a 00 push $0x0
pushl $194
80107a37: 68 c2 00 00 00 push $0xc2
jmp alltraps
80107a3c: e9 19 f2 ff ff jmp 80106c5a <alltraps>
80107a41 <vector195>:
.globl vector195
vector195:
pushl $0
80107a41: 6a 00 push $0x0
pushl $195
80107a43: 68 c3 00 00 00 push $0xc3
jmp alltraps
80107a48: e9 0d f2 ff ff jmp 80106c5a <alltraps>
80107a4d <vector196>:
.globl vector196
vector196:
pushl $0
80107a4d: 6a 00 push $0x0
pushl $196
80107a4f: 68 c4 00 00 00 push $0xc4
jmp alltraps
80107a54: e9 01 f2 ff ff jmp 80106c5a <alltraps>
80107a59 <vector197>:
.globl vector197
vector197:
pushl $0
80107a59: 6a 00 push $0x0
pushl $197
80107a5b: 68 c5 00 00 00 push $0xc5
jmp alltraps
80107a60: e9 f5 f1 ff ff jmp 80106c5a <alltraps>
80107a65 <vector198>:
.globl vector198
vector198:
pushl $0
80107a65: 6a 00 push $0x0
pushl $198
80107a67: 68 c6 00 00 00 push $0xc6
jmp alltraps
80107a6c: e9 e9 f1 ff ff jmp 80106c5a <alltraps>
80107a71 <vector199>:
.globl vector199
vector199:
pushl $0
80107a71: 6a 00 push $0x0
pushl $199
80107a73: 68 c7 00 00 00 push $0xc7
jmp alltraps
80107a78: e9 dd f1 ff ff jmp 80106c5a <alltraps>
80107a7d <vector200>:
.globl vector200
vector200:
pushl $0
80107a7d: 6a 00 push $0x0
pushl $200
80107a7f: 68 c8 00 00 00 push $0xc8
jmp alltraps
80107a84: e9 d1 f1 ff ff jmp 80106c5a <alltraps>
80107a89 <vector201>:
.globl vector201
vector201:
pushl $0
80107a89: 6a 00 push $0x0
pushl $201
80107a8b: 68 c9 00 00 00 push $0xc9
jmp alltraps
80107a90: e9 c5 f1 ff ff jmp 80106c5a <alltraps>
80107a95 <vector202>:
.globl vector202
vector202:
pushl $0
80107a95: 6a 00 push $0x0
pushl $202
80107a97: 68 ca 00 00 00 push $0xca
jmp alltraps
80107a9c: e9 b9 f1 ff ff jmp 80106c5a <alltraps>
80107aa1 <vector203>:
.globl vector203
vector203:
pushl $0
80107aa1: 6a 00 push $0x0
pushl $203
80107aa3: 68 cb 00 00 00 push $0xcb
jmp alltraps
80107aa8: e9 ad f1 ff ff jmp 80106c5a <alltraps>
80107aad <vector204>:
.globl vector204
vector204:
pushl $0
80107aad: 6a 00 push $0x0
pushl $204
80107aaf: 68 cc 00 00 00 push $0xcc
jmp alltraps
80107ab4: e9 a1 f1 ff ff jmp 80106c5a <alltraps>
80107ab9 <vector205>:
.globl vector205
vector205:
pushl $0
80107ab9: 6a 00 push $0x0
pushl $205
80107abb: 68 cd 00 00 00 push $0xcd
jmp alltraps
80107ac0: e9 95 f1 ff ff jmp 80106c5a <alltraps>
80107ac5 <vector206>:
.globl vector206
vector206:
pushl $0
80107ac5: 6a 00 push $0x0
pushl $206
80107ac7: 68 ce 00 00 00 push $0xce
jmp alltraps
80107acc: e9 89 f1 ff ff jmp 80106c5a <alltraps>
80107ad1 <vector207>:
.globl vector207
vector207:
pushl $0
80107ad1: 6a 00 push $0x0
pushl $207
80107ad3: 68 cf 00 00 00 push $0xcf
jmp alltraps
80107ad8: e9 7d f1 ff ff jmp 80106c5a <alltraps>
80107add <vector208>:
.globl vector208
vector208:
pushl $0
80107add: 6a 00 push $0x0
pushl $208
80107adf: 68 d0 00 00 00 push $0xd0
jmp alltraps
80107ae4: e9 71 f1 ff ff jmp 80106c5a <alltraps>
80107ae9 <vector209>:
.globl vector209
vector209:
pushl $0
80107ae9: 6a 00 push $0x0
pushl $209
80107aeb: 68 d1 00 00 00 push $0xd1
jmp alltraps
80107af0: e9 65 f1 ff ff jmp 80106c5a <alltraps>
80107af5 <vector210>:
.globl vector210
vector210:
pushl $0
80107af5: 6a 00 push $0x0
pushl $210
80107af7: 68 d2 00 00 00 push $0xd2
jmp alltraps
80107afc: e9 59 f1 ff ff jmp 80106c5a <alltraps>
80107b01 <vector211>:
.globl vector211
vector211:
pushl $0
80107b01: 6a 00 push $0x0
pushl $211
80107b03: 68 d3 00 00 00 push $0xd3
jmp alltraps
80107b08: e9 4d f1 ff ff jmp 80106c5a <alltraps>
80107b0d <vector212>:
.globl vector212
vector212:
pushl $0
80107b0d: 6a 00 push $0x0
pushl $212
80107b0f: 68 d4 00 00 00 push $0xd4
jmp alltraps
80107b14: e9 41 f1 ff ff jmp 80106c5a <alltraps>
80107b19 <vector213>:
.globl vector213
vector213:
pushl $0
80107b19: 6a 00 push $0x0
pushl $213
80107b1b: 68 d5 00 00 00 push $0xd5
jmp alltraps
80107b20: e9 35 f1 ff ff jmp 80106c5a <alltraps>
80107b25 <vector214>:
.globl vector214
vector214:
pushl $0
80107b25: 6a 00 push $0x0
pushl $214
80107b27: 68 d6 00 00 00 push $0xd6
jmp alltraps
80107b2c: e9 29 f1 ff ff jmp 80106c5a <alltraps>
80107b31 <vector215>:
.globl vector215
vector215:
pushl $0
80107b31: 6a 00 push $0x0
pushl $215
80107b33: 68 d7 00 00 00 push $0xd7
jmp alltraps
80107b38: e9 1d f1 ff ff jmp 80106c5a <alltraps>
80107b3d <vector216>:
.globl vector216
vector216:
pushl $0
80107b3d: 6a 00 push $0x0
pushl $216
80107b3f: 68 d8 00 00 00 push $0xd8
jmp alltraps
80107b44: e9 11 f1 ff ff jmp 80106c5a <alltraps>
80107b49 <vector217>:
.globl vector217
vector217:
pushl $0
80107b49: 6a 00 push $0x0
pushl $217
80107b4b: 68 d9 00 00 00 push $0xd9
jmp alltraps
80107b50: e9 05 f1 ff ff jmp 80106c5a <alltraps>
80107b55 <vector218>:
.globl vector218
vector218:
pushl $0
80107b55: 6a 00 push $0x0
pushl $218
80107b57: 68 da 00 00 00 push $0xda
jmp alltraps
80107b5c: e9 f9 f0 ff ff jmp 80106c5a <alltraps>
80107b61 <vector219>:
.globl vector219
vector219:
pushl $0
80107b61: 6a 00 push $0x0
pushl $219
80107b63: 68 db 00 00 00 push $0xdb
jmp alltraps
80107b68: e9 ed f0 ff ff jmp 80106c5a <alltraps>
80107b6d <vector220>:
.globl vector220
vector220:
pushl $0
80107b6d: 6a 00 push $0x0
pushl $220
80107b6f: 68 dc 00 00 00 push $0xdc
jmp alltraps
80107b74: e9 e1 f0 ff ff jmp 80106c5a <alltraps>
80107b79 <vector221>:
.globl vector221
vector221:
pushl $0
80107b79: 6a 00 push $0x0
pushl $221
80107b7b: 68 dd 00 00 00 push $0xdd
jmp alltraps
80107b80: e9 d5 f0 ff ff jmp 80106c5a <alltraps>
80107b85 <vector222>:
.globl vector222
vector222:
pushl $0
80107b85: 6a 00 push $0x0
pushl $222
80107b87: 68 de 00 00 00 push $0xde
jmp alltraps
80107b8c: e9 c9 f0 ff ff jmp 80106c5a <alltraps>
80107b91 <vector223>:
.globl vector223
vector223:
pushl $0
80107b91: 6a 00 push $0x0
pushl $223
80107b93: 68 df 00 00 00 push $0xdf
jmp alltraps
80107b98: e9 bd f0 ff ff jmp 80106c5a <alltraps>
80107b9d <vector224>:
.globl vector224
vector224:
pushl $0
80107b9d: 6a 00 push $0x0
pushl $224
80107b9f: 68 e0 00 00 00 push $0xe0
jmp alltraps
80107ba4: e9 b1 f0 ff ff jmp 80106c5a <alltraps>
80107ba9 <vector225>:
.globl vector225
vector225:
pushl $0
80107ba9: 6a 00 push $0x0
pushl $225
80107bab: 68 e1 00 00 00 push $0xe1
jmp alltraps
80107bb0: e9 a5 f0 ff ff jmp 80106c5a <alltraps>
80107bb5 <vector226>:
.globl vector226
vector226:
pushl $0
80107bb5: 6a 00 push $0x0
pushl $226
80107bb7: 68 e2 00 00 00 push $0xe2
jmp alltraps
80107bbc: e9 99 f0 ff ff jmp 80106c5a <alltraps>
80107bc1 <vector227>:
.globl vector227
vector227:
pushl $0
80107bc1: 6a 00 push $0x0
pushl $227
80107bc3: 68 e3 00 00 00 push $0xe3
jmp alltraps
80107bc8: e9 8d f0 ff ff jmp 80106c5a <alltraps>
80107bcd <vector228>:
.globl vector228
vector228:
pushl $0
80107bcd: 6a 00 push $0x0
pushl $228
80107bcf: 68 e4 00 00 00 push $0xe4
jmp alltraps
80107bd4: e9 81 f0 ff ff jmp 80106c5a <alltraps>
80107bd9 <vector229>:
.globl vector229
vector229:
pushl $0
80107bd9: 6a 00 push $0x0
pushl $229
80107bdb: 68 e5 00 00 00 push $0xe5
jmp alltraps
80107be0: e9 75 f0 ff ff jmp 80106c5a <alltraps>
80107be5 <vector230>:
.globl vector230
vector230:
pushl $0
80107be5: 6a 00 push $0x0
pushl $230
80107be7: 68 e6 00 00 00 push $0xe6
jmp alltraps
80107bec: e9 69 f0 ff ff jmp 80106c5a <alltraps>
80107bf1 <vector231>:
.globl vector231
vector231:
pushl $0
80107bf1: 6a 00 push $0x0
pushl $231
80107bf3: 68 e7 00 00 00 push $0xe7
jmp alltraps
80107bf8: e9 5d f0 ff ff jmp 80106c5a <alltraps>
80107bfd <vector232>:
.globl vector232
vector232:
pushl $0
80107bfd: 6a 00 push $0x0
pushl $232
80107bff: 68 e8 00 00 00 push $0xe8
jmp alltraps
80107c04: e9 51 f0 ff ff jmp 80106c5a <alltraps>
80107c09 <vector233>:
.globl vector233
vector233:
pushl $0
80107c09: 6a 00 push $0x0
pushl $233
80107c0b: 68 e9 00 00 00 push $0xe9
jmp alltraps
80107c10: e9 45 f0 ff ff jmp 80106c5a <alltraps>
80107c15 <vector234>:
.globl vector234
vector234:
pushl $0
80107c15: 6a 00 push $0x0
pushl $234
80107c17: 68 ea 00 00 00 push $0xea
jmp alltraps
80107c1c: e9 39 f0 ff ff jmp 80106c5a <alltraps>
80107c21 <vector235>:
.globl vector235
vector235:
pushl $0
80107c21: 6a 00 push $0x0
pushl $235
80107c23: 68 eb 00 00 00 push $0xeb
jmp alltraps
80107c28: e9 2d f0 ff ff jmp 80106c5a <alltraps>
80107c2d <vector236>:
.globl vector236
vector236:
pushl $0
80107c2d: 6a 00 push $0x0
pushl $236
80107c2f: 68 ec 00 00 00 push $0xec
jmp alltraps
80107c34: e9 21 f0 ff ff jmp 80106c5a <alltraps>
80107c39 <vector237>:
.globl vector237
vector237:
pushl $0
80107c39: 6a 00 push $0x0
pushl $237
80107c3b: 68 ed 00 00 00 push $0xed
jmp alltraps
80107c40: e9 15 f0 ff ff jmp 80106c5a <alltraps>
80107c45 <vector238>:
.globl vector238
vector238:
pushl $0
80107c45: 6a 00 push $0x0
pushl $238
80107c47: 68 ee 00 00 00 push $0xee
jmp alltraps
80107c4c: e9 09 f0 ff ff jmp 80106c5a <alltraps>
80107c51 <vector239>:
.globl vector239
vector239:
pushl $0
80107c51: 6a 00 push $0x0
pushl $239
80107c53: 68 ef 00 00 00 push $0xef
jmp alltraps
80107c58: e9 fd ef ff ff jmp 80106c5a <alltraps>
80107c5d <vector240>:
.globl vector240
vector240:
pushl $0
80107c5d: 6a 00 push $0x0
pushl $240
80107c5f: 68 f0 00 00 00 push $0xf0
jmp alltraps
80107c64: e9 f1 ef ff ff jmp 80106c5a <alltraps>
80107c69 <vector241>:
.globl vector241
vector241:
pushl $0
80107c69: 6a 00 push $0x0
pushl $241
80107c6b: 68 f1 00 00 00 push $0xf1
jmp alltraps
80107c70: e9 e5 ef ff ff jmp 80106c5a <alltraps>
80107c75 <vector242>:
.globl vector242
vector242:
pushl $0
80107c75: 6a 00 push $0x0
pushl $242
80107c77: 68 f2 00 00 00 push $0xf2
jmp alltraps
80107c7c: e9 d9 ef ff ff jmp 80106c5a <alltraps>
80107c81 <vector243>:
.globl vector243
vector243:
pushl $0
80107c81: 6a 00 push $0x0
pushl $243
80107c83: 68 f3 00 00 00 push $0xf3
jmp alltraps
80107c88: e9 cd ef ff ff jmp 80106c5a <alltraps>
80107c8d <vector244>:
.globl vector244
vector244:
pushl $0
80107c8d: 6a 00 push $0x0
pushl $244
80107c8f: 68 f4 00 00 00 push $0xf4
jmp alltraps
80107c94: e9 c1 ef ff ff jmp 80106c5a <alltraps>
80107c99 <vector245>:
.globl vector245
vector245:
pushl $0
80107c99: 6a 00 push $0x0
pushl $245
80107c9b: 68 f5 00 00 00 push $0xf5
jmp alltraps
80107ca0: e9 b5 ef ff ff jmp 80106c5a <alltraps>
80107ca5 <vector246>:
.globl vector246
vector246:
pushl $0
80107ca5: 6a 00 push $0x0
pushl $246
80107ca7: 68 f6 00 00 00 push $0xf6
jmp alltraps
80107cac: e9 a9 ef ff ff jmp 80106c5a <alltraps>
80107cb1 <vector247>:
.globl vector247
vector247:
pushl $0
80107cb1: 6a 00 push $0x0
pushl $247
80107cb3: 68 f7 00 00 00 push $0xf7
jmp alltraps
80107cb8: e9 9d ef ff ff jmp 80106c5a <alltraps>
80107cbd <vector248>:
.globl vector248
vector248:
pushl $0
80107cbd: 6a 00 push $0x0
pushl $248
80107cbf: 68 f8 00 00 00 push $0xf8
jmp alltraps
80107cc4: e9 91 ef ff ff jmp 80106c5a <alltraps>
80107cc9 <vector249>:
.globl vector249
vector249:
pushl $0
80107cc9: 6a 00 push $0x0
pushl $249
80107ccb: 68 f9 00 00 00 push $0xf9
jmp alltraps
80107cd0: e9 85 ef ff ff jmp 80106c5a <alltraps>
80107cd5 <vector250>:
.globl vector250
vector250:
pushl $0
80107cd5: 6a 00 push $0x0
pushl $250
80107cd7: 68 fa 00 00 00 push $0xfa
jmp alltraps
80107cdc: e9 79 ef ff ff jmp 80106c5a <alltraps>
80107ce1 <vector251>:
.globl vector251
vector251:
pushl $0
80107ce1: 6a 00 push $0x0
pushl $251
80107ce3: 68 fb 00 00 00 push $0xfb
jmp alltraps
80107ce8: e9 6d ef ff ff jmp 80106c5a <alltraps>
80107ced <vector252>:
.globl vector252
vector252:
pushl $0
80107ced: 6a 00 push $0x0
pushl $252
80107cef: 68 fc 00 00 00 push $0xfc
jmp alltraps
80107cf4: e9 61 ef ff ff jmp 80106c5a <alltraps>
80107cf9 <vector253>:
.globl vector253
vector253:
pushl $0
80107cf9: 6a 00 push $0x0
pushl $253
80107cfb: 68 fd 00 00 00 push $0xfd
jmp alltraps
80107d00: e9 55 ef ff ff jmp 80106c5a <alltraps>
80107d05 <vector254>:
.globl vector254
vector254:
pushl $0
80107d05: 6a 00 push $0x0
pushl $254
80107d07: 68 fe 00 00 00 push $0xfe
jmp alltraps
80107d0c: e9 49 ef ff ff jmp 80106c5a <alltraps>
80107d11 <vector255>:
.globl vector255
vector255:
pushl $0
80107d11: 6a 00 push $0x0
pushl $255
80107d13: 68 ff 00 00 00 push $0xff
jmp alltraps
80107d18: e9 3d ef ff ff jmp 80106c5a <alltraps>
80107d1d <lgdt>:
struct segdesc;
static inline void
lgdt(struct segdesc *p, int size)
{
80107d1d: 55 push %ebp
80107d1e: 89 e5 mov %esp,%ebp
80107d20: 83 ec 10 sub $0x10,%esp
volatile ushort pd[3];
pd[0] = size-1;
80107d23: 8b 45 0c mov 0xc(%ebp),%eax
80107d26: 83 e8 01 sub $0x1,%eax
80107d29: 66 89 45 fa mov %ax,-0x6(%ebp)
pd[1] = (uint)p;
80107d2d: 8b 45 08 mov 0x8(%ebp),%eax
80107d30: 66 89 45 fc mov %ax,-0x4(%ebp)
pd[2] = (uint)p >> 16;
80107d34: 8b 45 08 mov 0x8(%ebp),%eax
80107d37: c1 e8 10 shr $0x10,%eax
80107d3a: 66 89 45 fe mov %ax,-0x2(%ebp)
asm volatile("lgdt (%0)" : : "r" (pd));
80107d3e: 8d 45 fa lea -0x6(%ebp),%eax
80107d41: 0f 01 10 lgdtl (%eax)
}
80107d44: 90 nop
80107d45: c9 leave
80107d46: c3 ret
80107d47 <ltr>:
asm volatile("lidt (%0)" : : "r" (pd));
}
static inline void
ltr(ushort sel)
{
80107d47: 55 push %ebp
80107d48: 89 e5 mov %esp,%ebp
80107d4a: 83 ec 04 sub $0x4,%esp
80107d4d: 8b 45 08 mov 0x8(%ebp),%eax
80107d50: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("ltr %0" : : "r" (sel));
80107d54: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80107d58: 0f 00 d8 ltr %ax
}
80107d5b: 90 nop
80107d5c: c9 leave
80107d5d: c3 ret
80107d5e <loadgs>:
return eflags;
}
static inline void
loadgs(ushort v)
{
80107d5e: 55 push %ebp
80107d5f: 89 e5 mov %esp,%ebp
80107d61: 83 ec 04 sub $0x4,%esp
80107d64: 8b 45 08 mov 0x8(%ebp),%eax
80107d67: 66 89 45 fc mov %ax,-0x4(%ebp)
asm volatile("movw %0, %%gs" : : "r" (v));
80107d6b: 0f b7 45 fc movzwl -0x4(%ebp),%eax
80107d6f: 8e e8 mov %eax,%gs
}
80107d71: 90 nop
80107d72: c9 leave
80107d73: c3 ret
80107d74 <lcr3>:
return val;
}
static inline void
lcr3(uint val)
{
80107d74: 55 push %ebp
80107d75: 89 e5 mov %esp,%ebp
asm volatile("movl %0,%%cr3" : : "r" (val));
80107d77: 8b 45 08 mov 0x8(%ebp),%eax
80107d7a: 0f 22 d8 mov %eax,%cr3
}
80107d7d: 90 nop
80107d7e: 5d pop %ebp
80107d7f: c3 ret
80107d80 <v2p>:
#define KERNBASE 0x80000000 // First kernel virtual address
#define KERNLINK (KERNBASE+EXTMEM) // Address where kernel is linked
#ifndef __ASSEMBLER__
static inline uint v2p(void *a) { return ((uint) (a)) - KERNBASE; }
80107d80: 55 push %ebp
80107d81: 89 e5 mov %esp,%ebp
80107d83: 8b 45 08 mov 0x8(%ebp),%eax
80107d86: 05 00 00 00 80 add $0x80000000,%eax
80107d8b: 5d pop %ebp
80107d8c: c3 ret
80107d8d <p2v>:
static inline void *p2v(uint a) { return (void *) ((a) + KERNBASE); }
80107d8d: 55 push %ebp
80107d8e: 89 e5 mov %esp,%ebp
80107d90: 8b 45 08 mov 0x8(%ebp),%eax
80107d93: 05 00 00 00 80 add $0x80000000,%eax
80107d98: 5d pop %ebp
80107d99: c3 ret
80107d9a <seginit>:
// Set up CPU's kernel segment descriptors.
// Run once on entry on each CPU.
void
seginit(void)
{
80107d9a: 55 push %ebp
80107d9b: 89 e5 mov %esp,%ebp
80107d9d: 53 push %ebx
80107d9e: 83 ec 14 sub $0x14,%esp
// Map "logical" addresses to virtual addresses using identity map.
// Cannot share a CODE descriptor for both kernel and user
// because it would have to have DPL_USR, but the CPU forbids
// an interrupt from CPL=0 to DPL=3.
c = &cpus[cpunum()];
80107da1: e8 26 b2 ff ff call 80102fcc <cpunum>
80107da6: 69 c0 bc 00 00 00 imul $0xbc,%eax,%eax
80107dac: 05 60 33 11 80 add $0x80113360,%eax
80107db1: 89 45 f4 mov %eax,-0xc(%ebp)
c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, 0);
80107db4: 8b 45 f4 mov -0xc(%ebp),%eax
80107db7: 66 c7 40 78 ff ff movw $0xffff,0x78(%eax)
80107dbd: 8b 45 f4 mov -0xc(%ebp),%eax
80107dc0: 66 c7 40 7a 00 00 movw $0x0,0x7a(%eax)
80107dc6: 8b 45 f4 mov -0xc(%ebp),%eax
80107dc9: c6 40 7c 00 movb $0x0,0x7c(%eax)
80107dcd: 8b 45 f4 mov -0xc(%ebp),%eax
80107dd0: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107dd4: 83 e2 f0 and $0xfffffff0,%edx
80107dd7: 83 ca 0a or $0xa,%edx
80107dda: 88 50 7d mov %dl,0x7d(%eax)
80107ddd: 8b 45 f4 mov -0xc(%ebp),%eax
80107de0: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107de4: 83 ca 10 or $0x10,%edx
80107de7: 88 50 7d mov %dl,0x7d(%eax)
80107dea: 8b 45 f4 mov -0xc(%ebp),%eax
80107ded: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107df1: 83 e2 9f and $0xffffff9f,%edx
80107df4: 88 50 7d mov %dl,0x7d(%eax)
80107df7: 8b 45 f4 mov -0xc(%ebp),%eax
80107dfa: 0f b6 50 7d movzbl 0x7d(%eax),%edx
80107dfe: 83 ca 80 or $0xffffff80,%edx
80107e01: 88 50 7d mov %dl,0x7d(%eax)
80107e04: 8b 45 f4 mov -0xc(%ebp),%eax
80107e07: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107e0b: 83 ca 0f or $0xf,%edx
80107e0e: 88 50 7e mov %dl,0x7e(%eax)
80107e11: 8b 45 f4 mov -0xc(%ebp),%eax
80107e14: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107e18: 83 e2 ef and $0xffffffef,%edx
80107e1b: 88 50 7e mov %dl,0x7e(%eax)
80107e1e: 8b 45 f4 mov -0xc(%ebp),%eax
80107e21: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107e25: 83 e2 df and $0xffffffdf,%edx
80107e28: 88 50 7e mov %dl,0x7e(%eax)
80107e2b: 8b 45 f4 mov -0xc(%ebp),%eax
80107e2e: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107e32: 83 ca 40 or $0x40,%edx
80107e35: 88 50 7e mov %dl,0x7e(%eax)
80107e38: 8b 45 f4 mov -0xc(%ebp),%eax
80107e3b: 0f b6 50 7e movzbl 0x7e(%eax),%edx
80107e3f: 83 ca 80 or $0xffffff80,%edx
80107e42: 88 50 7e mov %dl,0x7e(%eax)
80107e45: 8b 45 f4 mov -0xc(%ebp),%eax
80107e48: c6 40 7f 00 movb $0x0,0x7f(%eax)
c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
80107e4c: 8b 45 f4 mov -0xc(%ebp),%eax
80107e4f: 66 c7 80 80 00 00 00 movw $0xffff,0x80(%eax)
80107e56: ff ff
80107e58: 8b 45 f4 mov -0xc(%ebp),%eax
80107e5b: 66 c7 80 82 00 00 00 movw $0x0,0x82(%eax)
80107e62: 00 00
80107e64: 8b 45 f4 mov -0xc(%ebp),%eax
80107e67: c6 80 84 00 00 00 00 movb $0x0,0x84(%eax)
80107e6e: 8b 45 f4 mov -0xc(%ebp),%eax
80107e71: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107e78: 83 e2 f0 and $0xfffffff0,%edx
80107e7b: 83 ca 02 or $0x2,%edx
80107e7e: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107e84: 8b 45 f4 mov -0xc(%ebp),%eax
80107e87: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107e8e: 83 ca 10 or $0x10,%edx
80107e91: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107e97: 8b 45 f4 mov -0xc(%ebp),%eax
80107e9a: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107ea1: 83 e2 9f and $0xffffff9f,%edx
80107ea4: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107eaa: 8b 45 f4 mov -0xc(%ebp),%eax
80107ead: 0f b6 90 85 00 00 00 movzbl 0x85(%eax),%edx
80107eb4: 83 ca 80 or $0xffffff80,%edx
80107eb7: 88 90 85 00 00 00 mov %dl,0x85(%eax)
80107ebd: 8b 45 f4 mov -0xc(%ebp),%eax
80107ec0: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107ec7: 83 ca 0f or $0xf,%edx
80107eca: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107ed0: 8b 45 f4 mov -0xc(%ebp),%eax
80107ed3: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107eda: 83 e2 ef and $0xffffffef,%edx
80107edd: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107ee3: 8b 45 f4 mov -0xc(%ebp),%eax
80107ee6: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107eed: 83 e2 df and $0xffffffdf,%edx
80107ef0: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107ef6: 8b 45 f4 mov -0xc(%ebp),%eax
80107ef9: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107f00: 83 ca 40 or $0x40,%edx
80107f03: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107f09: 8b 45 f4 mov -0xc(%ebp),%eax
80107f0c: 0f b6 90 86 00 00 00 movzbl 0x86(%eax),%edx
80107f13: 83 ca 80 or $0xffffff80,%edx
80107f16: 88 90 86 00 00 00 mov %dl,0x86(%eax)
80107f1c: 8b 45 f4 mov -0xc(%ebp),%eax
80107f1f: c6 80 87 00 00 00 00 movb $0x0,0x87(%eax)
c->gdt[SEG_UCODE] = SEG(STA_X|STA_R, 0, 0xffffffff, DPL_USER);
80107f26: 8b 45 f4 mov -0xc(%ebp),%eax
80107f29: 66 c7 80 90 00 00 00 movw $0xffff,0x90(%eax)
80107f30: ff ff
80107f32: 8b 45 f4 mov -0xc(%ebp),%eax
80107f35: 66 c7 80 92 00 00 00 movw $0x0,0x92(%eax)
80107f3c: 00 00
80107f3e: 8b 45 f4 mov -0xc(%ebp),%eax
80107f41: c6 80 94 00 00 00 00 movb $0x0,0x94(%eax)
80107f48: 8b 45 f4 mov -0xc(%ebp),%eax
80107f4b: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107f52: 83 e2 f0 and $0xfffffff0,%edx
80107f55: 83 ca 0a or $0xa,%edx
80107f58: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107f5e: 8b 45 f4 mov -0xc(%ebp),%eax
80107f61: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107f68: 83 ca 10 or $0x10,%edx
80107f6b: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107f71: 8b 45 f4 mov -0xc(%ebp),%eax
80107f74: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107f7b: 83 ca 60 or $0x60,%edx
80107f7e: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107f84: 8b 45 f4 mov -0xc(%ebp),%eax
80107f87: 0f b6 90 95 00 00 00 movzbl 0x95(%eax),%edx
80107f8e: 83 ca 80 or $0xffffff80,%edx
80107f91: 88 90 95 00 00 00 mov %dl,0x95(%eax)
80107f97: 8b 45 f4 mov -0xc(%ebp),%eax
80107f9a: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107fa1: 83 ca 0f or $0xf,%edx
80107fa4: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107faa: 8b 45 f4 mov -0xc(%ebp),%eax
80107fad: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107fb4: 83 e2 ef and $0xffffffef,%edx
80107fb7: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107fbd: 8b 45 f4 mov -0xc(%ebp),%eax
80107fc0: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107fc7: 83 e2 df and $0xffffffdf,%edx
80107fca: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107fd0: 8b 45 f4 mov -0xc(%ebp),%eax
80107fd3: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107fda: 83 ca 40 or $0x40,%edx
80107fdd: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107fe3: 8b 45 f4 mov -0xc(%ebp),%eax
80107fe6: 0f b6 90 96 00 00 00 movzbl 0x96(%eax),%edx
80107fed: 83 ca 80 or $0xffffff80,%edx
80107ff0: 88 90 96 00 00 00 mov %dl,0x96(%eax)
80107ff6: 8b 45 f4 mov -0xc(%ebp),%eax
80107ff9: c6 80 97 00 00 00 00 movb $0x0,0x97(%eax)
c->gdt[SEG_UDATA] = SEG(STA_W, 0, 0xffffffff, DPL_USER);
80108000: 8b 45 f4 mov -0xc(%ebp),%eax
80108003: 66 c7 80 98 00 00 00 movw $0xffff,0x98(%eax)
8010800a: ff ff
8010800c: 8b 45 f4 mov -0xc(%ebp),%eax
8010800f: 66 c7 80 9a 00 00 00 movw $0x0,0x9a(%eax)
80108016: 00 00
80108018: 8b 45 f4 mov -0xc(%ebp),%eax
8010801b: c6 80 9c 00 00 00 00 movb $0x0,0x9c(%eax)
80108022: 8b 45 f4 mov -0xc(%ebp),%eax
80108025: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
8010802c: 83 e2 f0 and $0xfffffff0,%edx
8010802f: 83 ca 02 or $0x2,%edx
80108032: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80108038: 8b 45 f4 mov -0xc(%ebp),%eax
8010803b: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80108042: 83 ca 10 or $0x10,%edx
80108045: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
8010804b: 8b 45 f4 mov -0xc(%ebp),%eax
8010804e: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80108055: 83 ca 60 or $0x60,%edx
80108058: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
8010805e: 8b 45 f4 mov -0xc(%ebp),%eax
80108061: 0f b6 90 9d 00 00 00 movzbl 0x9d(%eax),%edx
80108068: 83 ca 80 or $0xffffff80,%edx
8010806b: 88 90 9d 00 00 00 mov %dl,0x9d(%eax)
80108071: 8b 45 f4 mov -0xc(%ebp),%eax
80108074: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
8010807b: 83 ca 0f or $0xf,%edx
8010807e: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80108084: 8b 45 f4 mov -0xc(%ebp),%eax
80108087: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
8010808e: 83 e2 ef and $0xffffffef,%edx
80108091: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
80108097: 8b 45 f4 mov -0xc(%ebp),%eax
8010809a: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801080a1: 83 e2 df and $0xffffffdf,%edx
801080a4: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
801080aa: 8b 45 f4 mov -0xc(%ebp),%eax
801080ad: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801080b4: 83 ca 40 or $0x40,%edx
801080b7: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
801080bd: 8b 45 f4 mov -0xc(%ebp),%eax
801080c0: 0f b6 90 9e 00 00 00 movzbl 0x9e(%eax),%edx
801080c7: 83 ca 80 or $0xffffff80,%edx
801080ca: 88 90 9e 00 00 00 mov %dl,0x9e(%eax)
801080d0: 8b 45 f4 mov -0xc(%ebp),%eax
801080d3: c6 80 9f 00 00 00 00 movb $0x0,0x9f(%eax)
// Map cpu, and curproc
c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
801080da: 8b 45 f4 mov -0xc(%ebp),%eax
801080dd: 05 b4 00 00 00 add $0xb4,%eax
801080e2: 89 c3 mov %eax,%ebx
801080e4: 8b 45 f4 mov -0xc(%ebp),%eax
801080e7: 05 b4 00 00 00 add $0xb4,%eax
801080ec: c1 e8 10 shr $0x10,%eax
801080ef: 89 c2 mov %eax,%edx
801080f1: 8b 45 f4 mov -0xc(%ebp),%eax
801080f4: 05 b4 00 00 00 add $0xb4,%eax
801080f9: c1 e8 18 shr $0x18,%eax
801080fc: 89 c1 mov %eax,%ecx
801080fe: 8b 45 f4 mov -0xc(%ebp),%eax
80108101: 66 c7 80 88 00 00 00 movw $0x0,0x88(%eax)
80108108: 00 00
8010810a: 8b 45 f4 mov -0xc(%ebp),%eax
8010810d: 66 89 98 8a 00 00 00 mov %bx,0x8a(%eax)
80108114: 8b 45 f4 mov -0xc(%ebp),%eax
80108117: 88 90 8c 00 00 00 mov %dl,0x8c(%eax)
8010811d: 8b 45 f4 mov -0xc(%ebp),%eax
80108120: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx
80108127: 83 e2 f0 and $0xfffffff0,%edx
8010812a: 83 ca 02 or $0x2,%edx
8010812d: 88 90 8d 00 00 00 mov %dl,0x8d(%eax)
80108133: 8b 45 f4 mov -0xc(%ebp),%eax
80108136: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx
8010813d: 83 ca 10 or $0x10,%edx
80108140: 88 90 8d 00 00 00 mov %dl,0x8d(%eax)
80108146: 8b 45 f4 mov -0xc(%ebp),%eax
80108149: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx
80108150: 83 e2 9f and $0xffffff9f,%edx
80108153: 88 90 8d 00 00 00 mov %dl,0x8d(%eax)
80108159: 8b 45 f4 mov -0xc(%ebp),%eax
8010815c: 0f b6 90 8d 00 00 00 movzbl 0x8d(%eax),%edx
80108163: 83 ca 80 or $0xffffff80,%edx
80108166: 88 90 8d 00 00 00 mov %dl,0x8d(%eax)
8010816c: 8b 45 f4 mov -0xc(%ebp),%eax
8010816f: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx
80108176: 83 e2 f0 and $0xfffffff0,%edx
80108179: 88 90 8e 00 00 00 mov %dl,0x8e(%eax)
8010817f: 8b 45 f4 mov -0xc(%ebp),%eax
80108182: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx
80108189: 83 e2 ef and $0xffffffef,%edx
8010818c: 88 90 8e 00 00 00 mov %dl,0x8e(%eax)
80108192: 8b 45 f4 mov -0xc(%ebp),%eax
80108195: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx
8010819c: 83 e2 df and $0xffffffdf,%edx
8010819f: 88 90 8e 00 00 00 mov %dl,0x8e(%eax)
801081a5: 8b 45 f4 mov -0xc(%ebp),%eax
801081a8: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx
801081af: 83 ca 40 or $0x40,%edx
801081b2: 88 90 8e 00 00 00 mov %dl,0x8e(%eax)
801081b8: 8b 45 f4 mov -0xc(%ebp),%eax
801081bb: 0f b6 90 8e 00 00 00 movzbl 0x8e(%eax),%edx
801081c2: 83 ca 80 or $0xffffff80,%edx
801081c5: 88 90 8e 00 00 00 mov %dl,0x8e(%eax)
801081cb: 8b 45 f4 mov -0xc(%ebp),%eax
801081ce: 88 88 8f 00 00 00 mov %cl,0x8f(%eax)
lgdt(c->gdt, sizeof(c->gdt));
801081d4: 8b 45 f4 mov -0xc(%ebp),%eax
801081d7: 83 c0 70 add $0x70,%eax
801081da: 83 ec 08 sub $0x8,%esp
801081dd: 6a 38 push $0x38
801081df: 50 push %eax
801081e0: e8 38 fb ff ff call 80107d1d <lgdt>
801081e5: 83 c4 10 add $0x10,%esp
loadgs(SEG_KCPU << 3);
801081e8: 83 ec 0c sub $0xc,%esp
801081eb: 6a 18 push $0x18
801081ed: e8 6c fb ff ff call 80107d5e <loadgs>
801081f2: 83 c4 10 add $0x10,%esp
// Initialize cpu-local storage.
cpu = c;
801081f5: 8b 45 f4 mov -0xc(%ebp),%eax
801081f8: 65 a3 00 00 00 00 mov %eax,%gs:0x0
proc = 0;
801081fe: 65 c7 05 04 00 00 00 movl $0x0,%gs:0x4
80108205: 00 00 00 00
}
80108209: 90 nop
8010820a: 8b 5d fc mov -0x4(%ebp),%ebx
8010820d: c9 leave
8010820e: c3 ret
8010820f <walkpgdir>:
// Return the address of the PTE in page table pgdir
// that corresponds to virtual address va. If alloc!=0,
// create any required page table pages.
static pte_t *
walkpgdir(pde_t *pgdir, const void *va, int alloc)
{
8010820f: 55 push %ebp
80108210: 89 e5 mov %esp,%ebp
80108212: 83 ec 18 sub $0x18,%esp
pde_t *pde;
pte_t *pgtab;
pde = &pgdir[PDX(va)];
80108215: 8b 45 0c mov 0xc(%ebp),%eax
80108218: c1 e8 16 shr $0x16,%eax
8010821b: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
80108222: 8b 45 08 mov 0x8(%ebp),%eax
80108225: 01 d0 add %edx,%eax
80108227: 89 45 f0 mov %eax,-0x10(%ebp)
if(*pde & PTE_P){
8010822a: 8b 45 f0 mov -0x10(%ebp),%eax
8010822d: 8b 00 mov (%eax),%eax
8010822f: 83 e0 01 and $0x1,%eax
80108232: 85 c0 test %eax,%eax
80108234: 74 18 je 8010824e <walkpgdir+0x3f>
pgtab = (pte_t*)p2v(PTE_ADDR(*pde));
80108236: 8b 45 f0 mov -0x10(%ebp),%eax
80108239: 8b 00 mov (%eax),%eax
8010823b: 25 00 f0 ff ff and $0xfffff000,%eax
80108240: 50 push %eax
80108241: e8 47 fb ff ff call 80107d8d <p2v>
80108246: 83 c4 04 add $0x4,%esp
80108249: 89 45 f4 mov %eax,-0xc(%ebp)
8010824c: eb 48 jmp 80108296 <walkpgdir+0x87>
} else {
if(!alloc || (pgtab = (pte_t*)kalloc()) == 0)
8010824e: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
80108252: 74 0e je 80108262 <walkpgdir+0x53>
80108254: e8 0d aa ff ff call 80102c66 <kalloc>
80108259: 89 45 f4 mov %eax,-0xc(%ebp)
8010825c: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
80108260: 75 07 jne 80108269 <walkpgdir+0x5a>
return 0;
80108262: b8 00 00 00 00 mov $0x0,%eax
80108267: eb 44 jmp 801082ad <walkpgdir+0x9e>
// Make sure all those PTE_P bits are zero.
memset(pgtab, 0, PGSIZE);
80108269: 83 ec 04 sub $0x4,%esp
8010826c: 68 00 10 00 00 push $0x1000
80108271: 6a 00 push $0x0
80108273: ff 75 f4 pushl -0xc(%ebp)
80108276: e8 25 d6 ff ff call 801058a0 <memset>
8010827b: 83 c4 10 add $0x10,%esp
// The permissions here are overly generous, but they can
// be further restricted by the permissions in the page table
// entries, if necessary.
*pde = v2p(pgtab) | PTE_P | PTE_W | PTE_U;
8010827e: 83 ec 0c sub $0xc,%esp
80108281: ff 75 f4 pushl -0xc(%ebp)
80108284: e8 f7 fa ff ff call 80107d80 <v2p>
80108289: 83 c4 10 add $0x10,%esp
8010828c: 83 c8 07 or $0x7,%eax
8010828f: 89 c2 mov %eax,%edx
80108291: 8b 45 f0 mov -0x10(%ebp),%eax
80108294: 89 10 mov %edx,(%eax)
}
return &pgtab[PTX(va)];
80108296: 8b 45 0c mov 0xc(%ebp),%eax
80108299: c1 e8 0c shr $0xc,%eax
8010829c: 25 ff 03 00 00 and $0x3ff,%eax
801082a1: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
801082a8: 8b 45 f4 mov -0xc(%ebp),%eax
801082ab: 01 d0 add %edx,%eax
}
801082ad: c9 leave
801082ae: c3 ret
801082af <mappages>:
// Create PTEs for virtual addresses starting at va that refer to
// physical addresses starting at pa. va and size might not
// be page-aligned.
static int
mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm)
{
801082af: 55 push %ebp
801082b0: 89 e5 mov %esp,%ebp
801082b2: 83 ec 18 sub $0x18,%esp
char *a, *last;
pte_t *pte;
a = (char*)PGROUNDDOWN((uint)va);
801082b5: 8b 45 0c mov 0xc(%ebp),%eax
801082b8: 25 00 f0 ff ff and $0xfffff000,%eax
801082bd: 89 45 f4 mov %eax,-0xc(%ebp)
last = (char*)PGROUNDDOWN(((uint)va) + size - 1);
801082c0: 8b 55 0c mov 0xc(%ebp),%edx
801082c3: 8b 45 10 mov 0x10(%ebp),%eax
801082c6: 01 d0 add %edx,%eax
801082c8: 83 e8 01 sub $0x1,%eax
801082cb: 25 00 f0 ff ff and $0xfffff000,%eax
801082d0: 89 45 f0 mov %eax,-0x10(%ebp)
for(;;){
if((pte = walkpgdir(pgdir, a, 1)) == 0)
801082d3: 83 ec 04 sub $0x4,%esp
801082d6: 6a 01 push $0x1
801082d8: ff 75 f4 pushl -0xc(%ebp)
801082db: ff 75 08 pushl 0x8(%ebp)
801082de: e8 2c ff ff ff call 8010820f <walkpgdir>
801082e3: 83 c4 10 add $0x10,%esp
801082e6: 89 45 ec mov %eax,-0x14(%ebp)
801082e9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
801082ed: 75 07 jne 801082f6 <mappages+0x47>
return -1;
801082ef: b8 ff ff ff ff mov $0xffffffff,%eax
801082f4: eb 47 jmp 8010833d <mappages+0x8e>
if(*pte & PTE_P)
801082f6: 8b 45 ec mov -0x14(%ebp),%eax
801082f9: 8b 00 mov (%eax),%eax
801082fb: 83 e0 01 and $0x1,%eax
801082fe: 85 c0 test %eax,%eax
80108300: 74 0d je 8010830f <mappages+0x60>
panic("remap");
80108302: 83 ec 0c sub $0xc,%esp
80108305: 68 2c 92 10 80 push $0x8010922c
8010830a: e8 57 82 ff ff call 80100566 <panic>
*pte = pa | perm | PTE_P;
8010830f: 8b 45 18 mov 0x18(%ebp),%eax
80108312: 0b 45 14 or 0x14(%ebp),%eax
80108315: 83 c8 01 or $0x1,%eax
80108318: 89 c2 mov %eax,%edx
8010831a: 8b 45 ec mov -0x14(%ebp),%eax
8010831d: 89 10 mov %edx,(%eax)
if(a == last)
8010831f: 8b 45 f4 mov -0xc(%ebp),%eax
80108322: 3b 45 f0 cmp -0x10(%ebp),%eax
80108325: 74 10 je 80108337 <mappages+0x88>
break;
a += PGSIZE;
80108327: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
pa += PGSIZE;
8010832e: 81 45 14 00 10 00 00 addl $0x1000,0x14(%ebp)
}
80108335: eb 9c jmp 801082d3 <mappages+0x24>
return -1;
if(*pte & PTE_P)
panic("remap");
*pte = pa | perm | PTE_P;
if(a == last)
break;
80108337: 90 nop
a += PGSIZE;
pa += PGSIZE;
}
return 0;
80108338: b8 00 00 00 00 mov $0x0,%eax
}
8010833d: c9 leave
8010833e: c3 ret
8010833f <setupkvm>:
};
// Set up kernel part of a page table.
pde_t*
setupkvm(void)
{
8010833f: 55 push %ebp
80108340: 89 e5 mov %esp,%ebp
80108342: 53 push %ebx
80108343: 83 ec 14 sub $0x14,%esp
pde_t *pgdir;
struct kmap *k;
if((pgdir = (pde_t*)kalloc()) == 0)
80108346: e8 1b a9 ff ff call 80102c66 <kalloc>
8010834b: 89 45 f0 mov %eax,-0x10(%ebp)
8010834e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80108352: 75 0a jne 8010835e <setupkvm+0x1f>
return 0;
80108354: b8 00 00 00 00 mov $0x0,%eax
80108359: e9 8e 00 00 00 jmp 801083ec <setupkvm+0xad>
memset(pgdir, 0, PGSIZE);
8010835e: 83 ec 04 sub $0x4,%esp
80108361: 68 00 10 00 00 push $0x1000
80108366: 6a 00 push $0x0
80108368: ff 75 f0 pushl -0x10(%ebp)
8010836b: e8 30 d5 ff ff call 801058a0 <memset>
80108370: 83 c4 10 add $0x10,%esp
if (p2v(PHYSTOP) > (void*)DEVSPACE)
80108373: 83 ec 0c sub $0xc,%esp
80108376: 68 00 00 00 0e push $0xe000000
8010837b: e8 0d fa ff ff call 80107d8d <p2v>
80108380: 83 c4 10 add $0x10,%esp
80108383: 3d 00 00 00 fe cmp $0xfe000000,%eax
80108388: 76 0d jbe 80108397 <setupkvm+0x58>
panic("PHYSTOP too high");
8010838a: 83 ec 0c sub $0xc,%esp
8010838d: 68 32 92 10 80 push $0x80109232
80108392: e8 cf 81 ff ff call 80100566 <panic>
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
80108397: c7 45 f4 a0 c4 10 80 movl $0x8010c4a0,-0xc(%ebp)
8010839e: eb 40 jmp 801083e0 <setupkvm+0xa1>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
801083a0: 8b 45 f4 mov -0xc(%ebp),%eax
801083a3: 8b 48 0c mov 0xc(%eax),%ecx
(uint)k->phys_start, k->perm) < 0)
801083a6: 8b 45 f4 mov -0xc(%ebp),%eax
801083a9: 8b 50 04 mov 0x4(%eax),%edx
return 0;
memset(pgdir, 0, PGSIZE);
if (p2v(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
801083ac: 8b 45 f4 mov -0xc(%ebp),%eax
801083af: 8b 58 08 mov 0x8(%eax),%ebx
801083b2: 8b 45 f4 mov -0xc(%ebp),%eax
801083b5: 8b 40 04 mov 0x4(%eax),%eax
801083b8: 29 c3 sub %eax,%ebx
801083ba: 8b 45 f4 mov -0xc(%ebp),%eax
801083bd: 8b 00 mov (%eax),%eax
801083bf: 83 ec 0c sub $0xc,%esp
801083c2: 51 push %ecx
801083c3: 52 push %edx
801083c4: 53 push %ebx
801083c5: 50 push %eax
801083c6: ff 75 f0 pushl -0x10(%ebp)
801083c9: e8 e1 fe ff ff call 801082af <mappages>
801083ce: 83 c4 20 add $0x20,%esp
801083d1: 85 c0 test %eax,%eax
801083d3: 79 07 jns 801083dc <setupkvm+0x9d>
(uint)k->phys_start, k->perm) < 0)
return 0;
801083d5: b8 00 00 00 00 mov $0x0,%eax
801083da: eb 10 jmp 801083ec <setupkvm+0xad>
if((pgdir = (pde_t*)kalloc()) == 0)
return 0;
memset(pgdir, 0, PGSIZE);
if (p2v(PHYSTOP) > (void*)DEVSPACE)
panic("PHYSTOP too high");
for(k = kmap; k < &kmap[NELEM(kmap)]; k++)
801083dc: 83 45 f4 10 addl $0x10,-0xc(%ebp)
801083e0: 81 7d f4 e0 c4 10 80 cmpl $0x8010c4e0,-0xc(%ebp)
801083e7: 72 b7 jb 801083a0 <setupkvm+0x61>
if(mappages(pgdir, k->virt, k->phys_end - k->phys_start,
(uint)k->phys_start, k->perm) < 0)
return 0;
return pgdir;
801083e9: 8b 45 f0 mov -0x10(%ebp),%eax
}
801083ec: 8b 5d fc mov -0x4(%ebp),%ebx
801083ef: c9 leave
801083f0: c3 ret
801083f1 <kvmalloc>:
// Allocate one page table for the machine for the kernel address
// space for scheduler processes.
void
kvmalloc(void)
{
801083f1: 55 push %ebp
801083f2: 89 e5 mov %esp,%ebp
801083f4: 83 ec 08 sub $0x8,%esp
kpgdir = setupkvm();
801083f7: e8 43 ff ff ff call 8010833f <setupkvm>
801083fc: a3 38 63 11 80 mov %eax,0x80116338
switchkvm();
80108401: e8 03 00 00 00 call 80108409 <switchkvm>
}
80108406: 90 nop
80108407: c9 leave
80108408: c3 ret
80108409 <switchkvm>:
// Switch h/w page table register to the kernel-only page table,
// for when no process is running.
void
switchkvm(void)
{
80108409: 55 push %ebp
8010840a: 89 e5 mov %esp,%ebp
lcr3(v2p(kpgdir)); // switch to the kernel page table
8010840c: a1 38 63 11 80 mov 0x80116338,%eax
80108411: 50 push %eax
80108412: e8 69 f9 ff ff call 80107d80 <v2p>
80108417: 83 c4 04 add $0x4,%esp
8010841a: 50 push %eax
8010841b: e8 54 f9 ff ff call 80107d74 <lcr3>
80108420: 83 c4 04 add $0x4,%esp
}
80108423: 90 nop
80108424: c9 leave
80108425: c3 ret
80108426 <switchuvm>:
// Switch TSS and h/w page table to correspond to process p.
void
switchuvm(struct proc *p)
{
80108426: 55 push %ebp
80108427: 89 e5 mov %esp,%ebp
80108429: 56 push %esi
8010842a: 53 push %ebx
pushcli();
8010842b: e8 6a d3 ff ff call 8010579a <pushcli>
cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
80108430: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80108436: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
8010843d: 83 c2 08 add $0x8,%edx
80108440: 89 d6 mov %edx,%esi
80108442: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80108449: 83 c2 08 add $0x8,%edx
8010844c: c1 ea 10 shr $0x10,%edx
8010844f: 89 d3 mov %edx,%ebx
80108451: 65 8b 15 00 00 00 00 mov %gs:0x0,%edx
80108458: 83 c2 08 add $0x8,%edx
8010845b: c1 ea 18 shr $0x18,%edx
8010845e: 89 d1 mov %edx,%ecx
80108460: 66 c7 80 a0 00 00 00 movw $0x67,0xa0(%eax)
80108467: 67 00
80108469: 66 89 b0 a2 00 00 00 mov %si,0xa2(%eax)
80108470: 88 98 a4 00 00 00 mov %bl,0xa4(%eax)
80108476: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
8010847d: 83 e2 f0 and $0xfffffff0,%edx
80108480: 83 ca 09 or $0x9,%edx
80108483: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
80108489: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
80108490: 83 ca 10 or $0x10,%edx
80108493: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
80108499: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
801084a0: 83 e2 9f and $0xffffff9f,%edx
801084a3: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
801084a9: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
801084b0: 83 ca 80 or $0xffffff80,%edx
801084b3: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
801084b9: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx
801084c0: 83 e2 f0 and $0xfffffff0,%edx
801084c3: 88 90 a6 00 00 00 mov %dl,0xa6(%eax)
801084c9: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx
801084d0: 83 e2 ef and $0xffffffef,%edx
801084d3: 88 90 a6 00 00 00 mov %dl,0xa6(%eax)
801084d9: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx
801084e0: 83 e2 df and $0xffffffdf,%edx
801084e3: 88 90 a6 00 00 00 mov %dl,0xa6(%eax)
801084e9: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx
801084f0: 83 ca 40 or $0x40,%edx
801084f3: 88 90 a6 00 00 00 mov %dl,0xa6(%eax)
801084f9: 0f b6 90 a6 00 00 00 movzbl 0xa6(%eax),%edx
80108500: 83 e2 7f and $0x7f,%edx
80108503: 88 90 a6 00 00 00 mov %dl,0xa6(%eax)
80108509: 88 88 a7 00 00 00 mov %cl,0xa7(%eax)
cpu->gdt[SEG_TSS].s = 0;
8010850f: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80108515: 0f b6 90 a5 00 00 00 movzbl 0xa5(%eax),%edx
8010851c: 83 e2 ef and $0xffffffef,%edx
8010851f: 88 90 a5 00 00 00 mov %dl,0xa5(%eax)
cpu->ts.ss0 = SEG_KDATA << 3;
80108525: 65 a1 00 00 00 00 mov %gs:0x0,%eax
8010852b: 66 c7 40 10 10 00 movw $0x10,0x10(%eax)
cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
80108531: 65 a1 00 00 00 00 mov %gs:0x0,%eax
80108537: 65 8b 15 04 00 00 00 mov %gs:0x4,%edx
8010853e: 8b 52 08 mov 0x8(%edx),%edx
80108541: 81 c2 00 10 00 00 add $0x1000,%edx
80108547: 89 50 0c mov %edx,0xc(%eax)
ltr(SEG_TSS << 3);
8010854a: 83 ec 0c sub $0xc,%esp
8010854d: 6a 30 push $0x30
8010854f: e8 f3 f7 ff ff call 80107d47 <ltr>
80108554: 83 c4 10 add $0x10,%esp
if(p->pgdir == 0)
80108557: 8b 45 08 mov 0x8(%ebp),%eax
8010855a: 8b 40 04 mov 0x4(%eax),%eax
8010855d: 85 c0 test %eax,%eax
8010855f: 75 0d jne 8010856e <switchuvm+0x148>
panic("switchuvm: no pgdir");
80108561: 83 ec 0c sub $0xc,%esp
80108564: 68 43 92 10 80 push $0x80109243
80108569: e8 f8 7f ff ff call 80100566 <panic>
lcr3(v2p(p->pgdir)); // switch to new address space
8010856e: 8b 45 08 mov 0x8(%ebp),%eax
80108571: 8b 40 04 mov 0x4(%eax),%eax
80108574: 83 ec 0c sub $0xc,%esp
80108577: 50 push %eax
80108578: e8 03 f8 ff ff call 80107d80 <v2p>
8010857d: 83 c4 10 add $0x10,%esp
80108580: 83 ec 0c sub $0xc,%esp
80108583: 50 push %eax
80108584: e8 eb f7 ff ff call 80107d74 <lcr3>
80108589: 83 c4 10 add $0x10,%esp
popcli();
8010858c: e8 4e d2 ff ff call 801057df <popcli>
}
80108591: 90 nop
80108592: 8d 65 f8 lea -0x8(%ebp),%esp
80108595: 5b pop %ebx
80108596: 5e pop %esi
80108597: 5d pop %ebp
80108598: c3 ret
80108599 <inituvm>:
// Load the initcode into address 0 of pgdir.
// sz must be less than a page.
void
inituvm(pde_t *pgdir, char *init, uint sz)
{
80108599: 55 push %ebp
8010859a: 89 e5 mov %esp,%ebp
8010859c: 83 ec 18 sub $0x18,%esp
char *mem;
if(sz >= PGSIZE)
8010859f: 81 7d 10 ff 0f 00 00 cmpl $0xfff,0x10(%ebp)
801085a6: 76 0d jbe 801085b5 <inituvm+0x1c>
panic("inituvm: more than a page");
801085a8: 83 ec 0c sub $0xc,%esp
801085ab: 68 57 92 10 80 push $0x80109257
801085b0: e8 b1 7f ff ff call 80100566 <panic>
mem = kalloc();
801085b5: e8 ac a6 ff ff call 80102c66 <kalloc>
801085ba: 89 45 f4 mov %eax,-0xc(%ebp)
memset(mem, 0, PGSIZE);
801085bd: 83 ec 04 sub $0x4,%esp
801085c0: 68 00 10 00 00 push $0x1000
801085c5: 6a 00 push $0x0
801085c7: ff 75 f4 pushl -0xc(%ebp)
801085ca: e8 d1 d2 ff ff call 801058a0 <memset>
801085cf: 83 c4 10 add $0x10,%esp
mappages(pgdir, 0, PGSIZE, v2p(mem), PTE_W|PTE_U);
801085d2: 83 ec 0c sub $0xc,%esp
801085d5: ff 75 f4 pushl -0xc(%ebp)
801085d8: e8 a3 f7 ff ff call 80107d80 <v2p>
801085dd: 83 c4 10 add $0x10,%esp
801085e0: 83 ec 0c sub $0xc,%esp
801085e3: 6a 06 push $0x6
801085e5: 50 push %eax
801085e6: 68 00 10 00 00 push $0x1000
801085eb: 6a 00 push $0x0
801085ed: ff 75 08 pushl 0x8(%ebp)
801085f0: e8 ba fc ff ff call 801082af <mappages>
801085f5: 83 c4 20 add $0x20,%esp
memmove(mem, init, sz);
801085f8: 83 ec 04 sub $0x4,%esp
801085fb: ff 75 10 pushl 0x10(%ebp)
801085fe: ff 75 0c pushl 0xc(%ebp)
80108601: ff 75 f4 pushl -0xc(%ebp)
80108604: e8 56 d3 ff ff call 8010595f <memmove>
80108609: 83 c4 10 add $0x10,%esp
}
8010860c: 90 nop
8010860d: c9 leave
8010860e: c3 ret
8010860f <loaduvm>:
// Load a program segment into pgdir. addr must be page-aligned
// and the pages from addr to addr+sz must already be mapped.
int
loaduvm(pde_t *pgdir, char *addr, struct inode *ip, uint offset, uint sz)
{
8010860f: 55 push %ebp
80108610: 89 e5 mov %esp,%ebp
80108612: 53 push %ebx
80108613: 83 ec 14 sub $0x14,%esp
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
80108616: 8b 45 0c mov 0xc(%ebp),%eax
80108619: 25 ff 0f 00 00 and $0xfff,%eax
8010861e: 85 c0 test %eax,%eax
80108620: 74 0d je 8010862f <loaduvm+0x20>
panic("loaduvm: addr must be page aligned");
80108622: 83 ec 0c sub $0xc,%esp
80108625: 68 74 92 10 80 push $0x80109274
8010862a: e8 37 7f ff ff call 80100566 <panic>
for(i = 0; i < sz; i += PGSIZE){
8010862f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80108636: e9 95 00 00 00 jmp 801086d0 <loaduvm+0xc1>
if((pte = walkpgdir(pgdir, addr+i, 0)) == 0)
8010863b: 8b 55 0c mov 0xc(%ebp),%edx
8010863e: 8b 45 f4 mov -0xc(%ebp),%eax
80108641: 01 d0 add %edx,%eax
80108643: 83 ec 04 sub $0x4,%esp
80108646: 6a 00 push $0x0
80108648: 50 push %eax
80108649: ff 75 08 pushl 0x8(%ebp)
8010864c: e8 be fb ff ff call 8010820f <walkpgdir>
80108651: 83 c4 10 add $0x10,%esp
80108654: 89 45 ec mov %eax,-0x14(%ebp)
80108657: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
8010865b: 75 0d jne 8010866a <loaduvm+0x5b>
panic("loaduvm: address should exist");
8010865d: 83 ec 0c sub $0xc,%esp
80108660: 68 97 92 10 80 push $0x80109297
80108665: e8 fc 7e ff ff call 80100566 <panic>
pa = PTE_ADDR(*pte);
8010866a: 8b 45 ec mov -0x14(%ebp),%eax
8010866d: 8b 00 mov (%eax),%eax
8010866f: 25 00 f0 ff ff and $0xfffff000,%eax
80108674: 89 45 e8 mov %eax,-0x18(%ebp)
if(sz - i < PGSIZE)
80108677: 8b 45 18 mov 0x18(%ebp),%eax
8010867a: 2b 45 f4 sub -0xc(%ebp),%eax
8010867d: 3d ff 0f 00 00 cmp $0xfff,%eax
80108682: 77 0b ja 8010868f <loaduvm+0x80>
n = sz - i;
80108684: 8b 45 18 mov 0x18(%ebp),%eax
80108687: 2b 45 f4 sub -0xc(%ebp),%eax
8010868a: 89 45 f0 mov %eax,-0x10(%ebp)
8010868d: eb 07 jmp 80108696 <loaduvm+0x87>
else
n = PGSIZE;
8010868f: c7 45 f0 00 10 00 00 movl $0x1000,-0x10(%ebp)
if(readi(ip, p2v(pa), offset+i, n) != n)
80108696: 8b 55 14 mov 0x14(%ebp),%edx
80108699: 8b 45 f4 mov -0xc(%ebp),%eax
8010869c: 8d 1c 02 lea (%edx,%eax,1),%ebx
8010869f: 83 ec 0c sub $0xc,%esp
801086a2: ff 75 e8 pushl -0x18(%ebp)
801086a5: e8 e3 f6 ff ff call 80107d8d <p2v>
801086aa: 83 c4 10 add $0x10,%esp
801086ad: ff 75 f0 pushl -0x10(%ebp)
801086b0: 53 push %ebx
801086b1: 50 push %eax
801086b2: ff 75 10 pushl 0x10(%ebp)
801086b5: e8 1e 98 ff ff call 80101ed8 <readi>
801086ba: 83 c4 10 add $0x10,%esp
801086bd: 3b 45 f0 cmp -0x10(%ebp),%eax
801086c0: 74 07 je 801086c9 <loaduvm+0xba>
return -1;
801086c2: b8 ff ff ff ff mov $0xffffffff,%eax
801086c7: eb 18 jmp 801086e1 <loaduvm+0xd2>
uint i, pa, n;
pte_t *pte;
if((uint) addr % PGSIZE != 0)
panic("loaduvm: addr must be page aligned");
for(i = 0; i < sz; i += PGSIZE){
801086c9: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
801086d0: 8b 45 f4 mov -0xc(%ebp),%eax
801086d3: 3b 45 18 cmp 0x18(%ebp),%eax
801086d6: 0f 82 5f ff ff ff jb 8010863b <loaduvm+0x2c>
else
n = PGSIZE;
if(readi(ip, p2v(pa), offset+i, n) != n)
return -1;
}
return 0;
801086dc: b8 00 00 00 00 mov $0x0,%eax
}
801086e1: 8b 5d fc mov -0x4(%ebp),%ebx
801086e4: c9 leave
801086e5: c3 ret
801086e6 <allocuvm>:
// Allocate page tables and physical memory to grow process from oldsz to
// newsz, which need not be page aligned. Returns new size or 0 on error.
int
allocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
801086e6: 55 push %ebp
801086e7: 89 e5 mov %esp,%ebp
801086e9: 83 ec 18 sub $0x18,%esp
char *mem;
uint a;
if(newsz >= KERNBASE)
801086ec: 8b 45 10 mov 0x10(%ebp),%eax
801086ef: 85 c0 test %eax,%eax
801086f1: 79 0a jns 801086fd <allocuvm+0x17>
return 0;
801086f3: b8 00 00 00 00 mov $0x0,%eax
801086f8: e9 b0 00 00 00 jmp 801087ad <allocuvm+0xc7>
if(newsz < oldsz)
801086fd: 8b 45 10 mov 0x10(%ebp),%eax
80108700: 3b 45 0c cmp 0xc(%ebp),%eax
80108703: 73 08 jae 8010870d <allocuvm+0x27>
return oldsz;
80108705: 8b 45 0c mov 0xc(%ebp),%eax
80108708: e9 a0 00 00 00 jmp 801087ad <allocuvm+0xc7>
a = PGROUNDUP(oldsz);
8010870d: 8b 45 0c mov 0xc(%ebp),%eax
80108710: 05 ff 0f 00 00 add $0xfff,%eax
80108715: 25 00 f0 ff ff and $0xfffff000,%eax
8010871a: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < newsz; a += PGSIZE){
8010871d: eb 7f jmp 8010879e <allocuvm+0xb8>
mem = kalloc();
8010871f: e8 42 a5 ff ff call 80102c66 <kalloc>
80108724: 89 45 f0 mov %eax,-0x10(%ebp)
if(mem == 0){
80108727: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8010872b: 75 2b jne 80108758 <allocuvm+0x72>
cprintf("allocuvm out of memory\n");
8010872d: 83 ec 0c sub $0xc,%esp
80108730: 68 b5 92 10 80 push $0x801092b5
80108735: e8 8c 7c ff ff call 801003c6 <cprintf>
8010873a: 83 c4 10 add $0x10,%esp
deallocuvm(pgdir, newsz, oldsz);
8010873d: 83 ec 04 sub $0x4,%esp
80108740: ff 75 0c pushl 0xc(%ebp)
80108743: ff 75 10 pushl 0x10(%ebp)
80108746: ff 75 08 pushl 0x8(%ebp)
80108749: e8 61 00 00 00 call 801087af <deallocuvm>
8010874e: 83 c4 10 add $0x10,%esp
return 0;
80108751: b8 00 00 00 00 mov $0x0,%eax
80108756: eb 55 jmp 801087ad <allocuvm+0xc7>
}
memset(mem, 0, PGSIZE);
80108758: 83 ec 04 sub $0x4,%esp
8010875b: 68 00 10 00 00 push $0x1000
80108760: 6a 00 push $0x0
80108762: ff 75 f0 pushl -0x10(%ebp)
80108765: e8 36 d1 ff ff call 801058a0 <memset>
8010876a: 83 c4 10 add $0x10,%esp
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
8010876d: 83 ec 0c sub $0xc,%esp
80108770: ff 75 f0 pushl -0x10(%ebp)
80108773: e8 08 f6 ff ff call 80107d80 <v2p>
80108778: 83 c4 10 add $0x10,%esp
8010877b: 89 c2 mov %eax,%edx
8010877d: 8b 45 f4 mov -0xc(%ebp),%eax
80108780: 83 ec 0c sub $0xc,%esp
80108783: 6a 06 push $0x6
80108785: 52 push %edx
80108786: 68 00 10 00 00 push $0x1000
8010878b: 50 push %eax
8010878c: ff 75 08 pushl 0x8(%ebp)
8010878f: e8 1b fb ff ff call 801082af <mappages>
80108794: 83 c4 20 add $0x20,%esp
return 0;
if(newsz < oldsz)
return oldsz;
a = PGROUNDUP(oldsz);
for(; a < newsz; a += PGSIZE){
80108797: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
8010879e: 8b 45 f4 mov -0xc(%ebp),%eax
801087a1: 3b 45 10 cmp 0x10(%ebp),%eax
801087a4: 0f 82 75 ff ff ff jb 8010871f <allocuvm+0x39>
return 0;
}
memset(mem, 0, PGSIZE);
mappages(pgdir, (char*)a, PGSIZE, v2p(mem), PTE_W|PTE_U);
}
return newsz;
801087aa: 8b 45 10 mov 0x10(%ebp),%eax
}
801087ad: c9 leave
801087ae: c3 ret
801087af <deallocuvm>:
// newsz. oldsz and newsz need not be page-aligned, nor does newsz
// need to be less than oldsz. oldsz can be larger than the actual
// process size. Returns the new process size.
int
deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
{
801087af: 55 push %ebp
801087b0: 89 e5 mov %esp,%ebp
801087b2: 83 ec 18 sub $0x18,%esp
pte_t *pte;
uint a, pa;
if(newsz >= oldsz)
801087b5: 8b 45 10 mov 0x10(%ebp),%eax
801087b8: 3b 45 0c cmp 0xc(%ebp),%eax
801087bb: 72 08 jb 801087c5 <deallocuvm+0x16>
return oldsz;
801087bd: 8b 45 0c mov 0xc(%ebp),%eax
801087c0: e9 a5 00 00 00 jmp 8010886a <deallocuvm+0xbb>
a = PGROUNDUP(newsz);
801087c5: 8b 45 10 mov 0x10(%ebp),%eax
801087c8: 05 ff 0f 00 00 add $0xfff,%eax
801087cd: 25 00 f0 ff ff and $0xfffff000,%eax
801087d2: 89 45 f4 mov %eax,-0xc(%ebp)
for(; a < oldsz; a += PGSIZE){
801087d5: e9 81 00 00 00 jmp 8010885b <deallocuvm+0xac>
pte = walkpgdir(pgdir, (char*)a, 0);
801087da: 8b 45 f4 mov -0xc(%ebp),%eax
801087dd: 83 ec 04 sub $0x4,%esp
801087e0: 6a 00 push $0x0
801087e2: 50 push %eax
801087e3: ff 75 08 pushl 0x8(%ebp)
801087e6: e8 24 fa ff ff call 8010820f <walkpgdir>
801087eb: 83 c4 10 add $0x10,%esp
801087ee: 89 45 f0 mov %eax,-0x10(%ebp)
if(!pte)
801087f1: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
801087f5: 75 09 jne 80108800 <deallocuvm+0x51>
a += (NPTENTRIES - 1) * PGSIZE;
801087f7: 81 45 f4 00 f0 3f 00 addl $0x3ff000,-0xc(%ebp)
801087fe: eb 54 jmp 80108854 <deallocuvm+0xa5>
else if((*pte & PTE_P) != 0){
80108800: 8b 45 f0 mov -0x10(%ebp),%eax
80108803: 8b 00 mov (%eax),%eax
80108805: 83 e0 01 and $0x1,%eax
80108808: 85 c0 test %eax,%eax
8010880a: 74 48 je 80108854 <deallocuvm+0xa5>
pa = PTE_ADDR(*pte);
8010880c: 8b 45 f0 mov -0x10(%ebp),%eax
8010880f: 8b 00 mov (%eax),%eax
80108811: 25 00 f0 ff ff and $0xfffff000,%eax
80108816: 89 45 ec mov %eax,-0x14(%ebp)
if(pa == 0)
80108819: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
8010881d: 75 0d jne 8010882c <deallocuvm+0x7d>
panic("kfree");
8010881f: 83 ec 0c sub $0xc,%esp
80108822: 68 cd 92 10 80 push $0x801092cd
80108827: e8 3a 7d ff ff call 80100566 <panic>
char *v = p2v(pa);
8010882c: 83 ec 0c sub $0xc,%esp
8010882f: ff 75 ec pushl -0x14(%ebp)
80108832: e8 56 f5 ff ff call 80107d8d <p2v>
80108837: 83 c4 10 add $0x10,%esp
8010883a: 89 45 e8 mov %eax,-0x18(%ebp)
kfree(v);
8010883d: 83 ec 0c sub $0xc,%esp
80108840: ff 75 e8 pushl -0x18(%ebp)
80108843: e8 81 a3 ff ff call 80102bc9 <kfree>
80108848: 83 c4 10 add $0x10,%esp
*pte = 0;
8010884b: 8b 45 f0 mov -0x10(%ebp),%eax
8010884e: c7 00 00 00 00 00 movl $0x0,(%eax)
if(newsz >= oldsz)
return oldsz;
a = PGROUNDUP(newsz);
for(; a < oldsz; a += PGSIZE){
80108854: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
8010885b: 8b 45 f4 mov -0xc(%ebp),%eax
8010885e: 3b 45 0c cmp 0xc(%ebp),%eax
80108861: 0f 82 73 ff ff ff jb 801087da <deallocuvm+0x2b>
char *v = p2v(pa);
kfree(v);
*pte = 0;
}
}
return newsz;
80108867: 8b 45 10 mov 0x10(%ebp),%eax
}
8010886a: c9 leave
8010886b: c3 ret
8010886c <freevm>:
// Free a page table and all the physical memory pages
// in the user part.
void
freevm(pde_t *pgdir)
{
8010886c: 55 push %ebp
8010886d: 89 e5 mov %esp,%ebp
8010886f: 83 ec 18 sub $0x18,%esp
uint i;
if(pgdir == 0)
80108872: 83 7d 08 00 cmpl $0x0,0x8(%ebp)
80108876: 75 0d jne 80108885 <freevm+0x19>
panic("freevm: no pgdir");
80108878: 83 ec 0c sub $0xc,%esp
8010887b: 68 d3 92 10 80 push $0x801092d3
80108880: e8 e1 7c ff ff call 80100566 <panic>
deallocuvm(pgdir, KERNBASE, 0);
80108885: 83 ec 04 sub $0x4,%esp
80108888: 6a 00 push $0x0
8010888a: 68 00 00 00 80 push $0x80000000
8010888f: ff 75 08 pushl 0x8(%ebp)
80108892: e8 18 ff ff ff call 801087af <deallocuvm>
80108897: 83 c4 10 add $0x10,%esp
for(i = 0; i < NPDENTRIES; i++){
8010889a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
801088a1: eb 4f jmp 801088f2 <freevm+0x86>
if(pgdir[i] & PTE_P){
801088a3: 8b 45 f4 mov -0xc(%ebp),%eax
801088a6: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
801088ad: 8b 45 08 mov 0x8(%ebp),%eax
801088b0: 01 d0 add %edx,%eax
801088b2: 8b 00 mov (%eax),%eax
801088b4: 83 e0 01 and $0x1,%eax
801088b7: 85 c0 test %eax,%eax
801088b9: 74 33 je 801088ee <freevm+0x82>
char * v = p2v(PTE_ADDR(pgdir[i]));
801088bb: 8b 45 f4 mov -0xc(%ebp),%eax
801088be: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
801088c5: 8b 45 08 mov 0x8(%ebp),%eax
801088c8: 01 d0 add %edx,%eax
801088ca: 8b 00 mov (%eax),%eax
801088cc: 25 00 f0 ff ff and $0xfffff000,%eax
801088d1: 83 ec 0c sub $0xc,%esp
801088d4: 50 push %eax
801088d5: e8 b3 f4 ff ff call 80107d8d <p2v>
801088da: 83 c4 10 add $0x10,%esp
801088dd: 89 45 f0 mov %eax,-0x10(%ebp)
kfree(v);
801088e0: 83 ec 0c sub $0xc,%esp
801088e3: ff 75 f0 pushl -0x10(%ebp)
801088e6: e8 de a2 ff ff call 80102bc9 <kfree>
801088eb: 83 c4 10 add $0x10,%esp
uint i;
if(pgdir == 0)
panic("freevm: no pgdir");
deallocuvm(pgdir, KERNBASE, 0);
for(i = 0; i < NPDENTRIES; i++){
801088ee: 83 45 f4 01 addl $0x1,-0xc(%ebp)
801088f2: 81 7d f4 ff 03 00 00 cmpl $0x3ff,-0xc(%ebp)
801088f9: 76 a8 jbe 801088a3 <freevm+0x37>
if(pgdir[i] & PTE_P){
char * v = p2v(PTE_ADDR(pgdir[i]));
kfree(v);
}
}
kfree((char*)pgdir);
801088fb: 83 ec 0c sub $0xc,%esp
801088fe: ff 75 08 pushl 0x8(%ebp)
80108901: e8 c3 a2 ff ff call 80102bc9 <kfree>
80108906: 83 c4 10 add $0x10,%esp
}
80108909: 90 nop
8010890a: c9 leave
8010890b: c3 ret
8010890c <clearpteu>:
// Clear PTE_U on a page. Used to create an inaccessible
// page beneath the user stack.
void
clearpteu(pde_t *pgdir, char *uva)
{
8010890c: 55 push %ebp
8010890d: 89 e5 mov %esp,%ebp
8010890f: 83 ec 18 sub $0x18,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80108912: 83 ec 04 sub $0x4,%esp
80108915: 6a 00 push $0x0
80108917: ff 75 0c pushl 0xc(%ebp)
8010891a: ff 75 08 pushl 0x8(%ebp)
8010891d: e8 ed f8 ff ff call 8010820f <walkpgdir>
80108922: 83 c4 10 add $0x10,%esp
80108925: 89 45 f4 mov %eax,-0xc(%ebp)
if(pte == 0)
80108928: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8010892c: 75 0d jne 8010893b <clearpteu+0x2f>
panic("clearpteu");
8010892e: 83 ec 0c sub $0xc,%esp
80108931: 68 e4 92 10 80 push $0x801092e4
80108936: e8 2b 7c ff ff call 80100566 <panic>
*pte &= ~PTE_U;
8010893b: 8b 45 f4 mov -0xc(%ebp),%eax
8010893e: 8b 00 mov (%eax),%eax
80108940: 83 e0 fb and $0xfffffffb,%eax
80108943: 89 c2 mov %eax,%edx
80108945: 8b 45 f4 mov -0xc(%ebp),%eax
80108948: 89 10 mov %edx,(%eax)
}
8010894a: 90 nop
8010894b: c9 leave
8010894c: c3 ret
8010894d <copyuvm>:
// Given a parent process's page table, create a copy
// of it for a child.
pde_t*
copyuvm(pde_t *pgdir, uint sz)
{
8010894d: 55 push %ebp
8010894e: 89 e5 mov %esp,%ebp
80108950: 53 push %ebx
80108951: 83 ec 24 sub $0x24,%esp
pde_t *d;
pte_t *pte;
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
80108954: e8 e6 f9 ff ff call 8010833f <setupkvm>
80108959: 89 45 f0 mov %eax,-0x10(%ebp)
8010895c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
80108960: 75 0a jne 8010896c <copyuvm+0x1f>
return 0;
80108962: b8 00 00 00 00 mov $0x0,%eax
80108967: e9 f8 00 00 00 jmp 80108a64 <copyuvm+0x117>
for(i = 0; i < sz; i += PGSIZE){
8010896c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
80108973: e9 c4 00 00 00 jmp 80108a3c <copyuvm+0xef>
if((pte = walkpgdir(pgdir, (void *) i, 0)) == 0)
80108978: 8b 45 f4 mov -0xc(%ebp),%eax
8010897b: 83 ec 04 sub $0x4,%esp
8010897e: 6a 00 push $0x0
80108980: 50 push %eax
80108981: ff 75 08 pushl 0x8(%ebp)
80108984: e8 86 f8 ff ff call 8010820f <walkpgdir>
80108989: 83 c4 10 add $0x10,%esp
8010898c: 89 45 ec mov %eax,-0x14(%ebp)
8010898f: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
80108993: 75 0d jne 801089a2 <copyuvm+0x55>
panic("copyuvm: pte should exist");
80108995: 83 ec 0c sub $0xc,%esp
80108998: 68 ee 92 10 80 push $0x801092ee
8010899d: e8 c4 7b ff ff call 80100566 <panic>
if(!(*pte & PTE_P))
801089a2: 8b 45 ec mov -0x14(%ebp),%eax
801089a5: 8b 00 mov (%eax),%eax
801089a7: 83 e0 01 and $0x1,%eax
801089aa: 85 c0 test %eax,%eax
801089ac: 75 0d jne 801089bb <copyuvm+0x6e>
panic("copyuvm: page not present");
801089ae: 83 ec 0c sub $0xc,%esp
801089b1: 68 08 93 10 80 push $0x80109308
801089b6: e8 ab 7b ff ff call 80100566 <panic>
pa = PTE_ADDR(*pte);
801089bb: 8b 45 ec mov -0x14(%ebp),%eax
801089be: 8b 00 mov (%eax),%eax
801089c0: 25 00 f0 ff ff and $0xfffff000,%eax
801089c5: 89 45 e8 mov %eax,-0x18(%ebp)
flags = PTE_FLAGS(*pte);
801089c8: 8b 45 ec mov -0x14(%ebp),%eax
801089cb: 8b 00 mov (%eax),%eax
801089cd: 25 ff 0f 00 00 and $0xfff,%eax
801089d2: 89 45 e4 mov %eax,-0x1c(%ebp)
if((mem = kalloc()) == 0)
801089d5: e8 8c a2 ff ff call 80102c66 <kalloc>
801089da: 89 45 e0 mov %eax,-0x20(%ebp)
801089dd: 83 7d e0 00 cmpl $0x0,-0x20(%ebp)
801089e1: 74 6a je 80108a4d <copyuvm+0x100>
goto bad;
memmove(mem, (char*)p2v(pa), PGSIZE);
801089e3: 83 ec 0c sub $0xc,%esp
801089e6: ff 75 e8 pushl -0x18(%ebp)
801089e9: e8 9f f3 ff ff call 80107d8d <p2v>
801089ee: 83 c4 10 add $0x10,%esp
801089f1: 83 ec 04 sub $0x4,%esp
801089f4: 68 00 10 00 00 push $0x1000
801089f9: 50 push %eax
801089fa: ff 75 e0 pushl -0x20(%ebp)
801089fd: e8 5d cf ff ff call 8010595f <memmove>
80108a02: 83 c4 10 add $0x10,%esp
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
80108a05: 8b 5d e4 mov -0x1c(%ebp),%ebx
80108a08: 83 ec 0c sub $0xc,%esp
80108a0b: ff 75 e0 pushl -0x20(%ebp)
80108a0e: e8 6d f3 ff ff call 80107d80 <v2p>
80108a13: 83 c4 10 add $0x10,%esp
80108a16: 89 c2 mov %eax,%edx
80108a18: 8b 45 f4 mov -0xc(%ebp),%eax
80108a1b: 83 ec 0c sub $0xc,%esp
80108a1e: 53 push %ebx
80108a1f: 52 push %edx
80108a20: 68 00 10 00 00 push $0x1000
80108a25: 50 push %eax
80108a26: ff 75 f0 pushl -0x10(%ebp)
80108a29: e8 81 f8 ff ff call 801082af <mappages>
80108a2e: 83 c4 20 add $0x20,%esp
80108a31: 85 c0 test %eax,%eax
80108a33: 78 1b js 80108a50 <copyuvm+0x103>
uint pa, i, flags;
char *mem;
if((d = setupkvm()) == 0)
return 0;
for(i = 0; i < sz; i += PGSIZE){
80108a35: 81 45 f4 00 10 00 00 addl $0x1000,-0xc(%ebp)
80108a3c: 8b 45 f4 mov -0xc(%ebp),%eax
80108a3f: 3b 45 0c cmp 0xc(%ebp),%eax
80108a42: 0f 82 30 ff ff ff jb 80108978 <copyuvm+0x2b>
goto bad;
memmove(mem, (char*)p2v(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
goto bad;
}
return d;
80108a48: 8b 45 f0 mov -0x10(%ebp),%eax
80108a4b: eb 17 jmp 80108a64 <copyuvm+0x117>
if(!(*pte & PTE_P))
panic("copyuvm: page not present");
pa = PTE_ADDR(*pte);
flags = PTE_FLAGS(*pte);
if((mem = kalloc()) == 0)
goto bad;
80108a4d: 90 nop
80108a4e: eb 01 jmp 80108a51 <copyuvm+0x104>
memmove(mem, (char*)p2v(pa), PGSIZE);
if(mappages(d, (void*)i, PGSIZE, v2p(mem), flags) < 0)
goto bad;
80108a50: 90 nop
}
return d;
bad:
freevm(d);
80108a51: 83 ec 0c sub $0xc,%esp
80108a54: ff 75 f0 pushl -0x10(%ebp)
80108a57: e8 10 fe ff ff call 8010886c <freevm>
80108a5c: 83 c4 10 add $0x10,%esp
return 0;
80108a5f: b8 00 00 00 00 mov $0x0,%eax
}
80108a64: 8b 5d fc mov -0x4(%ebp),%ebx
80108a67: c9 leave
80108a68: c3 ret
80108a69 <uva2ka>:
//PAGEBREAK!
// Map user virtual address to kernel address.
char*
uva2ka(pde_t *pgdir, char *uva)
{
80108a69: 55 push %ebp
80108a6a: 89 e5 mov %esp,%ebp
80108a6c: 83 ec 18 sub $0x18,%esp
pte_t *pte;
pte = walkpgdir(pgdir, uva, 0);
80108a6f: 83 ec 04 sub $0x4,%esp
80108a72: 6a 00 push $0x0
80108a74: ff 75 0c pushl 0xc(%ebp)
80108a77: ff 75 08 pushl 0x8(%ebp)
80108a7a: e8 90 f7 ff ff call 8010820f <walkpgdir>
80108a7f: 83 c4 10 add $0x10,%esp
80108a82: 89 45 f4 mov %eax,-0xc(%ebp)
if((*pte & PTE_P) == 0)
80108a85: 8b 45 f4 mov -0xc(%ebp),%eax
80108a88: 8b 00 mov (%eax),%eax
80108a8a: 83 e0 01 and $0x1,%eax
80108a8d: 85 c0 test %eax,%eax
80108a8f: 75 07 jne 80108a98 <uva2ka+0x2f>
return 0;
80108a91: b8 00 00 00 00 mov $0x0,%eax
80108a96: eb 29 jmp 80108ac1 <uva2ka+0x58>
if((*pte & PTE_U) == 0)
80108a98: 8b 45 f4 mov -0xc(%ebp),%eax
80108a9b: 8b 00 mov (%eax),%eax
80108a9d: 83 e0 04 and $0x4,%eax
80108aa0: 85 c0 test %eax,%eax
80108aa2: 75 07 jne 80108aab <uva2ka+0x42>
return 0;
80108aa4: b8 00 00 00 00 mov $0x0,%eax
80108aa9: eb 16 jmp 80108ac1 <uva2ka+0x58>
return (char*)p2v(PTE_ADDR(*pte));
80108aab: 8b 45 f4 mov -0xc(%ebp),%eax
80108aae: 8b 00 mov (%eax),%eax
80108ab0: 25 00 f0 ff ff and $0xfffff000,%eax
80108ab5: 83 ec 0c sub $0xc,%esp
80108ab8: 50 push %eax
80108ab9: e8 cf f2 ff ff call 80107d8d <p2v>
80108abe: 83 c4 10 add $0x10,%esp
}
80108ac1: c9 leave
80108ac2: c3 ret
80108ac3 <copyout>:
// Copy len bytes from p to user address va in page table pgdir.
// Most useful when pgdir is not the current page table.
// uva2ka ensures this only works for PTE_U pages.
int
copyout(pde_t *pgdir, uint va, void *p, uint len)
{
80108ac3: 55 push %ebp
80108ac4: 89 e5 mov %esp,%ebp
80108ac6: 83 ec 18 sub $0x18,%esp
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
80108ac9: 8b 45 10 mov 0x10(%ebp),%eax
80108acc: 89 45 f4 mov %eax,-0xc(%ebp)
while(len > 0){
80108acf: eb 7f jmp 80108b50 <copyout+0x8d>
va0 = (uint)PGROUNDDOWN(va);
80108ad1: 8b 45 0c mov 0xc(%ebp),%eax
80108ad4: 25 00 f0 ff ff and $0xfffff000,%eax
80108ad9: 89 45 ec mov %eax,-0x14(%ebp)
pa0 = uva2ka(pgdir, (char*)va0);
80108adc: 8b 45 ec mov -0x14(%ebp),%eax
80108adf: 83 ec 08 sub $0x8,%esp
80108ae2: 50 push %eax
80108ae3: ff 75 08 pushl 0x8(%ebp)
80108ae6: e8 7e ff ff ff call 80108a69 <uva2ka>
80108aeb: 83 c4 10 add $0x10,%esp
80108aee: 89 45 e8 mov %eax,-0x18(%ebp)
if(pa0 == 0)
80108af1: 83 7d e8 00 cmpl $0x0,-0x18(%ebp)
80108af5: 75 07 jne 80108afe <copyout+0x3b>
return -1;
80108af7: b8 ff ff ff ff mov $0xffffffff,%eax
80108afc: eb 61 jmp 80108b5f <copyout+0x9c>
n = PGSIZE - (va - va0);
80108afe: 8b 45 ec mov -0x14(%ebp),%eax
80108b01: 2b 45 0c sub 0xc(%ebp),%eax
80108b04: 05 00 10 00 00 add $0x1000,%eax
80108b09: 89 45 f0 mov %eax,-0x10(%ebp)
if(n > len)
80108b0c: 8b 45 f0 mov -0x10(%ebp),%eax
80108b0f: 3b 45 14 cmp 0x14(%ebp),%eax
80108b12: 76 06 jbe 80108b1a <copyout+0x57>
n = len;
80108b14: 8b 45 14 mov 0x14(%ebp),%eax
80108b17: 89 45 f0 mov %eax,-0x10(%ebp)
memmove(pa0 + (va - va0), buf, n);
80108b1a: 8b 45 0c mov 0xc(%ebp),%eax
80108b1d: 2b 45 ec sub -0x14(%ebp),%eax
80108b20: 89 c2 mov %eax,%edx
80108b22: 8b 45 e8 mov -0x18(%ebp),%eax
80108b25: 01 d0 add %edx,%eax
80108b27: 83 ec 04 sub $0x4,%esp
80108b2a: ff 75 f0 pushl -0x10(%ebp)
80108b2d: ff 75 f4 pushl -0xc(%ebp)
80108b30: 50 push %eax
80108b31: e8 29 ce ff ff call 8010595f <memmove>
80108b36: 83 c4 10 add $0x10,%esp
len -= n;
80108b39: 8b 45 f0 mov -0x10(%ebp),%eax
80108b3c: 29 45 14 sub %eax,0x14(%ebp)
buf += n;
80108b3f: 8b 45 f0 mov -0x10(%ebp),%eax
80108b42: 01 45 f4 add %eax,-0xc(%ebp)
va = va0 + PGSIZE;
80108b45: 8b 45 ec mov -0x14(%ebp),%eax
80108b48: 05 00 10 00 00 add $0x1000,%eax
80108b4d: 89 45 0c mov %eax,0xc(%ebp)
{
char *buf, *pa0;
uint n, va0;
buf = (char*)p;
while(len > 0){
80108b50: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
80108b54: 0f 85 77 ff ff ff jne 80108ad1 <copyout+0xe>
memmove(pa0 + (va - va0), buf, n);
len -= n;
buf += n;
va = va0 + PGSIZE;
}
return 0;
80108b5a: b8 00 00 00 00 mov $0x0,%eax
}
80108b5f: c9 leave
80108b60: c3 ret
|
oeis/230/A230800.asm | neoneye/loda-programs | 11 | 27691 | <filename>oeis/230/A230800.asm<gh_stars>10-100
; A230800: Number of n X 2 0..3 arrays x(i,j) with each element horizontally or vertically next to at least one element with value (x(i,j)+1) mod 4 and at least one element with value (x(i,j)-1) mod 4, and upper left element zero.
; Submitted by <NAME>
; 0,2,2,16,34,154,432,1618,5058,17664,57586,195866,648928,2185122,7284482,24435056,81651394,273490714,914714512,3062116338,10245066178,34289257824,114738331026,383986878106,1284957453248,4300144520002,14390099368962,48156278591696,161152430797154,539292036299674,1804717264423792,6039424592659858,20210692590364098,67634346414568384,226335725408022066,757424066351633946,2534690753078558368,8482247277226810082,28385518741166800642,94991067380301669936,317884010821470093314,1063786832218916203034
mov $3,1
lpb $0
sub $0,1
add $1,$3
add $4,$2
mov $2,$3
add $4,$1
add $1,$3
mov $3,$4
mov $4,$2
mul $2,4
lpe
mov $0,$2
div $0,2
|
basic/src/commands/graphics2.asm | paulscottrobson/eris | 13 | 95917 | <filename>basic/src/commands/graphics2.asm
; *****************************************************************************
; *****************************************************************************
;
; Name: graphics2.asm
; Purpose: More Simple Graphics keywords
; Created: 25th March 2020
; Reviewed: TODO
; Author: <NAME> (<EMAIL>)
;
; *****************************************************************************
; *****************************************************************************
; *****************************************************************************
;
; These get two coordinates and then call the OS Routine
;
; *****************************************************************************
.Command_Move ;; [move]
push link
jsr #GetCoordinatePair
jsr #OSGraphicsMove
pop link
ret
.Command_Plot ;; [plot]
push link
jsr #GetCoordinatePair
jsr #OSPlotPixel
pop link
ret
.Command_Line ;; [line]
push link
jsr #GetCoordinatePair
jsr #OSDrawLine
pop link
ret
.Command_Rect ;; [rect]
push link
jsr #GetCoordinatePair
jsr #OSFillRectangle
pop link
ret
.Command_Frame ;; [frame]
push link
jsr #GetCoordinatePair
jsr #OSDrawRectangle
pop link
ret
.Command_Ellipse ;; [ellipse]
push link
jsr #GetCoordinatePair
jsr #OSFillEllipse
pop link
ret
.Command_Curve ;; [curve]
push link
jsr #GetCoordinatePair
jsr #OSDrawEllipse
pop link
ret
.Command_Text ;; [text]
push link
jsr #GetCoordinatePair
mov r4,r0,#0
jsr #CheckComma
jsr #EvaluateString
mov r2,r0,#0
mov r3,#1
ldm r0,r11,#0 ; check for comma
xor r0,#TOK_COMMA
skz r0
jmp #_CTXDoText
inc r11 ; skip comma, get scale
jsr #EvaluateInteger
mov r3,r0,#0
and r0,#$FFF0
skz r0
jmp #BadNumberError
._CTXDoText
mov r0,r4,#0
jsr #OSDrawString
pop link
ret
; *****************************************************************************
;
; Get a coordinate pair in R0,R1
; also handles x,y TO x,y
;
; *****************************************************************************
.GetCoordinatePair
push r2,link
jsr #EvaluateInteger ; get and check X -> R2
mov r2,r0,#0
sub r0,#PixelWidth
sklt
jmp #BadNumberError
jsr #CheckComma
jsr #EvaluateInteger ; get and check Y -> R1
mov r1,r0,#0
sub r0,#PixelHeight
sklt
jmp #BadNumberError
mov r0,r2,#0 ; X -> R0
ldm r2,r11,#0 ; what follows ?
xor r2,#TOK_TO ; if TO
skz r2
jmp #_GCPExit
stm r0,#xGraphic ; save current as actual position
stm r1,#yGraphic
inc r11 ; skip TO
jsr #GetCoordinatePair ; get a second pair into R0,R1
._GCPExit
pop r2,link
ret
; *****************************************************************************
;
; TILE command
;
; *****************************************************************************
.Command_Tile ;; [tile]
push link
jsr #EvaluateInteger ; xdraw
mov r7,r0,#0
jsr #CheckComma
jsr #EvaluateInteger ; ydraw
mov r1,r0,#0
jsr #CheckComma
jsr #EvaluateInteger ; xoffset
mov r2,r0,#0
jsr #CheckComma
jsr #EvaluateInteger ; yoffset
mov r3,r0,#0
jsr #CheckComma
jsr #EvaluateInteger ; xsize
mov r4,r0,#0
jsr #CheckComma
jsr #EvaluateInteger ; ysize
mov r5,r0,#0
jsr #CheckComma
jsr #EvaluateInteger ; data pointer.
mov r6,r0,#0
mov r0,r7,#0
ldm r7,r6,#0 ; check it is a tilemap
xor r7,#$ABCD
skz r7
jmp #BadNumberError
jsr #OSDrawTileMap
pop link
ret
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_242.asm | ljhsiun2/medusa | 9 | 81206 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r15
push %r9
push %rbx
push %rsi
lea addresses_WC_ht+0x9c7, %r13
nop
nop
add $18858, %rsi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm7
and $0xffffffffffffffc0, %r13
movntdq %xmm7, (%r13)
and %r14, %r14
lea addresses_A_ht+0x22f1, %r9
clflush (%r9)
nop
nop
nop
dec %r10
movl $0x61626364, (%r9)
nop
sub %r14, %r14
lea addresses_D_ht+0x1c7e7, %r13
clflush (%r13)
nop
and $23428, %rsi
mov (%r13), %r10
nop
nop
nop
nop
nop
xor $21832, %r13
lea addresses_D_ht+0x29c7, %rbx
and $40525, %r15
mov (%rbx), %si
nop
nop
cmp %rbx, %rbx
lea addresses_D_ht+0x1e564, %rsi
nop
nop
and %r15, %r15
mov $0x6162636465666768, %r14
movq %r14, %xmm0
and $0xffffffffffffffc0, %rsi
vmovaps %ymm0, (%rsi)
nop
nop
nop
nop
xor %rbx, %rbx
lea addresses_A_ht+0x14a47, %r15
nop
nop
nop
sub %r10, %r10
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
movups %xmm5, (%r15)
nop
nop
nop
inc %rbx
lea addresses_WT_ht+0x1c15f, %r10
nop
inc %rbx
mov (%r10), %rsi
nop
nop
nop
nop
nop
and $23563, %rbx
lea addresses_normal_ht+0x4dc7, %r15
nop
nop
nop
xor %r14, %r14
mov (%r15), %r9
nop
nop
and %r13, %r13
lea addresses_WT_ht+0xda07, %r14
nop
nop
nop
xor $58910, %r15
movb (%r14), %r13b
xor %rbx, %rbx
pop %rsi
pop %rbx
pop %r9
pop %r15
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WC+0x12d87, %rax
nop
dec %rdx
movl $0x51525354, (%rax)
nop
sub $38927, %r8
// Store
lea addresses_D+0x19287, %rsi
inc %r10
movl $0x51525354, (%rsi)
sub %rax, %rax
// REPMOV
mov $0x147, %rsi
lea addresses_US+0x411d, %rdi
nop
nop
nop
and $11377, %rbp
mov $71, %rcx
rep movsb
nop
xor %rsi, %rsi
// Faulty Load
lea addresses_RW+0xf1c7, %rbp
nop
nop
nop
nop
and %rcx, %rcx
movups (%rbp), %xmm6
vpextrq $0, %xmm6, %rdi
lea oracles, %rdx
and $0xff, %rdi
shlq $12, %rdi
mov (%rdx,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_P'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_US'}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': True, 'AVXalign': False, 'size': 16, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': True, 'AVXalign': False, 'size': 8, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
access/equip.asm | minblock/msdos | 0 | 92365 | <gh_stars>0
;************************************************************************
; *
; Copyright (C) 1991 by Trace Center *
; *
; EQUIP.ASM *
; *
;************************************************************************
TITLE Equip
page 80,180
; BUG equ true
EXTRN fslow_baud_mouse:byte
EXTRN _singleUserSetup:byte
EXTRN _comp_id:byte
EXTRN _combase:word
EXTRN _vector:byte
EXTRN _finject_keys:byte
EXTRN fcomp_dialog:byte
EXTRN fcomp_dialog_id:byte
EXTRN fcomputer_not_found:byte
EXTRN btn_1:byte
EXTRN btn_2:byte
EXTRN Current_Button:byte
EXTRN fmouse_driver:byte
EXTRN _fmouse_id:byte
EXTRN ExtendedSeg:word
EXTRN fvideo_type:byte
EXTRN comp_flag:byte
EXTRN fmousetrapping:byte ; in handicap.asm
EXTRN _end:abs ; variable buily by assembler
EXTRN _dataBlock:byte ; in param.asm
EXTRN _dataBlockSize:word ; in param.asm
EXTRN _serialKeysOn:byte
EXTRN _skWindowCompatible:byte
EXTRN fAccessAlreadyLoaded:byte
EXTRN fserial_keys_loaded:byte
EXTRN fDialog_Filter_off:byte
EXTRN fDialog_Stickeys_off:byte
EXTRN fDialog_Mouse_off:byte
EXTRN fDialog_Toggle_off:byte
EXTRN fDialog_TimeOut_off:byte
EXTRN fDialog_Action:byte
EXTRN last_address:word ; in TimeOut.asm
EXTRN Enable:NEAR ; in Handicap.asm
EXTRN _serialKeysEnableFar:FAR ; in SerialKeys
EXTRN _serialKeysDisableFar:FAR
EXTRN cmdLineLen:byte
EXTRN intNumber:byte
EXTRN functionNumber:byte
EXTRN tsrLoaded:word
EXTRN parameters:dword
EXTRN paramsOffset:word
EXTRN paramsSegment:word
EXTRN originalInt:dword
EXTRN orgIntOffset:word
EXTRN orgIntSegment:word
EXTRN accessIntHandler:near
EXTRN programStamp:byte
EXTRN pgm_stamp_len:word
EXTRN pgm_stamp_ofs:word
DGROUP GROUP _TEXT, CONST, _DATA, c_common, _BSS
_TEXT SEGMENT WORD PUBLIC 'CODE'
_TEXT ENDS
CONST SEGMENT WORD PUBLIC 'CONST'
CONST ENDS
_DATA SEGMENT WORD PUBLIC 'DATA'
_DATA ENDS
c_common segment word public 'BSS'
c_common ends
_BSS SEGMENT WORD PUBLIC 'BSS'
_BSS ENDS
_BSS segment
include KEYBOARD.INC
PUBLIC runFrontEnd
PUBLIC throwAwayAddr
throwAwayAddr label word ; everything below is expendable
display MACRO string
; mov dx,OFFSET string
lea dx,string
mov ah,9
int 21h
ENDM
displaydebug MACRO string
local displaydebug10
cmp _debug,false
je displaydebug10
; mov dx,OFFSET string
lea dx,string
mov ah,9
int 21h
displaydebug10:
ENDM
error0Msg db 'Error opening configuration file', 13, 10, '$'
error0aMsg db 'Error reading configuration file', 13, 10, '$'
error0bMsg db 'Error closing configuration file', 13, 10, '$'
error1Msg db 'Error releasing memory block', 13, 10, '$'
error2Msg db 'Error spawning child process', 13, 10, '$'
abortAccessMsg db 'Aborting AccessDOS installation.', 13, 10, '$'
exitMsg db 'Exiting AccessDOS menu and AccessDOS is still loaded.', 13, 10, '$'
removeHelperMsg db 'Removing AccessDOS and subroutines from memory.', 13, 10, '$'
residentMsg db 'AccessDOS is now loaded and resident on your computer.', 13, 10, '$'
userRespMsg db 'Press any key to continue. ', 13, 10, '$'
debugMsg1 db 'AccessDOS is searching for a mouse, please wait. ', 13, 10, '$'
debugMsg2 db 'AccessDOS is determining your computer type, please wait. ', 13, 10, '$'
debugMsg3 db 'AccessDOS has finished hardware checks.', 13, 10, '$'
;;mesg100 db 'SerialKeys installed, but turned off', 13, 10, '$'
;;mesg101 db 'SerialKeys installed, and turned on', 13, 10, '$'
_debug dw false ; debug flag set to true when /d on command line
saveStackPtr dw ?
saveStackSeg dw ?
param_block label word
dw 0 ; 0 = use parent environmet segment
cmd_ofs dw ? ; offset of command line sent to child
cmd_seg dw ? ; segment of command line sent to child
dw 5Ch ; FCB1 offset
fcb1_seg dw ? ; FCB1 segment
dw 6Ch ; FCB2 offset
fcb2_seg dw ? ; FCB2 segment
cmd_buf db ? ; command line buffer (also length byte)
cmd_txt db 80 dup (?)
db '$',0 ; make sure end of string defined
even
transferBuf db 127 dup (?) ; temp storage when reading configuration data
handle dw 0 ; handle to configuration file
programName db 15 dup ('ADOS.OVL',0)
prgmNameLen dw 5
defaultPgmName db 'ADOS.OVL',0
defaultPgmNameLen equ 5
alreadyLoaded db false
inhibitmessage db false
tempIntNumber db 0
firstUnusedVect db 0
segOfFirstInst dw 0
serkeyRoutine label dword
serkeyRoutOfs dw 0
serkeyRoutSeg dw 0
status dw 0
INSTALLACCESS equ 1 ; any modifications made here must also be made in datablk.c
ABORTACCESS equ 2 ; any modifications made here must also be made in datablk.c
cmdLineSwitch dw 0
DEBUGON equ 01h
AUTOLOAD equ 02h
USECFGFILE equ 04h
SERIALKEYSPARAM equ 80h
skCmdLineSwitch dw 0
SKSINGLEUSER equ 01h
SKDISABLE equ 02h
SKENABLE equ 04h
SKWINDOWS equ 08h
even
stack db 64 dup ('stackspc')
topOfStack dw 0
;--------------------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
runFrontEnd proc near
lea sp,topOfStack
call checkIfLoaded ; are we already installed once
jnc runFrontEnd10 ; jump if we ARE INSTALLED
call loadUs ; install our int vector
runFrontEnd10:
call getPath ; get path to ados.xxx
call cmdLineTransfer ; copy the command line to our buffer
call cmdLineRead ; read the command line switches
; added one variables to inhibit erro messages from 'ados /? ' inquires @ the command line
; this still doesn't protect us if user enter command line switch (good or bad) w/o the '/'
mov cl,cmd_buf
cmp cl,0 ; did we have any command line parameters ?
je runFrontEnd20 ; if not, carry on
mov inhibitmessage,true ; if yes, flag it, so if we later ABORT, do not append
; abort message
runFrontEnd20:
test cmdLineSwitch,DEBUGON ; was the debug switch found
jz runFrontEnd30 ; jump if not
mov _debug,true ; set debug variable
runFrontEnd30:
; if this is the first instance, we have to determine the equipment setup
; (this done here because we wanted to get the debug status from the command line)
cmp alreadyLoaded,true
je runFrontEnd50 ; jump if this is the second instance running now
displaydebug debugMsg1
call _FindMouse ; determine mouse device installed
displaydebug debugMsg2
call _FindComputer ; determine computer running on
displaydebug debugMsg3
; wait for keystroke if in debug mode
cmp _debug,true ; wait for keystroke if in debug mode
jne runFrontEnd50 ; jump around if not in debug
displaydebug userRespMsg
mov ah,0Ch ; 21h function C - Clear Keyboard buffer and execute function in al
mov al,08h ; 21h function 8 - Console input without echo
int 21h
runFrontEnd50:
test cmdLineSwitch,AUTOLOAD ; if /a on command line, do overlay
jz runFrontEnd100
call runOverlay
jmp runFrontEnd1000
runFrontEnd100:
test cmdLineSwitch,USECFGFILE ; was /x on command line
jz runFrontEnd200 ; jump in NO
; Force the user to run the overlay if already loaded
; because some equipment dependent settings in the .cfg file
; may not apply now and cause problems
cmp alreadyLoaded, true
je runFrontEnd110 ; jump if this is the second instance running now
call runWithCFGfile ; try to load the configuration file
jc runFrontEnd110 ; jump if there was a problem
mov status,INSTALLACCESS ; configuration file loaded, now install
jmp runFrontEnd1000
runFrontEnd110:
call runOverlay ; there was a problem with the cfg file so let overlay handle it
jmp runFrontEnd1000
runFrontEnd200:
test cmdLineSwitch,SERIALKEYSPARAM ; were there any serial keys switches
jz runFrontEnd500 ; jump if NO
cmp alreadyLoaded,true ; if already loaded, we don't have to run the overlay or the cfg
jne runFrontEnd500 ; jump if not loaded yet
mov status,INSTALLACCESS ; deal with switches later, for now skip overlay and jump to install
jmp runFrontEnd1000
runFrontEnd500:
call runOverlay ; if no switches (or not loaded and sk switches) do the overlay (sounds like a dance)
jmp runFrontEnd1000
;---
runFrontEnd1000:
; what is the status of ADOS now? Do we install it, quit, modifiy paramaters, er what!
cmp status,ABORTACCESS ; should we cancel/abort
jne runFrontEnd1020 ; jump if NO
call cancelAccess ; do cleanup and quit
jmp runFrontEndDone
runFrontEnd1020:
cmp status,INSTALLACCESS ; should we install it
jne runFrontEnd1040 ; jump if NO
; OK let's install/run ADOS
; If already loaded, install means update remaining parameters and exit,
; otherwise install means update remaining parameters and tsr
cmp alreadyLoaded,true ; are we already installed once
je runFrontEnd1025 ; jump if YES we are already installed
call updateAndTSR ; initialize our routines and Terminate and Stay resident
; we do not come back from here unless there is an error
jmp runFrontEndDone
runFrontEnd1025:
call updateAndExit ; just update the remaining parameters and quit
jmp runFrontEndDone
runFrontEnd1040:
runFrontEndDone:
mov ax,4c00h
int 21h
int 20h
runFrontEnd endp
;--------------------------------------------------------------
;checkIfLoaded - returns carry flag: carry = NOT LOADED
;
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC checkIfLoaded
checkIfLoaded proc near
; initialize variable for CHECK-IF-LOADED routines below
mov firstUnusedVect,0 ; signal no vector found yet
sub bx,bx ; BX will hold int number
mov bl,START_INT_NUMBER-1
mov si,offset programStamp ; si initialized for string compare
cld
jmp short checkIfLoaded20
assume es:nothing ; keep here because of looping below
checkIfLoaded10:
cmp firstUnusedVect,0 ; have we found the first unused vector already?
jne checkIfLoaded20 ; jump if yes
mov firstUnusedVect,bl ; if not, we have now
checkIfLoaded20:
inc bx ; get next vector to check
cmp bx,END_INT_NUMBER ; are we at end of INTs to check?
ja checkIfLoaded60 ; if yes, we are not loaded
mov di,bx ; get offset
shl di,1 ; x 4 to get vector table addr
shl di,1 ; x 4 to get vector table addr
sub ax, ax ; get segment
mov es, ax
assume es:nothing
mov ax, WORD PTR es:[di] ; is there a vector (other than to 0) here
or ax, WORD PTR es:[di+2]
jz checkIfLoaded10 ; jump if we know it is not loaded
les di,es:[di] ; get vector routine
add di,pgm_stamp_ofs ; add offset to our ID message
; es:di from vector table; ds:si from our string
mov cx,pgm_stamp_len
repe cmpsb
jcxz checkIfLoaded50 ; jump if loaded
jmp checkIfLoaded20 ; we are NOT found
;------------
checkIfLoaded50:
; yes we are loaded. Save interrupt number
mov segOfFirstInst,es
mov alreadyLoaded, true ; signal already loaded
mov tempIntNumber, bl
clc
jmp checkIfLoadedDone
;------------
checkIfLoaded60:
; we have not been installed previously, so save interrupt
; of the first unused vector
mov segOfFirstInst,cs
mov alreadyLoaded, false ; signal not already loaded
mov al,firstUnusedVect
or al,al ; did we find a vector that was not used already
jnz checkIfLoaded80 ; jump if we had
; All the vectors apparently are used. We'll just have
; to pick one for us to use
mov al,DEFAULT_INTERRUPT
checkIfLoaded80:
mov tempIntNumber,al ; save it
stc
;------------
checkIfLoadedDone:
push cs
push cs
pop ds
pop es
assume es:DGROUP
ret
checkIfLoaded endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC loadUs
loadUs proc near
; initialize our ISR variables
mov functionNumber, ACCESS_FUNCTION ; function number to respond to
mov tsrLoaded, TSR_HERE ; value to return if TSR is loaded
mov paramsOffset, offset _dataBlock ; address of the shared data block
mov paramsSegment, cs ; segment of shared data block
mov segOfFirstInst,cs
mov al,tempIntNumber
mov intNumber, al ; interrupt to tag onto
mov ah, 35h ; get the original interrupt handler
int 21h ; old vector in ES:BX
assume es:nothing
mov orgIntOffset, bx
mov orgIntSegment, es
mov ah, 25h ; set new interrupt handler
mov al, intNumber
mov dx, offset accessIntHandler
int 21h
push cs
pop es
assume es:DGROUP
ret
loadUs endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC getPath
getPath proc near
; get path of .com file for overlay file
; only works for DOS 3 and above
mov ah,30h ; function 30h: Get DOS Version Number
int 21h ; major version # in al, minor version # in ah
cmp al,3 ; if 3 or higher then path can be found
jge getPath50
jmp getPathDone ; skip looking for path
getPath50:
mov es,cs:2Ch ; es now points to environment segment
assume es:nothing
sub di,di ; di points to offset within environment
sub ax,ax ; indicate searching for null
cld
mov cx,8000h ; set up count
getPath100:
; search for end of environment es:di ( two null chars together )
repne scasb
jcxz getPathDone ; if count ended then use default name
scasb ; look for second null character
jne getPath100 ; jump if not a null character
; complete path of file running found two bytes after
inc di ; bypass two bytes of junk(?)
inc di
mov si,di ; set si to beginning of path string for later
mov cx,-1 ; get length
repne scasb ; es:di
jcxz getPathDone ; if count ended then use default name
not cx ; length to .
cmp cx,80h ; make sure it is not too long
jb getPath200 ; jump if ok
jmp getPathDone ; use default if too long
getPath200:
mov prgmNameLen,cx ; save length
lea di,programName ; store path here
push ds ; setup segments so source = ds:si and destin = es:di
push es
pop ds
assume ds:nothing
pop es
rep movsb ; transfer string to our buffer; add extension later
; now set length from beginning to period starting extension
mov al,'.' ; set char to look for
mov cx,prgmNameLen ; get stored length
std ; search backward
dec di ; point to null
dec di ; point to last char
repne scasb ; continue until found
jcxz getPath300 ; if cx = 0 then period not found, use default name
mov prgmNameLen,cx ; save length
jmp getPathDone
getPath300:
; restore default program name
push cs
pop ds
mov cx,defaultPgmNameLen
mov prgmNameLen,cx
add cx,4
cld
lea di,programName
lea si,defaultPgmName
rep movsb
getPathDone:
cld
push cs
push cs
pop es ; restore segments
pop ds
assume ds:DGROUP
assume es:DGROUP
ret
getPath endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC cmdLineTransfer
cmdLineTransfer proc near
; Copy the command line for use by us and the child process
sub cx, cx
mov cl, cmdLineLen
inc cx ; once for length byte
inc cx ; again for '0D' at end of command tail
cld
mov si, offset cmdLineLen
; mov di, offset cmd_buf
lea di,cmd_buf
rep movsb
mov al,0h ; just to make sure there is an end of string
stosb
ret
cmdLineTransfer endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC cmdLineRead
cmdLineRead proc near
mov cmdLineSwitch,0
mov skCmdLineSwitch,0
mov cl, cmd_buf ; get length
; mov di, offset cmd_txt ; es:di
lea di,cmd_txt
mov al,'/' ; look for switch
cmdLineRead10:
repne scasb
jcxz cmdLineReadjmp ; finished with command line checking
mov bl,[di] ; get character after /
cmp bl,'s' ; is it serial keys flag
jne cmdLineRead20 ; if no, jump
call cmdLineReadSK ; look at next characters to verify serial keys
jmp cmdLineRead10
cmdLineReadjmp:
jmp cmdLineReadDone ; finished with command line checking
cmdLineRead20:
cmp bl,'d' ; is it debug flag
jne cmdLineRead40 ; if no, jump
or cmdLineSwitch,DEBUGON ; signal /d detected
jmp cmdLineRead10
cmdLineRead40:
cmp bl,'a' ; is auto load indicated
jne cmdLineRead60 ; if no, jump
or cmdLineSwitch,AUTOLOAD ; signal /a detected
jmp cmdLineRead10
cmdLineRead60:
cmp bl,'A' ; is auto load indicated
jne cmdLineRead80 ; if no, jump
or cmdLineSwitch,AUTOLOAD ; signal /a detected
jmp cmdLineRead10
cmdLineRead80:
cmp bl,'x' ; is it no-load overlay switch
jne cmdLineRead100 ; if no, jump
or cmdLineSwitch,USECFGFILE ; signal /x detected
jmp cmdLineRead10
cmdLineRead100:
cmp bl,'X' ; is it no-load overlay switch
jne cmdLineRead105 ; if no, jump
or cmdLineSwitch,USECFGFILE ; signal /x detected
jmp cmdLineRead10
cmdLineRead105:
cmp bl,'i' ; is it mouse switch
jne cmdLineRead110 ; if no, jump
cmp alreadyLoaded,true ; if already loaded, ignore this switch
je cmdLineRead120
mov fmousetrapping,true ; if not loaded, set flag and cont.
jmp cmdLineRead10
cmdLineRead110:
cmp bl,'I' ; is it mouse switch
jne cmdLineRead120 ; if no, jump
cmp alreadyLoaded,true ; if already loaded, ignore this switch
je cmdLineRead120
mov fmousetrapping,true ; if not loaded, set flag and cont.
jmp cmdLineRead10
cmdLineRead120:
jmp cmdLineRead10
cmdLineReadDone:
ret
cmdLineRead endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC cmdLineReadSK
cmdLineReadSK proc near
; see if serial keys switch
mov bl,[di+1]
cmp bl,'k' ; is it /sk
je cmdLineReadSK10 ; jump if yes
jmp cmdLineReadSKdone ; it isn't so quit on this one
cmdLineReadSK10:
; find out what switch
mov bl,[di+2] ; get next char
cmp bl,'s' ; is it single user flag
jne cmdLineReadSK20 ; jump if NO
or skCmdLineSwitch,SKSINGLEUSER ; signal /sks found
jmp cmdLineReadSK100
cmdLineReadSK20:
cmp bl,'d' ; is it serial keys disable cmd
jne cmdLineReadSK30 ; jump if NO
or skCmdLineSwitch,SKDISABLE ; signal /skd found
jmp cmdLineReadSK100
cmdLineReadSK30:
cmp bl,'e' ; is it serial keys enable cmd
jne cmdLineReadSK40 ; jump if NO
or skCmdLineSwitch,SKENABLE ; signal /ske found
jmp cmdLineReadSK100
cmdLineReadSK40:
cmp bl,'w' ; is it serial keys windows compatible command
jne cmdLineReadSKdone ; jump if NO
or skCmdLineSwitch,SKWINDOWS ; signal /skw found
cmdLineReadSK100:
or cmdLineSwitch,SERIALKEYSPARAM ; signal serial keys command line switch found
cmdLineReadSKdone:
ret
cmdLineReadSK endp
;----------------------------------------------------------------------
; runWithCFGfile returns carry flag: carry set if error
;
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
runWithCFGfile:
; user indicated that we should load with previous configuration file and go
; without loading the overlay.
; add filename extension to path
; mov di,offset programName
lea di,programName
add di,prgmNameLen
mov al,'C' ; add CFG extension
stosb
mov al,'F'
stosb
mov al,'G'
stosb
mov al,0h
stosb
; try to open the configuration file
; mov dx,offset programName
lea dx,programName
mov ah,3Dh ; int 21h function 3Dh - Open a file
mov al, 00000000b ; inherited, compatibility mode, read access
int 21h
mov handle,ax ; save handle to file
jnc runWithCFGfile100 ; jump if no error
; error of some type detected. Close file and run ovl
mov ah,3Eh ; int 21h function 3Eh - Close a File handle
mov bx,handle
int 21h
display error0Msg
stc
jmp runWithCFGfileDone ; run overlay, probably no cfg file
runWithCFGfile100:
; read file into buffer
mov cx,_dataBlockSize ; get size of buffer
; mov dx,offset transferBuf
lea dx,transferBuf
mov ah,3Fh ; int 21h function 3Fh - Read from a file or device
mov bx,handle ; get handle to file
int 21h
cmp ax,_dataBlockSize ; see how many bytes read
je runWithCFGfile200 ; jump if ok
; something is wrong with the config file. Close it and run ovl
mov ah,3Eh ; int 21h function 3Eh - Close a File handle
mov bx,handle
int 21h
display error0aMsg ;
stc
jmp runWithCFGfileDone ; run overlay, probably no cfg file
runWithCFGfile200:
; Bytes have been read into buffer. Close file
mov ah,3Eh ; int 21h function 3Eh - Close a File handle
mov bx,handle
int 21h
jnc runWithCFGfile300 ; jump if no error
display error0bMsg ; display error and continue
runWithCFGfile300:
; now store data in shared parameter block
; set up so ds:si = source (ds = this instance)
; es:di = destin (es = first instance)
lea si,transferBuf
mov di,offset _dataBlock
mov cx,_dataBlockSize
cld
cli ; don't want to upset ADOS if interrupts come along
rep movsb
mov fDialog_Filter_off,true
mov fDialog_Stickeys_off,true
mov fDialog_Mouse_off,true
mov fDialog_Toggle_off,true
mov fDialog_TimeOut_off,true
mov fDialog_Action,true
sti
clc
jmp runWithCFGfileDone
runWithCFGfileDone:
ret
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC runOverlay
runOverlay proc near
call freeMemory
jnc runOverlay20
display error1Msg
mov status,ABORTACCESS
jmp runOverlayDone
runOverlay20:
call spawnChild
jnc runOverlay40
display error2Msg
mov status,ABORTACCESS
jmp runOverlayDone
runOverlay40:
mov ah, 4dh ; get return code
int 21h
cmp al, ABORTACCESS ; Does user want to abort ACCESS?
jne runOverlay60
mov status,ABORTACCESS
jmp runOverlayDone
runOverlay60:
cmp al, INSTALLACCESS ; load access?
jne runOverlay80
mov status,INSTALLACCESS
jmp runOverlayDone
runOverlay80:
mov status,ABORTACCESS
jmp runOverlayDone
runOverlayDone:
ret
runOverlay endp
;----------------------------------------------------------------------
; freeMemory returns carry set if error
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC freeMemory
freeMemory proc near
mov bx, offset _end ; free memory for child process
mov cl, 4
shr bx, cl
inc bx ; add 1 paragraph for rounding
mov ah, 4Ah
int 21h
; returns code in carry bit
ret
freeMemory endp
;----------------------------------------------------------------------
; spawnChild returns carry set if error
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC spawnChild
spawnChild proc near
; add filename extension to path
; mov di,offset programName
lea di,programName
add di,prgmNameLen
mov al,'O' ; add OVL extension
stosb
mov al,'V'
stosb
mov al,'L'
stosb
mov al,0h
stosb
mov ax, cs ; set up parameter block for child process
mov cmd_seg, ax
mov fcb1_seg, ax
mov fcb2_seg, ax
lea ax,cmd_buf
mov cmd_ofs,ax
lea dx,programName ; ds:dx points to program name
lea bx,param_block ; es:bx points to parameter block
mov saveStackPtr,sp ; save the stack pointer
mov saveStackSeg,ss
mov ax, 4b00h ; execute child process
int 21h
cli
assume es:nothing
assume ds:nothing
assume ss:nothing
mov ss, cs:saveStackSeg ; seg reg done first so no interrupt
mov sp, cs:saveStackPtr ; until after the next instruction
mov cx, cs ; restore segment regs and stack
mov ds, cx
mov es, cx
assume es:DGROUP
assume ds:DGROUP
assume ss:DGROUP
sti
; returns code in carry bit
ret
spawnChild endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC updateAndTSR
updateAndTSR proc near
;this is the first instance so we already have segment register
mov fAccessAlreadyLoaded, true ; set fAccessAlreadyLoaded (in Shared Parameter Block) to true
cmp fcomputer_not_found, false ; if computer was not found, we must call Find_Computer again
je updateAndTSR20
call _FindComputer
updateAndTSR20:
call Enable ; initialize Handicap and SerialKeys features
display cs:residentMsg
cmp _serialKeysOn,true ; is SerialKeys code installed ?
je updateAndTSR100 ; yes, do TSR at _end
; if not, do TSR at
mov dx,offset last_address ; last_address which is in TimeOut
; last file of keyboard/mouse linked
mov fserial_keys_loaded,false ; set to false if SerialKeys not initially loaded
jmp short updateAndTSR200
updateAndTSR100:
mov fserial_keys_loaded,true ; set to true if SerialKeys is initially loaded
test cmdLineSwitch,SERIALKEYSPARAM
jz updateAndTSR150
test skCmdLineSwitch,SKSINGLEUSER
jz updateAndTSR150
mov _singleUserSetup,true
jmp updateAndTSR155
updateAndTSR150:
mov _singleUserSetup,false
updateAndTSR155:
; mov dx, offset _end
; mov dx, offset throwAwayAddr
lea dx,throwAwayAddr
updateAndTSR200:
mov cl,4
shr dx,cl
inc dx ; dx # of paragraphs
inc dx
mov ax,3100H
int 21H ;TSR
; don't come back unless error of some sort?
ret
updateAndTSR endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC updateAndExit
updateAndExit proc near
display cs:exitMsg
mov es,segOfFirstInst ; get segment of dataBlock, 1st instance
assume es:nothing
cmp es:fserial_keys_loaded,true ; was serial keys loaded
je updateAndExit50 ; jmp if YES
jmp updateAndExitDone ; nothing to update so just exit
updateAndExit50:
; if we get here, fserial_keys_loaded must be true, this means AccesDOS must have been loaded, and SerialKeys
; was installed. Therefore, whenever we exit again, we must check if we need to disable SerialKeys or re-enable it
; in case the user choose to turn SerialKeys On/Off from the menu !!!
; We also have to check for command line switches and change globals accordingly
; assume no switches so change settins back to default
mov es:_singleUserSetup,false
mov es:_skWindowCompatible,false
test cmdLineSwitch,SERIALKEYSPARAM ; any serial keys stuff
jz updateAndExit150 ; jump if NO serial keys switches
test skCmdLineSwitch,SKSINGLEUSER ; single user request?
jz updateAndExit100 ; jump if NOT single user
mov es:_singleUserSetup,true ; set single user flag
updateAndExit100:
; for the rest of the flags more than one on the command line doesn't make sense
; so we will accept only one in the following priority- enable, disable, windows compatible
test skCmdLineSwitch,SKENABLE ; enable serial keys with current settings
jz updateAndExit105 ; jump if NO
mov es:_serialKeysOn,true ; set global flag ON
jmp updateAndExit150
updateAndExit105:
test skCmdLineSwitch,SKDISABLE ; disable serial keys
jz updateAndExit110 ; jump if NO
mov es:_serialKeysOn,false ; set global flag OFF
jmp updateAndExit150
updateAndExit110:
test skCmdLineSwitch,SKWINDOWS ; disable serial keys for windows batch file
jz updateAndExit150 ; jump if NO
mov es:_serialKeysOn,false ; turn serial keys OFF
mov es:_skWindowCompatible,true ; set WINDOWS flag ON so DOS SHELL will run serial keys
updateAndExit150:
mov ax,es
mov cs:serkeyRoutSeg,ax ; set up segment of enable/disable routines
cmp es:_serialKeysOn,true ; should serial keys be ON
jne updateAndExit225 ; jump if NO
mov cs:serkeyRoutOfs,offset _serialKeysEnableFar
call dword ptr cs:serkeyRoutine ; make sure serial keys is ON
jmp updateAndExitDone
updateAndExit225:
mov serkeyRoutOfs,offset _serialKeysDisableFar
call dword ptr cs:serkeyRoutine ; make sure serial keys is OFF
jmp updateAndExitDone
updateAndExitDone:
push cs
push cs
pop es
pop ds
ret
updateAndExit endp
;----------------------------------------------------------------------
assume cs:DGROUP
assume es:_TEXT
assume ds:_TEXT
assume ss:_TEXT
PUBLIC cancelAccess
cancelAccess proc near
; if already Loaded, then cancel simply means quit,
; otherwise cancel means remove our routine
cmp alreadyLoaded,false
je cancelAccess10 ; jump if not already loaded
cmp inhibitmessage,true
je cancelAccess5
display cs:exitMsg
cancelAccess5:
mov inhibitmessage,false ; reset
jmp cancelAccessDone
cancelAccess10:
cmp inhibitmessage,true
je cancelAccess15
display cs:removeHelperMsg
cancelAccess15:
mov inhibitmessage,false ; reset
mov ah, 25h ; Set interrupt Vector
mov al, tempIntNumber
mov dx, cs:orgIntOffset
mov bx, cs:orgIntSegment ; remove our TSR and replace original
push ds
mov ds, bx
assume ds:nothing
int 21h
pop ds
assume ds:DGROUP
cancelAccessDone:
ret
;exit
cancelAccess endp
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; Equipment check starts here
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
assume cs:DGROUP
assume ds:nothing
assume es:nothing
assume ss:nothing
;;mesg00 DB 13, 10, 13, 10, "$"
mesg0 DB "Mouse driver not found", 13, 10, "$"
mesg1 DB "Mouse not found", 13, 10, "$"
mesg2 DB "Mouse found and reset", 13, 10, "$"
mesg3 DB "A bus mouse was found", 13, 10, "$"
mesg4 DB "A serial mouse was found", 13, 10, "$"
mesg5 DB "An InPort mouse was found", 13, 10, "$"
mesg6 DB "A PS/2 mouse was found", 13, 10, "$"
mesg7 DB "A HP mouse was found", 13, 10, "$"
mesg8 DB "Mouse type found was not recognized", 13, 10, "$"
;;mesg9 DB "Com Port 2 Int. enabled, serial mouse is here", 13, 10, "$"
;;mesg10 DB "Com Port 1 Int. enabled, serial mouse is here", 13, 10, "$"
mesg11 DB "Mouse type found is not currently supported", 13, 10, "$"
mesg14 DB "Computer ID is an IBM PS/2 Model L40SX, 55SX, 65SX, 70, 80, 90 or 95 ", 13, 10, "$"
mesg15 DB "Computer ID is an IBM PS/1 or PS/2 Model 25/30-80286, 50, 50Z, or 60", 13, 10, "$"
mesg15A DB "Computer ID is an IBM AT or equivalent compatible", 13, 10, "$"
mesg15B DB "Computer ID is an IBM New AT/XT or equivalent 286/386/... compatible", 13, 10, "$"
mesg16 DB "Computer ID is an IBM PS/2 Model 25/30-8086", 13, 10, "$"
mesg17 DB "Computer ID is an IBM Original AT with 84 key keyboard", 13, 10, "$"
mesg17A DB "Computer ID is an IBM Original AT with 101 key keyboard", 13, 10, "$"
mesg18 DB "Computer ID is an IBM PC Convertible and is not supported", 13, 10, "$"
mesg19 DB "Computer ID is an IBM PC Junior and is not supported", 13, 10, "$"
mesg20 DB "Computer ID is an IBM New PC/XT", 13, 10, "$"
mesg21 DB "Computer ID is an IBM PC or an Original IBM PC/XT", 13, 10, "$"
mesg30 DB "The serial mouse was found to be attached to COMM port 2", 13, 10, "$"
mesg31 DB "The serial mouse was found to be attached to COMM port 1", 13, 10, "$"
mesg32 DB "Computer type found to support Inject Keys routine", 13, 10, "$"
mesg33 DB "Extended BIOS data area not found, PS/2 style MouseKeys not supported, try Serial Mouse", 13, 10, "$"
mesg47 DB "Your computer supports int 15h calls", 13, 10, "$"
mesg48 DB "Your computer supports the Extended BIOS data area", 13, 10, "$"
mesg49 DB "A CGA monitor was detected", 13, 10, "$"
mesg50 DB "A EGA monitor was detected", 13, 10, "$"
mesg51 DB "A VGA monitor was detected", 13, 10, "$"
mesg52 DB "A Monochrome monitor was detected", 13, 10, "$"
mesg53 DB "A MCGA monitor was detected", 13, 10, "$"
mesg55 db "Your serial mouse is runnning at 300 BAUD", 13, 10, "$"
mesg22 DB "Computer was not identifiable and will be treated as a PC/XT/AT with an 84 key keyboard.", 13, 10, "$"
mesg22A DB "Please restart AccessDOS menu, type ados, to change this selection if your ", 13, 10, "$"
mesg22B DB "computer is NOT a PC/XT/AT with an 84 key keyboard.", 13, 10, "$"
mesg70 DB "AccessDOS detected DOS keyb.com to be running.", 13, 10, "$"
;j1 DB "step1", 13, 10, "$"
;j2 DB "step2", 13, 10, "$"
;j3 DB "step3", 13, 10, "$"
;j4 DB "step4", 13, 10, "$"
bios_table label byte
db "01/10/84" ; OldAT
db "06/10/85" ; AT239
db "11/15/85" ; AT339
db "04/21/86" ; XT286
NOMOUSE equ 0
BUSMOUSE equ 1
SERIALMOUSE equ 2
INPORTMOUSE equ 3
PS2MOUSE equ 4
HPMOUSE equ 5
print MACRO string
; mov dx,OFFSET string
lea dx,string
mov ah,9
int 21h
ENDM
;----------------------------------------------------------------------------
; Find_Mouse
;
; This routine determines if a valid mouse driver is loaded, and what kind of hardware
; mouse is attached to the computer. It was intended to be called prior to loading
; AccessDos, and therefore if a mouse was found and identified, MouseKeys would be
; allowed to work. By blocking it out into seperate code, I can now call it any time,
; and therefore, the mouse driver could be loaded after AccessDos, and we could still
; use MouseKeys.
;
; Determine presence of MOUSE driver (from Microsoft's mouse prog. ref.)
; check first for a valid mouse interrupt
PUBLIC _FindMouse
_FindMouse proc near
push si ; save registers
push di
push ax
push bx
push cx
push dx
push ds
push es
mov ax, cs ; set up data segment
mov ds, ax
assume ds:DGROUP
mov ax,3533h ; get int. 33h vector
int 21h
assume es:nothing
mov ax,es
or ax,bx
jz no_mouse_driver
cmp byte ptr es:[bx],207 ; iret?
jne mouse_reset
no_mouse_driver:
cmp _debug, false
je debug_0
print mesg0
debug_0:
mov fmouse_driver,false
mov _fmouse_id,false ; if mouse not found, keep fmouse_id=0
jmp mouse_driver_end
mouse_reset:
xor ax,ax
int 33h ; check to see if mouse found
or ax,ax ; if mouse not found, ax will = 0
jnz mouse_found
cmp _debug, false
je debug_1
print mesg1
debug_1:
mov fmouse_driver,false
jmp mouse_driver_end
mouse_found:
cmp _debug, false
je debug_2
print mesg2
debug_2:
; determine which type of mouse was found
mov ax,36 ; get version, mouse type and IRQ #
int 33h ; call int, mouse type is returned in "Ch" register
cmp ch,BUSMOUSE ; was it a bus mouse
jne mou_drv_5
cmp _debug, false
je debug_3
print mesg3
print mesg11
debug_3:
jmp mouse_driver_end
mou_drv_5:
cmp ch,SERIALMOUSE
je mou_drv_5B
jmp mou_drv_10
mou_drv_5B:
cmp _debug, false
je debug_4
print mesg4
debug_4:
mov _fmouse_id,SERIALMOUSE
mov fmouse_driver,true
mov btn_1,20h ; define mouse btn_1
mov btn_2,10h ; define mouse btn_2
mov Current_Button,20h ; default to left button
; find out which int. we are using so we can identify which COMM port the mouse is attached to ???
; check which int. number was returned so we can load the correct COMM port address for the serial mouse
cmp cl,3 ; if cl=3, then the mouse was found on COMM 2 or 4
jne mou_drv_5A
mov _combase,02f8h ; set for COM 2
cmp _debug, false
je debug_5
print mesg30
debug_5:
jmp short mou_drv_6
mou_drv_5A:
mov _combase,03f8h ; set for COM 1
cmp _debug, false
je debug_6
print mesg31
debug_6:
mou_drv_6:
; One more check to look for a slow (300 baud) serial mouse
cli ; prevent interrupts while changing registers in serial port
mov dx,_combase
add dx,3
in al,dx ; get line control register
mov ah,al ; save status in ah for later restore
or al,080h ; prepare to set bit 7 high
out dx,al ; write to line control register so we can read lsb/msb of divisor latch
mov dx,_combase
in al,dx ; get LSB
mov bl,al ; save in bl
inc dx
in al,dx ; get MSB
mov bh,al ; save in bh
mov al,ah ; get saved status of line control register
mov dx,_combase
add dx,3
out dx,al ; restore line control register
sti ; re-enable interrupts
; Now check divisor in bh,bl and see if 300 Baud (384d or 180h), 1200 Baud (96d or 60h) or 2400 Baud (48d or 30h)
; Really only concerned with 300 Baud, so we will look for bh=01h,bl=80h for 300 Baud and set a flag if we find it
cmp bh,01h ; is this 300 baud ?
jne mou_drv_7
cmp bl,80h ; ""
jne mou_drv_7
mov fslow_baud_mouse,true ; flag that we found a slow 300 buad rate mouse
cmp _debug,false
je mou_drv_7
print mesg55 ; print out message that we found a slow mouse
mou_drv_7:
jmp mouse_driver_end
;-----------------------------------------------------------------------------
mou_drv_10:
cmp ch,INPORTMOUSE
jne mou_drv_15
cmp _debug, false
je debug_7
print mesg5
print mesg11
debug_7:
jmp mouse_driver_end
mou_drv_15:
cmp ch,PS2MOUSE
jne mou_drv_20
cmp _debug, false
je debug_8
print mesg6
debug_8:
mov _fmouse_id,PS2MOUSE
mov fmouse_driver,true
;initialize or get mouse driver location for use later when MouseKeys is called
sub ax,ax ; zero ax
mov ah,0c1h ; preload ah with "c1"
int 15h ; call int15 to get segment of mouse driver
jc mou_drv_18 ; if call returns and carry flag set, erro occurred, flag it and exit
mov ax,es ; load mouse driver segment address into variable extendseg
mov ExtendedSeg,ax
mov btn_1,1 ; define mouse btn_1
mov btn_2,2 ; define mouse btn_2
mov Current_Button,01h ; default to left button
jmp mouse_driver_end
mou_drv_18:
cmp _debug, false
je debug_9
print mesg33
debug_9:
jmp mou_drv_26
mou_drv_20:
cmp ch,HPMOUSE
jne mou_drv_25
cmp _debug, false
je debug_10
print mesg7
print mesg11
debug_10:
jmp mouse_driver_end
mou_drv_25:
cmp _debug, false
je debug_11
print mesg8
debug_11:
mou_drv_26:
mov fmouse_driver,false
mov _fmouse_id,false ; if mouse found but not recognized, keep fmouse_id=0
mouse_driver_end:
pop es ; restore registers
pop ds
pop dx
pop cx
pop bx
pop ax
pop di
pop si
ret
_FindMouse endp
;----------------------------------------------------------------------------
; Find_Computer
;
; Determine computer type. For a complete computer ID list, see Keyboard.Inc file
; This routine was designed to call the ROM to determine what kind of computer
; that AccessDos was being installed on. This is necessary to set up various flags
; that are required through the routines.
;
; With the use of int15, ah=0C0h, we can poll the hardware and check the computer ID, submodel,
; etc. just as easily, so we start out this way. If it is determined that the computer
; does not support int 15h, then the calls to the ROMBIOS are made directly.
;
;--------------------------------------------------
; Need to add the ability to set neither/either/ or both computer flags for various other routine
; which follow the comp_id needs
;--------------------------------------------------
PUBLIC _FindComputer
_FindComputer proc near
;-----------------------------------------------------------------------------
; Find out if computer supports int 15h calls. Upon return , if the Carry flag is set,
; (i.e. CF=1), then it definitely does not support int 15h calls. If the Carry Flag is clear
; (i.e. CF=0), then we must query deeper into a data block to determine if int 15h is supported.
; This is also a traditional call for computer ID bytes.......
assume cs:DGROUP
assume ds:nothing
assume es:nothing
assume ss:nothing
push si ; save registers
push di
push ax
push bx
push cx
push dx
push ds
push es
mov ax, cs ; set up data segment
mov ds, ax
assume ds:DGROUP
mov ah,0c0h ; load Ah register with C0h
int 15h ; try an int 15
assume es:nothing
cmp ah,0 ; if ah = 0, then we can check further
je FC_3 ; if zero, we can check for other flags
; if NOT zero, then Int 15 NOT supported, set vector and jump ahead
FC_2:
; last resort, check if DOS 4.0+/5.0.. is running with keyb.com, as it doesn't change ROM table which int 15h, with
; C0h would test, just replaces int 9h, with an int 9/int15h equivalent, and we could use the int 15h intercept
; if we can detect keyb.com running. We can check for this by using int 2Fh, with "ax"= AD80h. IF "ax" comes back unaltered,
; then keyb.com is not loaded, if "ax" comes back as ffffh, then keyb.com is loaded, and we should use int 15h intercept...
mov ax,0AD80h ; request for kryb.com info ??
int 2Fh ; interrrupt
cmp ax,0ffffh ; is keyb.com loaded
jne FC_2A ; if yes, use int. 15h intercept
cmp _debug,false
je FC_4
print mesg70 ; inform us that DOS keyb.com is running
jmp short FC_4
FC_2A:
mov _vector,09h ; kybd must use int. vector 09
jmp FC_100 ; no need to check data area and PS/2 computer,
FC_3:
mov ah,es:[bx+5] ; get descriptor byte that will tell us if int15h supported
test ah,10h ; mask off bit 4
jz FC_2 ; if zero, bit 4 not set and int 15h intercept not supported, go back to int 9h
FC_4:
mov _vector,15h ; kybd can use int. vector 15
cmp _debug, false
je debug_12
print mesg47
mov ah,es:[bx+5] ; get descriptor byte again since print wiped out Ah register
test ah,04h ; mask off bit 2
jz FC_10
print mesg48
debug_12:
FC_10:
; Is the operator overriding the computer type ?
cmp fcomp_dialog,true ; has the computer type been over ridden by user from dialog box ??
jne FC_20 ; if not use int 15h to cont
jmp FC_200 ; if yes, cont. here
FC_20:
;------------------------------------------------------------------------------------------------------------------------------------------
; IBM PS/1 and PS/2 determination done here
;------------------------------------------------------------------------------------------------------------------------------------------
xor ax,ax ; zero ax register
mov al,es:[bx+2] ; get model byte
cmp al,0f8h ; DO WE HAVE A MODEL 55sx,65sx,70,80,90,95,L40sx ???
jne FC_23
;; jmp FC_175 ; debug code to force computer not found on model 55, 70, 80
mov _comp_id,8 ;
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
cmp _debug, false
je debug_13
print mesg14
debug_13:
mov _finject_keys,true ; flag to tell us the computer supports key injection at keyboard hardware buffer
cmp _debug, false
je debug_14
print mesg32
debug_14:
jmp FC_end
FC_23:
cmp al,0fch ; DO WE HAVE A MODEL PS/1, 25/286, 30/286, 50, 60 or IBM New XT/AT ???
je FC_24
jmp FC_30
FC_24:
; if we have a PS/1 or PS/2 Model 25/30-286, 50, 60, then we can inject. If we have either the New XT/286
; or New AT 339, we CANNOT inject at the hardware but may use int15h. We need to look at the sub model byte
; to determine this.
mov al,es:[bx+3] ; get submmodel byte
cmp al,0Bh ; was it a PS/1 ?
je FC_25
cmp al,04h ; was it a PS/2 Model 50,50z ?
je FC_25
cmp al,05h ; was it a PS/2 Model 60 ?
je FC_25
cmp al,09h ; was it a PS/2 Model 30/286 or 25/286 ?
jne FC_27
FC_25:
cmp _debug, false
je debug_15
print mesg32
debug_15:
mov _comp_id,7 ; PS1, 25/30-386,50,60,50Z,
mov _finject_keys,true ; flag to tell us the computer supports key injection at keyboard hardware buffer
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
cmp _debug, false
je debug_16
print mesg15
debug_16:
jmp FC_end
FC_27:
; turns out that only IBM's will allow the write/read ot the 8042 trick, therefore, I will check if we
; have an IBM Old AT, New AT (2 models) or a New XT, if not I will distinguis with another _comp_id value of 5Bh
; Also turns out that CLONES compy the FC,submodel,and revision such that I cannot distinguish between them. THe only other method I
; know of, is to look at the actual BIOS dates, saved as strings above 90-7 characters)
;
; OldAT,AT239,AT339,XT286
mov ax,ROMBIOS ; Load segment location into
mov es,ax ; ES register also
xor ax,ax
xor di,di
xor dx,dx
xor si,si
string_5:
xor bx,bx
mov cx,8
string_6:
mov al,es:computer_bios_date[bx]
; mov dl,offset bios_table[si]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov dl,bios_table[si]
cmp al,dl
jne string_10
dec cx
cmp cx,0
je FC_27A
inc bl
inc si
jmp string_6
string_10:
inc di
cmp di,4
je string_20
xor si,si
mov si,di
mov cx,3
shl si,cl
jmp string_5
string_20:
mov _comp_id,5Bh ; we have a CLONE !!!stick with reading 8042 status method
jmp short FC_28
FC_27A:
mov _comp_id,5Ah ; we have an New XT/AT, Clone, or Old AT running DOS 4+/5 w/keyb.com
FC_28:
;Need to check if we have 84 or 101 style kybd before we allow next flag to be set
; since the AT-239 (i.e I think this is the 6/10/85 BIOS date) supportes int 15h but may use an 84
; key keyboard. Most clones of 286 or higher will probably be using 101 key keyboard, but this simple check
; should tell us
mov ax,RAMBIOS ; Load segment location into
mov es,ax ; ES register also
mov al,es:[kb_flag_3] ; get 40:96h contents
test al,010h ; mask off bit 4, 101/102 kybd id bit
jnz FC_29 ; if not ZERO, bit is set and we have 101 kybd
cmp _debug, false
je debug_17
print mesg15A
debug_17:
jmp FC_end
FC_29:
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
cmp _debug, false
je debug_18
print mesg15B
debug_18:
jmp FC_end
FC_30:
cmp al,0fah ; DO WE HAVE A MODEL 25/86 or 30/86 ???
jne FC_40
FC_32:
mov _comp_id,6 ;
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
cmp _debug, false
je debug_19
print mesg16
debug_19:
jmp FC_end
FC_40:
cmp al,0fbh ; DO WE HAVE A New IBM PC/XT ???
jne FC_50
mov _comp_id,2 ;
mov ax,RAMBIOS ; Load segment location into
mov es,ax ; ES register also
mov al,es:[kb_flag_3] ; get 40:96h contents
test al,010h ; mask off bit 4, 101/102 kybd id bit
jz FC_45 ; if ZERO, bit is clear and we do not have 101 kybd
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
cmp _debug, false
je debug_20
print mesg20
debug_20:
FC_45:
jmp FC_end
FC_50:
;******************************************************************************************************************************************
; If we get here, we have exhausted all IBM combinations of int15h computers that can do the key injection either
; first by the hardware or second by the writing/reading from the 8042. Note above, the only way the Old AT (1/10/84)
; can do int15h is with DOS 4+/5 and keyb.com running. Also Note, that the only reason the OldAT gets caught above
; is that it has the same default ID byte, "FC", as a new AT. Unfortunately, any other computer running
; will not be ID'ed in ROM, but may have been decidedly made an int 15h computer via keyb.com. There-
; fore, I will need to go direct to the hardware ID byte and check further for these int 15h computers.
;
; Any IBM computers found beyond this point supporting int15h, are doing so
; because they are running DOS 4+/5 w/keyb.com loaded. Since we already caught the Old AT, all that is left that we will support
; is the original PC or PC/XT (do not support PCjr or PCconv.). I treat the PC and PC/XT as a computer ID of 1, so I can catch them both
; if I call them something like 1A...Beyond this check, we should jump to FC_175 for un ID'ed computer running int 15h.
mov ax,ROMBIOS ; Load segment location into
mov es,ax ; ES register also
xor ax,ax
mov al,es:[computer_model_id]
cmp al,0feh ; Do we have an old XT
jne FC_52
jmp short FC_55
FC_52:
cmp al,0ffh ; Do we have an old PC
jne FC_60
FC_55:
mov _comp_id,1Ah ;
mov ax,RAMBIOS ; Load segment location into
mov es,ax ; ES register also
mov al,es:[kb_flag_3] ; get 40:96h contents
test al,010h ; mask off bit 4, 101/102 kybd id bit
jz FC_58 ; if ZERO, bit is clear and we do not have 101 kybd
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
cmp _debug, false
je debug_21
print mesg21
debug_21:
FC_58:
jmp FC_end ; go check video
FC_60:
jmp FC_175 ; computer type not found above
;------------------------------------------------------------------------------------------------------------------------------------------
; NON IBM PS/1 and PS/2 determination done here
;------------------------------------------------------------------------------------------------------------------------------------------
; If we junp to here, int 15h not supported, vector = 09h, and we nust go directly to the
; hardware to try to ID the ocmputer
FC_100:
mov ax,ROMBIOS ; Load segment location into
mov es,ax ; ES register also
xor ax,ax
mov al,es:[computer_model_id]
cmp al,0fch ; do we have Orig AT ?
jne FC_110
mov _comp_id,5 ; we have an Original IBM AT
mov ax,RAMBIOS ; Load segment location into
mov es,ax ; ES register also
mov al,es:[kb_flag_3] ; get 40:96h contents
test al,010h ; mask off bit 4, 101/102 kybd id bit
jz FC_105 ; if ZERO, bit is clear and we do not have 101 kybd
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
cmp _debug, false
je debug_22
print mesg17A
jmp FC_end
FC_105:
cmp _debug, false
je debug_22
print mesg17
debug_22:
jmp FC_end
FC_110:
cmp al,0f9h ; DO WE HAVE AN IBM CONVERTIBLE ???
jne FC_120
mov _comp_id,4 ;
cmp _debug, false
je debug_23
print mesg18
debug_23:
jmp FC_end
FC_120:
cmp al,0fdh ; DO WE HAVE AN IBM PC/JR ???
jne FC_130
mov _comp_id,3 ;
cmp _debug, false
je debug_24
print mesg19
debug_24:
jmp FC_end
FC_130:
FC_135:
cmp al,0feh ; DO WE HAVE AN IBM PC OR Original PC/XT ???
jne FC_140
mov _comp_id,1 ;
mov ax,RAMBIOS ; Load segment location into
mov es,ax ; ES register also
mov al,es:[kb_flag_3] ; get 40:96h contents
test al,010h ; mask off bit 4, 101/102 kybd id bit
jz FC_136 ; if ZERO, bit is clear and we do not have 101 kybd
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
FC_136:
cmp _debug, false
je debug_25
print mesg21
debug_25:
jmp FC_end
FC_140:
cmp al,0ffh ; DO WE HAVE AN IBM PC OR Original PC/XT ???
jne FC_175
cmp _debug, false
je debug_26
print mesg21
debug_26:
mov _comp_id,1 ;
mov ax,RAMBIOS ; Load segment location into
mov es,ax ; ES register also
mov al,es:[kb_flag_3] ; get 40:96h contents
test al,010h ; mask off bit 4, 101/102 kybd id bit
jz FC_145 ; if ZERO, bit is clear and we do not have 101 kybd
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
FC_145:
jmp FC_end
;--------------------------------------------------------
; Computer not ID'ed above
;--------------------------------------------------------
FC_175:
print mesg22
print mesg22A
print mesg22B
mov fcomputer_not_found,true ; flag back to menu that computer OPTIONS need to be displayed now
mov _comp_id,1 ; default to a PC if not ID'able
mov fcomp_dialog_id, 1
mov comp_flag,false ; reset flag incase user chose or chooses again
mov _finject_keys,false
jmp FC_end
FC_200:
; The operator chose a computer from the menu, and we should setup our variables here
; vector will get set by the computer regardless of the operator setting
mov fcomp_dialog,false ; reset flag incase user chose or chooses again
mov fcomputer_not_found,false ; reset this flag since user choose a computer
mov al,fcomp_dialog_id ; get user choice
cmp al,1 ; did user choose clone PC/PCXT/PCAT w/84 key keyboard
jne FC_210
mov _comp_id,1
jmp short FC_end
FC_210:
; user must have choose 2 or 3, 2=clone PC/AT w/101 key keyboard, 3=clone PC/386 w/101 key keyboard
mov _comp_id,5
mov ax,RAMBIOS ; Load segment location into
mov es,ax ; ES register also
mov al,es:[kb_flag_3] ; get 40:96h contents
test al,010h ; mask off bit 4, 101/102 kybd id bit
jz FC_end ; if ZERO, bit is clear and we do not have 101 kybd
mov comp_flag,true ; flag to tell us that we have a computer which supports BIOS kb_flag_1/3
FC_end:
;*****************************************************************************************************************
; quick check of video
;*****************************************************************************************************************
; Video type is a mess to sort out. What I will do is check the PS/2 sytems first, and if they are not supported, I will
; make a different int 10h function call and try to decipher what other video combinations I have.
; We will determine eqVideoType as follows
;
; 1=monocrome display adapter
; 2= open
; 3= CGA
; 4= EGA mono
; 5= EGA color
; 6= MCGA (multi color graphics adapter ) special PS/2, usually 25/30-8086
; 7= VGA
; For PS/2, we can call int 10h with function 1Ah in ah, if it comes back 1Ah, we know it was a PS/2 and that
; the function is supported.
mov al,0h ; read dispaly code
mov ah,1ah ; PS/2 read display code function
int 10h
cmp al,1Ah ; was function call supported ?
je FC_end_ps2
jmp FC_end_12 ; if not, not a PS/2 so try another int 10h function call
FC_end_ps2:
cmp bl,01h
jne FC_end_2
mov fvideo_type,1 ; was monochrome (5151)
cmp _debug, false
je debug_27
print mesg52
debug_27:
jmp FC_end_50
FC_end_2:
cmp bl,02h
jne FC_end_4
mov fvideo_type,3 ; was CGA
cmp _debug, false
je debug_28
print mesg49
debug_28:
jmp FC_end_50
FC_end_4:
cmp bl,04h
jne FC_end_6
mov fvideo_type,5 ; was EGA color
cmp _debug, false
je debug_29
print mesg50
debug_29:
jmp FC_end_50
FC_end_6:
cmp bl,05h
jne FC_end_8
mov fvideo_type,4 ; was EGA mono
cmp _debug, false
je debug_30
print mesg50
debug_30:
jmp FC_end_50
FC_end_8:
cmp bl,06h
jne FC_end_10
mov fvideo_type,6 ; was MCGA """GUESSING"""
cmp _debug, false
je debug_31
print mesg53
debug_31:
jmp FC_end_50
FC_end_10:
; above bl=6, is unused or VGA
mov fvideo_type,7 ; was VGA
cmp _debug, false
je debug_32
print mesg51
debug_32:
jmp FC_end_50
; non PS/2 jump to here to be determined ???
FC_end_12:
mov ah,12h ; next try int 10h function "ah"=12h
mov bl,10h ; and ask for EGA info if it exists
int 10h
cmp bl,10h ; if upon return bl does not = 10h, then EGA is present
je FC_end_18
cmp bh,0
jne FC_end_15
mov fvideo_type,5 ; was EGA color
cmp _debug, false
je debug_34
print mesg50
debug_34:
jmp short FC_end_50
FC_end_15:
mov fvideo_type,4 ; was EGA mono
cmp _debug, false
je debug_34A
print mesg50
debug_34A:
jmp short FC_end_50
FC_end_18:
; didn't find VGA or EGA, could still be CGA or MDA ? Need to check presence
; of video buffers, 0B8000h or 0B0000h to determine which one....
; Since I am currently unsure as to just what this test is, I think I will query
; using int 11h, and see if mono is set
;
; int 11h ; get equioment list
; test al,00110000b ; check bits 5,4
; jz FC_end_20
; mov fvideo_type,1 ; was MDA
; cmp _debug, false
; je debug_40
; print mesg52
;debug_40:
; jmp short FC_end_50
;
;FC_end_20:
;
; the video mode with function "0fh', int 10h, and if it is in mode 7, I will
; say MDA, otherwise the monitor is or can support CGA
mov ah,0fh
int 10h
cmp al,7
jne FC_end_22
mov fvideo_type,1 ; was MDA
cmp _debug, false
je debug_42
print mesg52
debug_42:
jmp short FC_end_50
FC_end_22:
; give up, if PS/2 it was found above, if EGA, it was found above, if MDA, one of the above
; tests should have found it, if not any of the above, make a CGA and quit
mov fvideo_type,3 ; was CGA,or operating at CGA resolution
cmp _debug, false
je debug_33
print mesg49
debug_33:
FC_end_50:
pop es ; restore registers
pop ds
pop dx
pop cx
pop bx
pop ax
pop di
pop si
ret
_FindComputer endp
_BSS ends
end
|
programs/oeis/081/A081057.asm | karttu/loda | 0 | 97802 | <filename>programs/oeis/081/A081057.asm
; A081057: E.g.f.: Sum_{n>=0} a(n)*x^n/n! = {Sum_{n>=0} F(n+1)*x^n/n!}^2, where F(n) is the n-th Fibonacci number.
; 1,2,6,18,58,186,602,1946,6298,20378,65946,213402,690586,2234778,7231898,23402906,75733402,245078426,793090458,2566494618,8305351066,26876680602,86974765466,281456253338,910811568538,2947448150426
lpb $0,1
sub $0,1
mul $1,2
mov $3,$2
add $3,$2
mov $2,$1
mov $1,$3
add $2,1
add $1,$2
lpe
add $1,1
|
07/StackArithmetic_tests/SimpleAdd/SimpleAdd.asm | ashiroji/Nand2Tetris | 0 | 82443 | //push constant 7
@7 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//push constant 8
@8 //A=index
D=A //D is now the constant
@SP
A=M //A = @SP
M=D //M[A] = value to push
@SP
M=M+1 //sp+1
//add
@SP
AM=M-1 //AM[SP] = M[SP] - 1 e.g @y
D=M //D=M[A] e.g y
A=A-1 //A = @y - 1 e.g @x
M=D+M //M[@x] = y + M[@x]
|
CP/Session2.agda | banacorn/bidirectional | 2 | 3898 | <filename>CP/Session2.agda
open import Relation.Binary using (Decidable; DecSetoid)
open import Level
module CP.Session2 {a} (ChanSetoid : DecSetoid zero a) (Type : Set) where
Chan : Set
Chan = DecSetoid.Carrier ChanSetoid
_≟Chan_ = DecSetoid._≟_ ChanSetoid
_≈Chan_ = DecSetoid._≈_ ChanSetoid
_≉Chan_ = DecSetoid._≉_ ChanSetoid
infixl 5 _,_∶_
data Session : Set a where
_,_∶_ : Session → Chan → Type → Session
_++_ : Session → Session → Session
∅ : Session
-- open import Data.Bool hiding (_≟_)
-- open import Data.Empty
-- open import Data.Unit
open import Relation.Nullary
open import Relation.Nullary.Decidable
-- open import Relation.Binary.PropositionalEquality
infix 4 _∋_
data _∋_ : (Γ : Session) → (x : Chan) → Set a where
here : ∀ {Γ x y A} → x ≈Chan y → Γ , y ∶ A ∋ x
there : ∀ {Γ x y A} → Γ ∋ x → Γ , y ∶ A ∋ x
left : ∀ {Γ Δ x} → Γ ∋ x → Γ ++ Δ ∋ x
right : ∀ {Γ Δ x} → Δ ∋ x → Γ ++ Δ ∋ x
infix 4 _∋?_
_∋?_ : (Γ : Session) → (x : Chan) → Dec (Γ ∋ x)
Γ , y ∶ A ∋? x with x ≟Chan y
... | yes x≈y = yes (here x≈y)
... | no ¬x≈y with Γ ∋? x
... | yes Γ∋x = yes (there Γ∋x)
... | no ¬Γ∋x = no (λ where (here x≈y) → ¬x≈y x≈y
(there Γ∋x) → ¬Γ∋x Γ∋x)
(Γ ++ Δ) ∋? x with Γ ∋? x
... | yes Γ∋x = yes (left Γ∋x)
... | no ¬Γ∋x with Δ ∋? x
... | yes Δ∋x = yes (right Δ∋x)
... | no ¬Δ∋x = no (λ where (left Γ∋x) → ¬Γ∋x Γ∋x
(right Δ∋x) → ¬Δ∋x Δ∋x)
∅ ∋? x = no (λ ())
open import Data.Product
open import Data.Empty using (⊥-elim)
infix 4 _≈_
_≈_ : Session → Session → Set a
Γ ≈ Δ = (∀ x → Γ ∋ x → Δ ∋ x) × (∀ x → Δ ∋ x → Γ ∋ x)
∅∌x : ∀ {x} → ¬ ∅ ∋ x
∅∌x ()
open DecSetoid ChanSetoid hiding (_≈_)
∅-empty : ∀ {Δ x A} → ¬ ∅ ≈ Δ , x ∶ A
∅-empty {Δ} {x} (P , Q) = ∅∌x (Q x (here refl))
<<<<<<< HEAD
swap : ∀ {Γ x y A B} → Γ , x ∶ A , y ∶ B ≈ Γ , y ∶ B , x ∶ A
swap {Γ} {x} {y} {A} {B} = to , from
where
to : ∀ v → Γ , x ∶ A , y ∶ B ∋ v → Γ , y ∶ B , x ∶ A ∋ v
to v (here P) = there (here P)
to v (there (here P)) = here P
to v (there (there P)) = there (there P)
from : ∀ v → Γ , y ∶ B , x ∶ A ∋ v → Γ , x ∶ A , y ∶ B ∋ v
from v (here P) = there (here P)
from v (there (here P)) = here P
from v (there (there P)) = there (there P)
-- contract : ∀ {Γ x y A B} → → Γ , x ∶ A ≈ Γ
-- contract
-- strengthen : ∀ {Γ x A v} → Γ , x ∶ A ∋ v → x ≉ v → Γ ∋ v
-- strengthen (here x≈v) x≉v = ⊥-elim (x≉v (sym x≈v))
-- strengthen (there P) x≉v = P
=======
>>>>>>> 40f82fd098a0c30c87ea0056baa48152aefae1f6
lookup : (Γ : Session) (x : Chan) → Dec (∃[ Δ ] ∃[ A ] (Γ ≈ (Δ , x ∶ A)))
lookup (Γ , y ∶ A) x with x ≟Chan y
... | yes x≈y = yes (Γ , A , (λ where v (here v≈y) → here (trans v≈y (sym x≈y))
v (there Γ∷y∋v) → there Γ∷y∋v)
, λ where v (here v≈x) → here (trans v≈x x≈y)
v (there Γ∷x∋v) → there Γ∷x∋v)
... | no ¬x≈y with lookup Γ x
... | yes (Δ , B , Γ≈Δ,x∶B) = yes (Δ , y ∶ A , B , (λ where v (here v≈y) → there (here v≈y)
<<<<<<< HEAD
v (there Γ∋v) → proj₁ swap v (there (proj₁ Γ≈Δ,x∶B v Γ∋v)))
, λ where v (here v≈x) → there (proj₂ Γ≈Δ,x∶B v (here v≈x))
v (there (here v≈y)) → here v≈y
v (there (there Δ∋v)) → there (proj₂ Γ≈Δ,x∶B v (there Δ∋v)))
... | no ¬P = no (λ (Δ , B , Q) → ¬P (Δ , B , {! !}))
-- (λ where v P → proj₁ Q v (there P))
-- , (λ where v P → {! proj₂ Q v P !})))
=======
v (there Γ∋v) → {! !}) , {! !})
... | no P = {! !}
>>>>>>> 40f82fd098a0c30c87ea0056baa48152aefae1f6
lookup (Γ ++ Δ) x = {! !}
lookup ∅ x = no (λ where (Δ , A , P) → ∅-empty P)
-- ... | yes x≈y = yes (Γ , A , λ v → (λ where (here v≈y) → here (trans v≈y (sym x≈y))
-- (there Γ∋v) → there Γ∋v) -- (λ v≈x → v≉y (trans v≈x x≈y))
-- , λ where (here v≈x) → here (trans v≈x x≈y)
-- (there Γ∋v) → there Γ∋v) -- (λ v≈y → v≉x (trans v≈y (sym x≈y)))
-- ... | no ¬x≈y with lookup Γ x
-- ... | yes (Δ , B , Γ≈Δ,x∶B) = yes (Δ , y ∶ A , B , λ v → (λ where (here v≈y) → there (here v≈y) -- (λ v≈x → ¬x≈y (trans (sym v≈x) v≈y))
-- (there Γ∋v) → lemma-1 (proj₁ (Γ≈Δ,x∶B v) Γ∋v))
-- , λ where (here v≈x) → there (proj₂ (Γ≈Δ,x∶B v) (here v≈x)) -- (λ v≈y → ¬x≈y (trans (sym v≈x) v≈y))
-- (there Δ,y∶A∋y) → ,-weakening y A (proj₂ (Γ≈Δ,x∶B v)) (lemma-1 Δ,y∶A∋y))
-- where
-- lemma-1 : ∀ {Γ x y z A B} → Γ , x ∶ A ∋ z → Γ , y ∶ B , x ∶ A ∋ z
-- lemma-1 (here z≈x) = here z≈x
-- lemma-1 (there Γ∋z) = there (there Γ∋z)
-- ,-weakening : ∀ {Γ Δ v} x A → (Γ ∋ v → Δ ∋ v) → (Γ , x ∶ A ∋ v → Δ , x ∶ A ∋ v)
-- ,-weakening x A f (here v≈x) = here v≈x
-- ,-weakening x A f (there Γ∋v) = there (f Γ∋v)
-- ... | no ¬P = no λ Q → {! !}
-- -- GOAL : Γ , y ∶ A ≉ CTX , x ∶ TYPE
-- -- ¬P Γ ≉ CTX , x : TYPE
-- -- no (λ (Δ , B , Q) → ¬P (Δ , B , {! Q !}))
-- -- λ v → (λ Γ∋v → proj₁ (Q v) (there Γ∋v))
-- -- , (λ Δ,x∶B∋v → {! proj₂ (Q v) Δ,x∶B∋v !})))
-- -- → (λ Γ∋v → proj₁ (Q v) (there Γ∋v))
-- -- , λ Δ,x∶B∋v → {! (proj₂ (Q v) Δ,x∶B∋v) !}))
-- -- where
-- -- (here P) → strengthen (proj₂ (Q v) (here P)) (λ y≈v → ¬x≈y (sym (trans y≈v P)))
-- -- (there P) → {! !}))
-- where
-- -- GOAL : Δ , x ∶ B → Γ
-- -- Q v : Δ , x ∶ B <≈> Γ , y ∶ A
-- -- -- ¬P Δ A = Γ <=> Δ , x ∶ A
-- -- (x₁ : Carrier) →
-- -- Σ (Γ ∋ x₁ → Δ₁ , x ∶ A₁ ∋ x₁) (λ x₂ → Δ₁ , x ∶ A₁ ∋ x₁ → Γ ∋ x₁)))
-- strengthen : ∀ {Γ x A v} → Γ , x ∶ A ∋ v → x ≉ v → Γ ∋ v
-- strengthen (here x≈v) x≉v = ⊥-elim (x≉v (sym x≈v))
-- strengthen (there P) x≉v = P
-- temp : ∀ Δ B v → (Δ ∋ v) → (f : Δ , x ∶ B ∋ v → Γ , y ∶ A ∋ v) → Γ ∋ v
-- temp Δ B v Δ∋v f with v ≟Chan x
-- ... | yes v≈x = strengthen (f (here v≈x)) (λ y≈v → ¬x≈y (sym (trans y≈v v≈x)))
-- ... | no ¬v≈x with y ≟Chan v
-- ... | yes y≈v = {! !}
-- ... | no ¬y≈v = strengthen (f (there Δ∋v)) ¬y≈v
-- -- strengthen (f (there Δ∈v)) λ y≈v → {! !}
-- -- lemma : G
-- lookup (Γ ++ Δ) x = {! !}
-- lookup ∅ x = no (λ where (Δ , A , P) → ∅-empty P)
-- -- _≈?_ : (Γ Δ : Session) → Dec (Γ ≈ Δ)
-- -- Γ ≈? Δ = {! !}
-- -- empty : ∀ {Γ x A} → ¬ (∅ ≈ (Γ , x ∶ A))
-- -- empty {Γ} {x} {A} P with x ≟ x
-- -- ... | no ¬p = {! !}
-- -- ... | yes p = {! !}
-- -- lookup : (Γ : Session) (x : Chan) → Dec (∃[ Δ ] ∃[ A ] (Γ ≈ (Δ , x ∶ A)))
-- -- lookup (Γ , y ∶ A) x = {! !}
-- -- lookup (Γ ++ Δ) x with lookup Γ x
-- -- ... | yes p = {! !}
-- -- ... | no ¬p = {! !}
-- -- lookup ∅ x = no (λ where (Γ , A , P) → {! P x !})
|
Library/GrObj/Guardian/grobjVisGuardian.asm | steakknife/pcgeos | 504 | 21680 | <reponame>steakknife/pcgeos
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: GrObj
FILE: objectVisGuardian.asm
AUTHOR: <NAME>, Dec 6, 1991
ROUTINES:
Name Description
---- -----------
GrObjVisGuardianSendGrObjMouseMessageToVisWard
GrObjVisGuardianMessageToVisWard
GrObjVisGuardianInitAndFillPriorityList
GrObjVisGuardianSendClassedEvent
GrObjVisGuardianEvaluateEditGrabForEdit
GrObjVisGuardianAttemptToEditOther
GrObjVisGuardianStartSelectToEditGrab
GrObjVisGuardianCalcScaleFactorVISToOBJECT
GrObjVisGuardianBeginEditGeometryCommon
GrObjVisGuardianEndEditGeometryCommon
MESSAGE HANDLERS
Name Description
---- -----------
GrObjVisGuardianInitialize
GrObjVisGuardianSetVisWardClass
GrObjVisGuardianCreateVisWard
GrObjVisGuardianSendAnotherToolActivated
GrObjVisGuardianKbdChar
GrObjVisGuardianDuplicateFloater
GrObjVisGuardianAddVisWard
GrObjVisGuardianLargeStartSelect
GrObjVisGuardianLargePtr
GrObjVisGuardianLargeDragSelect
GrObjVisGuardianLargeEndSelect
GrObjVisGuardianConvertLargeMouseData
GrObjVisGuardianDrawFG
GrObjVisGuardianSetVisWardToolActiveStatus
GrObjVisGuardianGetVisWardToolActiveStatus
GrObjVisGuardianSetVisWardMouseEventType
GrObjVisGuardianAfterAddedToBody
GrObjVisGuardianBeforeRemovedFromBody
GrObjVisGuardianApplyOBJECTToVISTransform
GrObjVisGuardianNotifyGrObjValid
GrObjVisGuardianVisBoundsSetup
GrObjVisGuardianHaveWardDestroyCachedGStates
GrObjVisGuardianObjFree
GrObjVisGuardianGainedTargetExcl
GrObjVisGuardianLostTargetExcl
GrObjVisGuardianGainedFocusExcl
GrObjVisGuardianLostFocusExcl
GrObjVisGuardianAlterFTVMCExcl
GrObjVisGuardianNotifyVisWardChangeBounds
GrObjVisGuardianCreateGState
GrObjVisGuardianPARENTPointForEdit
GrObjVisGuardianBeginCreate
GrObjVisGuardianGetVisWardOD
REVISION HISTORY:
Name Date Description
---- ---- -----------
Steve 12/ 6/91 Initial revision
DESCRIPTION:
$Id: grobjVisGuardian.asm,v 1.1 97/04/04 18:08:59 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjClassStructures segment resource
GrObjVisGuardianClass ;Define the class record
GrObjClassStructures ends
GrObjVisGuardianCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianMetaInitialize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize object
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 6/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianMetaInitialize method dynamic GrObjVisGuardianClass, \
MSG_META_INITIALIZE
.enter
; Initialize mouse flags to small mouse events and
; to not pass mouse events to ward
;
clr ds:[di].GOVGI_flags
mov di, offset GrObjVisGuardianClass
CallSuper MSG_META_INITIALIZE
.leave
ret
GrObjVisGuardianMetaInitialize endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianInitialize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create the vis ward and then call our superclass
to initialize instance data and attributes
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
ss:bp - GrObjInitializeData
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/19/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianInitialize method dynamic GrObjVisGuardianClass,
MSG_GO_INITIALIZE
.enter
mov ax,MSG_GB_GET_BLOCK_FOR_ONE_GROBJ
mov di,mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToBody
EC < ERROR_Z GROBJ_CANT_SEND_MESSAGE_TO_BODY >
mov ax,MSG_GOVG_CREATE_VIS_WARD
call ObjCallInstanceNoLock
mov di,offset GrObjVisGuardianClass
mov ax,MSG_GO_INITIALIZE
call ObjCallSuperNoLock
; Initialize the vis bounds of the ward to be the
; OBJECT dimensions. This is the default for most
; ward/guardian pairs.
;
call GrObjVisGuardianSetVisBoundsToOBJECTDimensions
.leave
ret
GrObjVisGuardianInitialize endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrobjVisGuardianSetVisWardClass
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the class of the vis ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
cx:dx - ftpr to class of vis ward
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 5/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrobjVisGuardianSetVisWardClass method dynamic GrObjVisGuardianClass,
MSG_GOVG_SET_VIS_WARD_CLASS
.enter
EC < tst ds:[di].GOVGI_ward.handle >
EC < ERROR_NZ GROBJ_CANT_SET_VIS_WARD_CLASS_AFTER_WARD_CREATED >
mov ds:[di].GOVGI_class.segment,cx
mov ds:[di].GOVGI_class.offset,dx
.leave
ret
GrobjVisGuardianSetVisWardClass endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianCreateVisWard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create ward of the class in GOVGI_class and store
OD in GOVGI_ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
cx - block to create ward in
RETURN:
cx:dx - ward od
DESTROYED:
nothing
WARNING: May cause block in cx to move
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 6/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianCreateVisWard method dynamic GrObjVisGuardianClass,
MSG_GOVG_CREATE_VIS_WARD
uses ax
.enter
; Create ward of class
;
push si ;parent chunk
mov bx,cx ;block handle
mov cx,ds:[di].GOVGI_class.segment
EC < tst cx >
EC < ERROR_Z OBJECT_VIS_PARENT_HAS_NO_CHILD_CLASS >
mov es,cx
mov di,ds:[di].GOVGI_class.offset
call ObjInstantiate
; Add ward
;
movdw cxdx,bxsi ;ward
pop si ;parent chunk
mov ax, MSG_GOVG_ADD_VIS_WARD
call ObjCallInstanceNoLock
; Update body's info on how big objects in the wards
; block can get.
;
pushdw cxdx ;ward od
mov dx,cx ;ward handle
mov di,mask MF_FIXUP_DS or mask MF_CALL
mov ax,MSG_GV_GET_POTENTIAL_WARD_SIZE
call GrObjVisGuardianMessageToVisWard
mov di,mask MF_FIXUP_DS
mov ax,MSG_GB_INCREASE_POTENTIAL_EXPANSION
call GrObjMessageToBody
popdw cxdx ;ward od
.leave
ret
GrObjVisGuardianCreateVisWard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianAddVisWard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add ward as visual child
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
cx:dx - vis ward to add
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/10/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianAddVisWard method dynamic GrObjVisGuardianClass, \
MSG_GOVG_ADD_VIS_WARD
uses ax, cx, dx
.enter
EC < tst ds:[di].GOVGI_ward.handle >
EC < ERROR_NZ OBJECT_VIS_PARENT_ALREADY_HAS_CHILD >
call ObjMarkDirty
movdw ds:[di].GOVGI_ward,cxdx
mov cx, ds:[LMBH_handle]
mov dx, si
mov ax,MSG_GV_SET_GUARDIAN_LINK
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
.leave
ret
GrObjVisGuardianAddVisWard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianPassToWard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pass message to ward. Watch what you pass because
this handler automatically destroys everything.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
depends on message
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/ 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianPassToWard method dynamic GrObjVisGuardianClass,
MSG_META_SUSPEND,
MSG_META_UNSUSPEND
.enter
push ax ;message
mov di,offset GrObjVisGuardianClass
call ObjCallSuperNoLock
pop ax ;message
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
.leave
Destroy ax,cx,dx,bp
ret
GrObjVisGuardianPassToWard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianKbdChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send any keypresses onto the ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 5/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianKbdChar method dynamic GrObjVisGuardianClass, MSG_META_KBD_CHAR
.enter
clr di
call GrObjVisGuardianMessageToVisWard
.leave
ret
GrObjVisGuardianKbdChar endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianSendAnotherToolActivated
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send MSG_GO_ANOTHER_TOOL_ACTIVATED to selected and
editable grobjects
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/15/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianSendAnotherToolActivated method dynamic \
GrObjVisGuardianClass, MSG_GO_SEND_ANOTHER_TOOL_ACTIVATED
uses ax,cx,dx,bp
.enter
mov cx,ds:[LMBH_handle]
mov dx,si
mov bp,mask ATAF_GUARDIAN
mov ax,MSG_GO_ANOTHER_TOOL_ACTIVATED
clr di ;MessageFlags
call GrObjSendToSelectedGrObjsAndEditAndMouseGrabSuspended
.leave
ret
GrObjVisGuardianSendAnotherToolActivated endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianGetEditClass
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This default handler returns the class of the guardian
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
cx:dx - fptr to class
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 5/14/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianGetEditClass method dynamic GrObjVisGuardianClass,
MSG_GOVG_GET_EDIT_CLASS
.enter
mov di, ds:[si] ;access meta
movdw cxdx,ds:[di].MI_base.MB_class
.leave
ret
GrObjVisGuardianGetEditClass endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianDuplicateFloater
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy object and its visual ward to a block in the vm
file. Get handle of block from body
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianParentClass
cx:dx - od of body
RETURN:
cx:dx - od of new object
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/10/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianDuplicateFloater method dynamic GrObjVisGuardianClass, \
MSG_GO_DUPLICATE_FLOATER
uses ax
.enter
EC < test ds:[di].GOI_optFlags, mask GOOF_FLOATER >
EC < ERROR_Z OBJECT_BEING_DUPLICATED_IS_NOT_THE_FLOATER >
push cx,dx ;body od
; Use super class to copy this object
;
mov di, offset GrObjVisGuardianClass
CallSuper MSG_GO_DUPLICATE_FLOATER
pop bx, si ;body od
push cx, dx ;new guardian od
; get block for vis ward into cx
;
mov ax,MSG_GB_GET_BLOCK_FOR_ONE_GROBJ
mov di,mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
pop bx, si ;new guardian od
mov ax, MSG_GOVG_CREATE_VIS_WARD
clr di
call ObjMessage
movdw cxdx, bxsi ;^lcx:dx <-new guardian
.leave
ret
GrObjVisGuardianDuplicateFloater endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianLargeStartSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle start select event.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
ax - Message
ss:bp - GrObjMouseData
RETURN:
ax - MouseReturnFlags
if MRF_SET_POINTER_IMAGE
cx:dx - optr of pointer image
else
cx,dx - DESTROYED
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 6/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianLargeStartSelect method dynamic GrObjVisGuardianClass,
MSG_GO_LARGE_START_SELECT
.enter
test ds:[di].GOI_optFlags, mask GOOF_FLOATER
jz document
test ds:[di].GOVGI_flags,mask GOVGF_CAN_EDIT_EXISTING_OBJECTS
jnz attemptFloaterEdit
checkFloaterCreate:
; If the floater is allowed to create objects
; then call super class to duplicate floater
;
GrObjDeref di,ds,si
mov cl,ds:[di].GOVGI_flags
andnf cl,mask GOVGF_CREATE_MODE
cmp cl,GOVGCM_NO_CREATE
je unprocessed
callSuper:
mov di, offset GrObjVisGuardianClass
CallSuper MSG_GO_LARGE_START_SELECT
done:
.leave
ret
attemptFloaterEdit:
call GrObjVisGuardianEvaluateEditGrabForEdit
call GrObjVisGuardianAttemptToEditOther
cmp bl,GOAEOR_NOTHING_TO_EDIT
je checkFloaterCreate
cmp bl,GOAEOR_EAT_START_SELECT
je unprocessed
call GrObjVisGuardianStartSelectToEditGrab
jmp done
unprocessed:
clr ax
jmp done
document:
; Object in document has received start select.
;
test ds:[di].GOI_actionModes, mask GOAM_CREATE
jnz creating
test ds:[di].GOI_tempState,mask GOTM_EDITED
jz unprocessed
test ds:[di].GOI_tempState,mask GOTM_SYS_TARGET
jz unprocessed
sendToWard:
push ax
mov ax, MSG_GOVG_RULE_LARGE_START_SELECT_FOR_WARD
call ObjCallInstanceNoLock
pop ax
call GrObjVisGuardianHaveBodyGrabTargetAndFocus
call GrObjVisGuardianSendGrObjMouseMessageToVisWard
jmp done
creating:
; If the guardian should control create then call
; the super class to start a drag create
;
mov cl,ds:[di].GOVGI_flags
andnf cl,mask GOVGF_CREATE_MODE
cmp cl,GOVGCM_GUARDIAN_CREATE
je callSuper
; Object in document in create mode has received a
; start select. if the action is activated, then
; mark happening and proceed. Otherwise bail because
; we never received a MSG_GO_BEGIN_CREATE.
;
test ds:[di].GOI_actionModes, mask GOAM_ACTION_ACTIVATED
jz unprocessed
;
; clear GOAM_ACTION_ACTIVATED and set GOAM_ACTION_HAPPENING
;
xornf ds:[di].GOI_actionModes, mask GOAM_ACTION_ACTIVATED or \
mask GOAM_ACTION_HAPPENING
jmp sendToWard
GrObjVisGuardianLargeStartSelect endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianHaveBodyGrabTargetAndFocus
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to body telling it to grab target and focus.
This routine is called just before sending a start select
to the ward. Most wards grab the target when they get
a start select, but if the body hasn't grabbed the target
from it's parent then the ward won't be able to gain the
target. This should only be a problem if the user has been
working in another application and then moves back over
a body and clicks in it. One would expect that the body
would just grab the target when it got a start select,
but the edit text guardian is not supposed to grab the
target unless it really is going to edit something.
CALLED BY: INTERNAL
GrObjVisGuardianLargeStartSelect
PASS: *ds:si - guardian
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/11/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianHaveBodyGrabTargetAndFocus proc near
uses ax,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
mov ax,MSG_GB_GRAB_TARGET_FOCUS
mov di,mask MF_FIXUP_DS
call GrObjMessageToBody
EC < ERROR_Z GROBJ_CANT_SEND_MESSAGE_TO_BODY >
.leave
ret
GrObjVisGuardianHaveBodyGrabTargetAndFocus endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianLargeStartMoveCopy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle start MoveCopy event.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
ax - Message
ss:bp - GrObjMouseData
RETURN:
ax - MouseReturnFlags
if MRF_SET_POINTER_IMAGE
cx:dx - optr of pointer image
else
cx,dx - DESTROYED
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 6/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianLargeStartMoveCopy method dynamic GrObjVisGuardianClass,
MSG_GO_LARGE_START_MOVE_COPY,
MSG_GO_LARGE_END_MOVE_COPY
.enter
;
; If we're the floater, hooey it
;
test ds:[di].GOI_optFlags, mask GOOF_FLOATER
jnz done
; Object in document has received start MoveCopy.
;
test ds:[di].GOI_tempState,mask GOTM_EDITED
jz unprocessed
test ds:[di].GOI_tempState,mask GOTM_SYS_TARGET
jz unprocessed
call GrObjVisGuardianSendGrObjMouseMessageToVisWard
done:
.leave
ret
unprocessed:
clr ax
jmp done
GrObjVisGuardianLargeStartMoveCopy endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianAttemptToEditOther
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if some other object is more interested in
the edit point than the edit grab. If so, give it
the edit grab.
CALLED BY: INTERNAL
GrObjVisGuardianLargeStartSelect
EditTextGuardianLargeStartSelect
PASS:
*ds:si - grobjVisGuardian
ss:bp - GrObjMouseData
bl - EvaluatePositionRating of edit grab
RETURN:
bl - GrObjAttemptToEditOtherResults
DESTROYED:
bh
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/13/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAttemptEditOtherResults etype byte
GOAEOR_EDIT_GRAB_SET enum GrObjAttemptEditOtherResults
GOAEOR_NOTHING_TO_EDIT enum GrObjAttemptEditOtherResults
GOAEOR_EAT_START_SELECT enum GrObjAttemptEditOtherResults
GrObjVisGuardianAttemptToEditOther proc far
uses ax,cx,dx,di,si
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
; If edit grabs evaluation is high we can't beat it.
;
cmp bl, EVALUATE_HIGH
je edit
call GrObjVisGuardianGetObjectUnderPointToEdit
jcxz noOther
; If priority of other object is not greater than
; the edit grab priority then edit the edit grab
;
cmp al,bl ;other priority, edit priority
jle edit
; Send message to object to put it in edit mode.
;
push si ;floater chunk
mov bx,cx ;object to edit handle
mov si,dx ;object to edit chunk
mov di,mask MF_FIXUP_DS
mov ax,MSG_GO_BECOME_EDITABLE
call ObjMessage
pop si ;floater chunk
; See if the floater should starting editing the object with this
; start select or if it should just make the object
; editable. This is mainly for the beginner poly* tools
; which would add an anchor point at a the location of
; the click if we edited them right away.
;
mov ax,MSG_GOVG_CHECK_FOR_EDIT_WITH_FIRST_START_SELECT
call ObjCallInstanceNoLock
jnc eatStartSelect
edit:
mov bl,GOAEOR_EDIT_GRAB_SET
done:
.leave
ret
eatStartSelect:
mov bl,GOAEOR_EAT_START_SELECT
jmp done
noOther:
; There is no other object to edit, if the edit grab
; is even remotely interested then edit it
;
cmp bl,EVALUATE_NONE
jne edit
mov bl,GOAEOR_NOTHING_TO_EDIT
jmp done
GrObjVisGuardianAttemptToEditOther endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianCheckForEditWithFirstStartSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Default handler returns carry set to signify the
object should be edited with the first start select.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
stc - edit with this start select
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/11/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianCheckForEditWithFirstStartSelect method dynamic\
GrObjVisGuardianClass, MSG_GOVG_CHECK_FOR_EDIT_WITH_FIRST_START_SELECT
.enter
stc
.leave
ret
GrObjVisGuardianCheckForEditWithFirstStartSelect endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianGetObjectUnderPointToEdit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get OD of object that the guardian can edit that
is under the passed point
CALLED BY: INTERNAL UTILITY
PASS:
*ds:si - grobjVisGuardian
ss:bp - GrObjMouseData
RETURN:
^lcx:dx - object to edit
al - EvaluatePositionNotes
or cx:dx = 0 if no object
DESTROYED:
ah
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 10/22/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianGetObjectUnderPointToEdit proc far
.enter
; See if click is on object of class that we can edit.
; We process all objects, regardless of class, so that
; we don't edit objects of our class that are blocked out by
; objects on top of them.
;
mov ax,MSG_GO_EVALUATE_PARENT_POINT_FOR_EDIT
mov cx,1 ;return only one object
mov dl, mask PLI_ONLY_INSERT_CLASS or \
mask PLI_ONLY_INSERT_HIGH
call GrObjVisGuardianInitAndFillPriorityList
; Get od of object to edit and priority
;
clr cx ;first child
mov ax,MSG_GB_PRIORITY_LIST_GET_ELEMENT
mov di,mask MF_CALL or mask MF_FIXUP_DS
call GrObjMessageToBody
jbe noObject ;if carry or zero then
;we have no object
done:
.leave
ret
noObject:
clr cx,dx
jmp done
GrObjVisGuardianGetObjectUnderPointToEdit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianEvaluateEditGrabForEdit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if current edit grab is interested in
start select and is of correct class
CALLED BY: INTERNAL
GrObjVisGuardianLargeStartSelect
PASS:
*ds:si - objectVisGuardian
ss:bp - GrObjMouseData
RETURN:
bl - EvaluatePositionRating
DESTROYED:
bh
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/ 8/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianEvaluateEditGrabForEdit proc far
class GrObjVisGuardianClass
uses ax,cx,dx,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
; If edit object is not of same class as guardians vis ward
; then punt.
;
mov ax,MSG_GOVG_GET_EDIT_CLASS
call ObjCallInstanceNoLock
push bp
mov ax,MSG_META_IS_OBJECT_IN_CLASS
mov di,mask MF_FIXUP_DS or mask MF_CALL
call GrObjMessageToEdit
pop bp
jz none ;jmp if no edit grab
jnc none ;jmp if not of class
; Get and return evaluation of point from edit grab
;
mov ax,MSG_GO_EVALUATE_PARENT_POINT_FOR_EDIT
mov dx,size PointDWFixed
mov di,mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK
call GrObjMessageToEdit
mov bl,al
done:
.leave
ret
none:
mov bl,EVALUATE_NONE
jmp done
GrObjVisGuardianEvaluateEditGrabForEdit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianStartSelectToEditGrab
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: START_SELECT was received by the floater with
an active ward.
Attempt to edit currently editing object, else
attempt to edit object of same class under point.
CALLED BY: INTERNAL
GrObjVisGuardianLargeStartSelect
PASS:
*ds:si - objectVisGuardian
ss:bp - GrObjMouseData
RETURN:
ax - MouseReturnFlags
cx, dx - data
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/13/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianStartSelectToEditGrab proc far
uses di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
call GrObjVisGuardianHaveBodyGrabTargetAndFocus
; Update the edit grab with any stored data.
; This will get things like the bitmap tool class
; to the BitmapGuardian and its Bitmap vis ward.
;
mov ax,MSG_GOVG_UPDATE_EDIT_GRAB_WITH_STORED_DATA
call ObjCallInstanceNoLock
; Send start select on to editable object
;
mov ax,MSG_GO_LARGE_START_SELECT
mov di,mask MF_FIXUP_DS or mask MF_CALL or mask MF_STACK
mov dx,size GrObjMouseData
call GrObjMessageToEdit
.leave
ret
GrObjVisGuardianStartSelectToEditGrab endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianLargePtr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Either pass message on to super class or to vis ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
ss:bp - GrObjMouseData
RETURN:
ax - MouseReturnFlags
if MRF_SET_POINTER_IMAGE
cx:dx - optr of pointer image
else
cx,dx - DESTROYED
DESTROYED:
see RETURN
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 6/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianLargePtr method dynamic GrObjVisGuardianClass,
MSG_GO_LARGE_DRAG_SELECT,
MSG_GO_LARGE_PTR
.enter
; Floater shouldn't be handling these events so
; just eat it.
;
test ds:[di].GOI_optFlags,mask GOOF_FLOATER
jnz setPointerImage
; Guardian in document received ptr event.
; If we are being edited then ward must be handling mouse events,
; so send mouse event to ward
;
test ds:[di].GOI_tempState,mask GOTM_EDITED
jz checkCreate
test ds:[di].GOI_tempState,mask GOTM_SYS_TARGET
jnz sendToWard
checkCreate:
; If we are not in create mode then we don't know what is
; going on, so punt to superclass
;
test ds:[di].GOI_actionModes,mask GOAM_CREATE
jz callSuper
; If vis ward is controlling create then pass mouse
; event onto ward, otherwise call our superclass
; to continue drag open create
;
mov cl,ds:[di].GOVGI_flags
andnf cl,mask GOVGF_CREATE_MODE
cmp cl,GOVGCM_VIS_WARD_CREATE
je sendToWard
callSuper:
mov di, offset GrObjVisGuardianClass
call ObjCallSuperNoLock
done:
.leave
ret
sendToWard:
; Send mouse event to vis ward so it can create/edit itself
;
;
; Let the ruler do what it will
;
push ax
mov ax, MSG_GOVG_RULE_LARGE_PTR_FOR_WARD
call ObjCallInstanceNoLock
pop ax
call GrObjVisGuardianSendGrObjMouseMessageToVisWard
jmp done
setPointerImage:
mov ax,MSG_GO_GET_POINTER_IMAGE
call ObjCallInstanceNoLock
ornf ax,mask MRF_PROCESSED
jmp done
GrObjVisGuardianLargePtr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianLargeEndSelect
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Either pass message on to super class or to vis ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
ss:bp - GrObjMouseData
RETURN:
ax - MouseReturnFlags
if MRF_SET_POINTER_IMAGE
cx:dx - optr of pointer image
else
cx,dx - DESTROYED
DESTROYED:
see RETURN
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 6/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianLargeEndSelect method dynamic GrObjVisGuardianClass,
MSG_GO_LARGE_END_SELECT
.enter
; Floater shouldn't be handling these events so
; just eat it.
;
test ds:[di].GOI_optFlags,mask GOOF_FLOATER
jnz setPointerImage
; Guardian in document received ptr event.
; If we are being edited then ward must be handling mouse events,
; so send mouse event to ward
;
test ds:[di].GOI_tempState,mask GOTM_EDITED
jz checkCreate
test ds:[di].GOI_tempState,mask GOTM_SYS_TARGET
jnz sendToWard
checkCreate:
; If we are not in create mode then we don't know what is
; going on, so punt to superclass
;
test ds:[di].GOI_actionModes,mask GOAM_CREATE
jz callSuper
; If vis ward is controlling create then pass mouse
; event onto ward, otherwise call our superclass
; to complete drag open create
;
mov cl,ds:[di].GOVGI_flags
andnf cl,mask GOVGF_CREATE_MODE
cmp cl,GOVGCM_VIS_WARD_CREATE
je sendToWard
callSuper:
mov di, offset GrObjVisGuardianClass
call ObjCallSuperNoLock
done:
.leave
ret
sendToWard:
; Send mouse event to vis ward so it can create/edit itself
;
;
; Let the ruler do what it will
;
push ax
mov ax, MSG_GOVG_RULE_LARGE_END_SELECT_FOR_WARD
call ObjCallInstanceNoLock
pop ax
call GrObjVisGuardianSendGrObjMouseMessageToVisWard
jmp done
setPointerImage:
mov ax,MSG_GO_GET_POINTER_IMAGE
call ObjCallInstanceNoLock
ornf ax,mask MRF_PROCESSED
push ax ;MouseReturnFlags
mov ax,MSG_GO_RELEASE_MOUSE
call ObjCallInstanceNoLock
pop ax ;MouseReturnFlags
jmp done
GrObjVisGuardianLargeEndSelect endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianRuleLargeStartSelectForWard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObjVisGuardian method for MSG_GOVG_RULE_LARGE_START_SELECT_FOR_WARD
Called by: MSG_GOVG_RULE_LARGE_START_SELECT_FOR_WARD
Pass: *ds:si = GrObjVisGuardian object
ds:di = GrObjVisGuardian instance
Return: nothing
Destroyed: ax
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Jan 20, 1993 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianRuleLargeStartSelectForWard method dynamic GrObjVisGuardianClass, MSG_GOVG_RULE_LARGE_START_SELECT_FOR_WARD
uses cx
.enter
mov cx, mask VRCS_SET_REFERENCE
call GrObjVisGuardianRuleCommon
.leave
ret
GrObjVisGuardianRuleLargeStartSelectForWard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianRuleLargeEndSelectForWard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObjVisGuardian method for MSG_GOVG_RULE_LARGE_END_SELECT_FOR_WARD
Called by: MSG_GOVG_RULE_LARGE_END_SELECT_FOR_WARD
Pass: *ds:si = GrObjVisGuardian object
ds:di = GrObjVisGuardian instance
Return: nothing
Destroyed: ax
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Jan 20, 1993 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianRuleLargeEndSelectForWard method dynamic GrObjVisGuardianClass, MSG_GOVG_RULE_LARGE_END_SELECT_FOR_WARD,
MSG_GOVG_RULE_LARGE_PTR_FOR_WARD
uses cx
.enter
clr cx
call GrObjVisGuardianRuleCommon
.leave
ret
GrObjVisGuardianRuleLargeEndSelectForWard endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianRuleCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description:
Pass: *ds:si - guardian
ss:[bp] - GrObjMouseData
ax - grobj mouse message
cx - mask VRCS_SET_REFERENCE if so desired; 0 otherwise
Return: ss:[bp] - point ruled if applicable
Destroyed: nothing
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon May 25, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianRuleCommon proc near
uses ax, cx, di
.enter
test ss:[bp].GOMD_goFA, mask GOFA_SNAP_TO or mask GOFA_CONSTRAIN
jnz checkSnap
;
; Pass the mouse event on anyway, so that ruler feedback shows
; while manipulating the ward
;
sendToRuler:
ornf cx, mask VRCS_OVERRIDE
mov ax, MSG_VIS_RULER_RULE_LARGE_PTR
mov di, mask MF_FIXUP_DS
call GrObjMessageToRuler
.leave
ret
checkSnap:
test ss:[bp].GOMD_goFA, mask GOFA_SNAP_TO
jz doGuides ;must be guides
ornf cx, VRCS_SNAP_TO_GRID_ABSOLUTE or VRCS_SNAP_TO_GUIDES
test ss:[bp].GOMD_goFA, mask GOFA_CONSTRAIN
jz sendToRuler
doGuides:
ornf cx, VRCS_CONSTRAIN_TO_HV_AXES or VRCS_CONSTRAIN_TO_DIAGONALS
jmp sendToRuler
GrObjVisGuardianRuleCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianSendGrObjMouseMessageToVisWard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert GrObj Mouse Message to a system mouse message
and send to visual ward
CALLED BY: INTERNAL
GrObjVisGuardianLargeStartSelect
GrObjVisGuardianLargeDragSelect
GrObjVisGuardianLargePtr
GrObjVisGuardianLargeEndSelect
PASS:
*ds:si - GrObjVisGuardian
ss:bp - GrObjMouseData
ax - GrObj Message
RETURN:
ax - MouseReturnFlags
if MRF_SET_POINTER_IMAGE
cx:dx - optr of pointer image
else
cx,dx - DESTROYED
DESTROYED:
see RETURN
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 6/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianSendGrObjMouseMessageToVisWard proc far
class GrObjVisGuardianClass
uses bx,bp,di
.enter
; Always convert mouse event to large data structure
;
mov cx,bp
sub sp,size LargeMouseData
mov bp,sp
push ax ;grobj message
mov ax,MSG_GOVG_CONVERT_LARGE_MOUSE_DATA
call ObjCallInstanceNoLock
pop ax ;grobj message
GrObjDeref di,ds,si
test ds:[di].GOVGI_flags, mask GOVGF_LARGE
jnz reallyLarge
; If ward really wants small mouse event then
; take data from LargeMouseData stack frame and
; pass it in registers to ward
;
mov_tr cx,ax ;grobj message
CallMod GrObjConvertGrObjMouseMessageToSmall
mov cx, ss:[bp].LMD_location.PDF_x.DWF_int.low
mov bx, ss:[bp].LMD_location.PDF_x.DWF_frac
rndwwf cxbx
mov dx, ss:[bp].LMD_location.PDF_y.DWF_int.low
mov bx, ss:[bp].LMD_location.PDF_y.DWF_frac
rndwwf dxbx
mov bh,ss:[bp].LMD_uiFunctionsActive
mov bl,ss:[bp].LMD_buttonInfo
mov bp, bx
send:
; Send mouse message to ward, using MF_CALL so that ward
; can return MouseReturnFlags
;
mov di, mask MF_FIXUP_DS or mask MF_CALL
call GrObjVisGuardianMessageToVisWard
add sp,size LargeMouseData
.leave
ret
reallyLarge:
; Ward wanting large mouse events is not handled yet
;
mov_tr cx,ax ;grobj mouse message
CallMod GrObjConvertGrObjMouseMessageToLarge
jmp send
GrObjVisGuardianSendGrObjMouseMessageToVisWard endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianConvertLargeMouseData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert data in GrObjMouseData to LargeMouseData
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
ss:cx - GrObjMouseData -
GOMD_point - in PARENT coords
GOMD_gstate - not used
GOMD_goFA -
GOMD_buttonInfo - from orig system mouse event
GOMD_uiFA - from orig system mouse event
ss:bp - LargeMouseData - empty
RETURN:
ss:bp - LargeMouseData
LMD_location - in vis bounds coordinate system of ward
LMD_buttonInfo
LMD_uiFA
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
WARNING: This routine takes data on two different areas
of the stack and it returns data on the stack so it
may only be called from the same thread
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 7/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianConvertLargeMouseData method dynamic GrObjVisGuardianClass,
MSG_GOVG_CONVERT_LARGE_MOUSE_DATA
uses ax,cx,dx
.enter
mov bx,cx ;GrObjMouseData offset
; Copy point to LargeMouseData
;
push ds,si ;object ptr
mov ax,ss
mov ds,ax ;source segment
mov es,ax ;dest segment
lea si, [bx.GOMD_point] ;source offset
lea di, [bp.LMD_location] ;dest offset
MoveConstantNumBytes <size PointDWFixed> ,cx
pop ds,si ;object ptr
; Untransform the document coordinate mouse postion into
; the vis coordinates of ward
;
clr di
call GrCreateState
call GrObjApplyNormalTransform
mov dx,di ;gstate
call GrObjVisGuardianOptApplyOBJECTToVISTransform
mov dx,bp ;LargeMouseData
call GrUntransformDWFixed
call GrDestroyState
; Copy ButtonInfo and UIFA into LargeMouseData
;
mov cl,ss:[bx].GOMD_uiFA
ornf cl,mask UIFA_IN
mov ss:[bp].LMD_uiFunctionsActive,cl
mov cl,ss:[bx].GOMD_buttonInfo
mov ss:[bp].LMD_buttonInfo,cl
.leave
ret
GrObjVisGuardianConvertLargeMouseData endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianInitAndFillPriorityList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize PriorityList and fill it with objects
that can be edited by the guardian
CALLED BY: INTERNAL
GrObjVisGuardianAttemptToEditOther
PASS:
*(ds:si) - pointer instance data
ss:bp - PointDWFixed
ax - method
cx - max elements
dl - PriorityListInstructions
RETURN:
PriorityListChanged
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 6/10/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianInitAndFillPriorityList proc near
class GrObjVisGuardianClass
uses ax,bx,cx,dx,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
push ax,cx,dx
mov ax,MSG_GOVG_GET_EDIT_CLASS
call ObjCallInstanceNoLock
movdw bxdi,cxdx
pop ax,cx,dx
call GrObjGlobalInitAndFillPriorityList
.leave
ret
GrObjVisGuardianInitAndFillPriorityList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianGainedTargetExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pass gained target onto the ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardian
RETURN:
none
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/14/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianGainedTargetExcl method dynamic GrObjVisGuardianClass,
MSG_META_GAINED_TARGET_EXCL
.enter
call GrObjVisGuardianIncVisWardsInteractibleCount
; We need body to be suspended so that we don't get multiple
; ui updates as selected objects become unselected and this
; object becomes editable.
; HACK. Because we are suspending body after gaining
; target this object will receive a MSG_META_SUSPEND from the
; body. But when this object sends MSG_META_GAINED_TARGET_EXCL
; to its superclass, the superclass handler will send a
; MSG_META_SUSPEND to the object for each time the body
; is suspended. One of those MSG_META_SUSPENDs this object
; already received directly from the body. So we got it
; twice. Counteract it by sending an MSG_META_UNSUSPEND
; to ourself.
;
clr di
mov ax, MSG_GB_IGNORE_UNDO_ACTIONS_AND_SUSPEND
call GrObjMessageToBody
mov ax,MSG_META_UNSUSPEND
call ObjCallInstanceNoLock
mov ax, MSG_META_GAINED_TARGET_EXCL
mov di, offset GrObjVisGuardianClass
call ObjCallSuperNoLock
mov ax,MSG_META_GAINED_TARGET_EXCL
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
mov ax, MSG_GB_UNSUSPEND_AND_ACCEPT_UNDO_ACTIONS
clr di
call GrObjMessageToBody
; Must do this last because the spline changes its
; bounds upon gaining of target.
; Not marking the object dirty on purpose, because
; object can't be discard while it is being edited.
;
GrObjDeref di,ds,si
BitClr ds:[di].GOVGI_flags, GOVGF_VIS_BOUNDS_HAVE_CHANGED
.leave
Destroy ax,cx,dx,bp
ret
GrObjVisGuardianGainedTargetExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianLostTargetExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Passed lost target onto the ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianLostTargetExcl method dynamic GrObjVisGuardianClass,
MSG_META_LOST_TARGET_EXCL
.enter
test ds:[di].GOI_tempState, mask GOTM_EDITED
jz done
; We need to be suspended so that we don't get two updates.
; One from this object losing the target and the other
; from this object becoming selected.
; HACK. Because we are suspending body while we have the
; target this object will receive a MSG_META_SUSPEND from the
; body. But when this object sends MSG_META_LOST_TARGET_EXCL
; to its superclass, the superclass handler will send a
; MSG_META_UNSUSPEND to the object for each time the body
; is suspended. One of those MSG_META_UNSUSPENDs this object
; isn't supposed to have received yet because this object
; hasn't unsuspended the body yet. So we have received
; a MSG_META_UNSUSPEND ahead of time. To counteract this
; so that we can sucessfully unsuspend the body we
; need to suspend just ourselves one more time.
;
clr di
mov ax, MSG_GB_IGNORE_UNDO_ACTIONS_AND_SUSPEND
call GrObjMessageToBody
mov ax,MSG_META_SUSPEND
call ObjCallInstanceNoLock
mov ax,MSG_META_LOST_TARGET_EXCL
mov di,offset GrObjVisGuardianClass
call ObjCallSuperNoLock
mov ax,MSG_META_LOST_TARGET_EXCL
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
call GrObjVisGuardianDecVisWardsInteractibleCount
mov ax, MSG_GB_UNSUSPEND_AND_ACCEPT_UNDO_ACTIONS
clr di
call GrObjMessageToBody
call GrObjVisGuardianSendResizeActionNotificationIfBoundsChanged
done:
.leave
Destroy ax,cx,dx,bp
ret
GrObjVisGuardianLostTargetExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianReleaseExcls
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Tell our ward to release the gadget exclusive
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
jdashe 3/29/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianReleaseExcls method dynamic GrObjVisGuardianClass,
MSG_GO_RELEASE_EXCLS
uses cx,dx
.enter
; In case the ward has the gadget, tell the body to
; take the gadget away from it.
;
movdw cxdx,ds:[di].GOVGI_ward
mov ax, MSG_VIS_RELEASE_GADGET_EXCL
mov di, mask MF_FIXUP_DS
call GrObjMessageToBody
mov ax, MSG_GO_RELEASE_EXCLS
mov di, offset GrObjVisGuardianClass
call ObjCallSuperNoLock
.leave
Destroy ax
ret
GrObjVisGuardianReleaseExcls endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianIncVisWardsInteractibleCount
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Increment the interactible count of the block that the
vis ward is in. This is normally used when the
the guardian gains the target or focus so that
the ward won't be discarded while targeted or focused
CALLED BY: INTERNAL
GrObjVisGuardianGainedTargetExcl
GrObjVisGuardianGainedFocusExcl
PASS: *ds:si - guardian
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
wards is in same block as guardian
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/ 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianIncVisWardsInteractibleCount proc far
class GrObjVisGuardianClass
uses ax,bx,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject
EC < push si >
; If the ward is in the same block as the guardian then
; no need to lock the ward block
;
GrObjDeref di,ds,si
mov bx,ds:[di].GOVGI_ward.handle
tst bx
jz done
EC < mov si,ds:[di].GOVGI_ward.chunk >
cmp bx,ds:[LMBH_handle]
jne notSameBlock
call ObjIncInteractibleCount
done:
EC < pop si >
.leave
ret
notSameBlock:
push ds ;guardian segment
call ObjLockObjBlock ;lock ward block
mov ds,ax ;ward segment
call ObjIncInteractibleCount ;wards interactible
call MemUnlock ;unlock ward block
pop ds ;guardian segment
jmp done
GrObjVisGuardianIncVisWardsInteractibleCount endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianDecVisWardsInteractibleCount
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Decrement the interactible count of the block that the
vis ward is in. This is normally used when the
the guardian loses the target or focus to counteract
the incing when the target or focus was gained.
CALLED BY: INTERNAL
GrObjVisGuardianLostTargetExcl
GrObjVisGuardianLostFocusExcl
PASS: *ds:si - guardian
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
wards is in same block as guardian
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/ 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianDecVisWardsInteractibleCount proc far
class GrObjVisGuardianClass
uses ax,bx,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject
EC < push si >
; If the ward is in the same block as the guardian then
; no need to lock the ward block
;
GrObjDeref di,ds,si
mov bx,ds:[di].GOVGI_ward.handle
tst bx
jz done
EC < mov si,ds:[di].GOVGI_ward.chunk >
cmp bx,ds:[LMBH_handle]
jne notSameBlock
call ObjDecInteractibleCount
done:
EC < pop si >
.leave
ret
notSameBlock:
push ds ;guardian segment
call ObjLockObjBlock ;lock ward block
mov ds,ax ;ward segment
call ObjDecInteractibleCount ;wards interactible
call MemUnlock ;unlock ward block
pop ds ;guardian segment
jmp done
GrObjVisGuardianDecVisWardsInteractibleCount endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianSendResizeActionNotificationIfBoundsChanged
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If the GOVGF_VIS_BOUNDS_CHANGED bit is set then
clear the bit and send a GOANT_RESIZED action
notification.
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - GrObjVisGuardian
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/11/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianSendResizeActionNotificationIfBoundsChanged proc far
class GrObjVisGuardianClass
uses di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOVGI_flags, mask GOVGF_VIS_BOUNDS_HAVE_CHANGED
jz done
BitClr ds:[di].GOVGI_flags,GOVGF_VIS_BOUNDS_HAVE_CHANGED
mov bp,GOANT_RESIZED
call GrObjOptNotifyAction
done:
.leave
ret
GrObjVisGuardianSendResizeActionNotificationIfBoundsChanged endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianUpdateSysExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pass message onto ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
WARNING: This method is not dynamic
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianUpdateSysExcl method GrObjVisGuardianClass,
MSG_META_GAINED_SYS_TARGET_EXCL,
MSG_META_LOST_SYS_TARGET_EXCL,
MSG_META_GAINED_SYS_FOCUS_EXCL,
MSG_META_LOST_SYS_FOCUS_EXCL
.enter
push ax ;message
mov di,offset GrObjVisGuardianClass
call ObjCallSuperNoLock
pop ax ;message
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
.leave
Destroy ax,cx,dx,bp
ret
GrObjVisGuardianUpdateSysExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianGainedFocusExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Bad things happen if vis objects get discarded while
they have the focus.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 6/22/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianGainedFocusExcl method dynamic GrObjVisGuardianClass,
MSG_META_GAINED_FOCUS_EXCL
.enter
call GrObjVisGuardianIncVisWardsInteractibleCount
call GrObjVisGuardianUpdateSysExcl
.leave
ret
GrObjVisGuardianGainedFocusExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianLostFocusExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Bad things happen if vis objects get discarded while
they have the focus.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 6/22/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianLostFocusExcl method dynamic GrObjVisGuardianClass,
MSG_META_LOST_FOCUS_EXCL
.enter
call GrObjVisGuardianUpdateSysExcl
call GrObjVisGuardianDecVisWardsInteractibleCount
.leave
ret
GrObjVisGuardianLostFocusExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianAlterFTVMCExcl
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If message is a grab target from our ward then
grab the edit.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
cx:dx - optr to grab/release exclusive for
bp - MetaAlterFTVMCExclFlags
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/12/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianAlterFTVMCExcl method dynamic GrObjVisGuardianClass,
MSG_META_MUP_ALTER_FTVMC_EXCL
.enter
test bp, mask MAEF_NOT_HERE
jnz callSuper
; If this is not for the target and focus then handle normally
;
test bp, mask MAEF_TARGET
jnz target
checkFocus:
test bp,mask MAEF_FOCUS
jnz focus
callSuper:
; Pass message on to superclass for handling outside of
; this class.
;
test bp, MAEF_MASK_OF_ALL_HIERARCHIES
jz done
mov di, offset GrObjVisGuardianClass
call ObjCallSuperNoLock
done:
Destroy ax,cx,dx,bp
.leave
ret
target:
mov ax,MSG_GO_BECOME_EDITABLE ;assume
test bp, mask MAEF_GRAB
jnz send
mov ax,MSG_GO_BECOME_UNEDITABLE
mov cl,SELECT_AFTER_EDIT
send:
call ObjCallInstanceNoLock
BitClr bp, MAEF_TARGET
jmp checkFocus
focus:
BitClr bp,MAEF_FOCUS
test bp,mask MAEF_GRAB
jz releaseFocus
call GrObjCanEdit?
jnc callSuper
call MetaGrabFocusExclLow
jmp callSuper
releaseFocus:
call MetaReleaseFocusExclLow
jmp callSuper
GrObjVisGuardianAlterFTVMCExcl endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianSendClassedEvent
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handler for a classed event passed via
MSG_META_SEND_CLASSED_EVENT.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
cx - handle of ClassedEvent
dx - TravelOptions
RETURN:
if Event delivered
if MF_CALL ax,cx,dx,bp - from method
DESTROYED:
ax,cx,dx,bp - unless returned
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/16/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianSendClassedEvent method dynamic GrObjVisGuardianClass, \
MSG_META_SEND_CLASSED_EVENT
.enter
; Guardian and its ward are generally consider one object
; so self may be sent to vis ward
;
cmp dx,TO_SELF
je checkWard
; Attempt to send the message to the vis ward for these
; travel options
;
cmp dx, TO_TARGET
je checkWard
cmp dx, TO_FOCUS
je checkWard
callSuper:
mov di, offset GrObjVisGuardianClass
CallSuper MSG_META_SEND_CLASSED_EVENT
done:
.leave
ret
checkWard:
; If vis ward is not able to handle event then send message
; to superclass, otherwise send to ward. So that the
; ward can handle MSG_META_COPY and such we pass messages
; with a zero class to the ward.
;
push ax,cx,dx ;message, event, TO
mov bx,cx ;event handle
mov dx,si ;guardian chunk
call ObjGetMessageInfo
xchg dx,si ;event class offset, guard chunk
jcxz popToWard ;class segment
push bp
mov ax,MSG_META_IS_OBJECT_IN_CLASS
mov di,mask MF_CALL or mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
pop bp
pop ax,cx,dx ;message, event, TO
jz callSuper ;jmp if no ward
jnc callSuper ;jmp if ward not of class
sendToWard:
; Send message to ward
;
mov di,mask MF_CALL or mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
jmp done
popToWard:
pop ax,cx,dx ;message, event, TO
jmp sendToWard
GrObjVisGuardianSendClassedEvent endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianNotifyGrObjValid
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Notify object that it now has a valid normalTransform
and attribute. The vis guardian needs to set up
the geometry in its vis ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianNotifyGrObjValid method dynamic GrObjVisGuardianClass,
MSG_GO_NOTIFY_GROBJ_VALID
uses cx
.enter
; Ignore if already valid
;
test ds:[di].GOI_optFlags, mask GOOF_GROBJ_INVALID
jz done
mov di,offset GrObjVisGuardianClass
call ObjCallSuperNoLock
; Do any initialization necessary for ward.
;
mov ax,MSG_VIS_NOTIFY_GEOMETRY_VALID
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
done:
.leave
ret
GrObjVisGuardianNotifyGrObjValid endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianNotifyGrObjInvalid
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Notify object that it is no longer valid.
Mark ward as geometry invalid
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianNotifyGrObjInvalid method dynamic GrObjVisGuardianClass,
MSG_GO_NOTIFY_GROBJ_INVALID
.enter
; Ignore if already invalid
;
test ds:[di].GOI_optFlags, mask GOOF_GROBJ_INVALID
jnz done
mov di,offset GrObjVisGuardianClass
call ObjCallSuperNoLock
call GrObjVisGuardianMarkVisWardGeometryInvalid
done:
.leave
ret
GrObjVisGuardianNotifyGrObjInvalid endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianMarkVisWardGeometryInvalid
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mark the vis ward as having invalid geometry
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - guardian
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/28/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianMarkVisWardGeometryInvalid proc far
uses ax,cx,dx,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
mov ax,MSG_VIS_MARK_INVALID
mov cl, mask VOF_GEOMETRY_INVALID
mov dl, VUM_MANUAL
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
.leave
ret
GrObjVisGuardianMarkVisWardGeometryInvalid endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianHaveWardDestroyCachedGStates
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: After the object has been transformed or translated
when need to have the ward destroy any cached gstates,
because those gstates will no longer map to proper
place in the document.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
MSG_GO_COMPLETE_TRANSFORM
bp - GrObjActionNotificationType
MSG_GO_COMPLETE_TRANSLATE
bp - GrObjActionNotificationType
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/10/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianHaveWardDestroyCachedGStates method dynamic \
GrObjVisGuardianClass,
MSG_GO_COMPLETE_TRANSFORM,
MSG_GO_COMPLETE_TRANSLATE
uses ax
.enter
mov di,offset GrObjVisGuardianClass
call ObjCallSuperNoLock
mov ax,MSG_VIS_RECREATE_CACHED_GSTATES
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
.leave
ret
GrObjVisGuardianHaveWardDestroyCachedGStates endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianVisBoundsSetup
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This default handler for the
VisGuardian sets the height and width of the vis ward
to the OBJECT dimensions and notify the ward
that its geometry is valid.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/ 9/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianVisBoundsSetup method dynamic GrObjVisGuardianClass,
MSG_GOVG_VIS_BOUNDS_SETUP
.enter
call GrObjVisGuardianSetVisBoundsToOBJECTDimensions
GrObjDeref di,ds,si
test ds:[di].GOI_optFlags, mask GOOF_GROBJ_INVALID
jnz done
; Objects will do any necessary calculations to handle their
; new geometry upon receiving this message. For instance
; text objects will re-wrap.
;
mov di,mask MF_FIXUP_DS
mov ax,MSG_VIS_NOTIFY_GEOMETRY_VALID
call GrObjVisGuardianMessageToVisWard
done:
.leave
ret
GrObjVisGuardianVisBoundsSetup endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianSetVisBoundsToOBJECTDimensions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the vis bounds of the ward to match the OBJECT
dimensions of the object
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - guardian
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/28/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianSetVisBoundsToOBJECTDimensions proc far
uses ax,bx,cx,dx,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
call GrObjGetAbsNormalOBJECTDimensions
rndwwf dxcx
rndwwf bxax
mov cx,dx ;width
mov dx,bx ;height
mov ax,MSG_VIS_SET_SIZE
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
.leave
ret
GrObjVisGuardianSetVisBoundsToOBJECTDimensions endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianCreateGState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a gstate with the transformations of all groups
above this object and its own transform
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
bp - gstate
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianCreateGState method dynamic GrObjVisGuardianClass,
MSG_GOVG_CREATE_GSTATE
.enter
mov di,OBJECT_GSTATE
call GrObjCreateGState
mov dx,di ;gstate
call GrObjVisGuardianOptApplyOBJECTToVISTransform
mov bp,di ;gstate
.leave
ret
GrObjVisGuardianCreateGState endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianSetVisWardMouseEventType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the type (large or small) of mouse event that the
vis ward is interested in
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardian
cl - VisWardMouseEventType
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/ 9/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianSetVisWardMouseEventType method dynamic \
GrObjVisGuardianClass, MSG_GOVG_SET_VIS_WARD_MOUSE_EVENT_TYPE
.enter
; Assume small mouse events
;
andnf ds:[di].GOVGI_flags, not mask GOVGF_LARGE
; If assumption correct then bail, otherwise deactive
;
cmp cl,VWMET_SMALL
je done
ornf ds:[di].GOVGI_flags, mask GOVGF_LARGE
done:
.leave
ret
GrObjVisGuardianSetVisWardMouseEventType endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianQuickTotalBodyClear
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Must destroy the wards data in other blocks. The easiest
way to do this is just to destroy the little pecker completely.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/22/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianQuickTotalBodyClear method dynamic GrObjVisGuardianClass,
MSG_GO_QUICK_TOTAL_BODY_CLEAR
.enter
; Normally MSG_META_OBJ_FREE would inc the in use count
; of the ward, but we are pulling a short cut here by
; just sending MSG_META_FINAL_OBJ_FREE, so we must
; inc the in use count ourselves.
;
call GrObjVisGuardianIncVisWardsInUseCount
mov di,mask MF_FIXUP_DS
mov ax,MSG_META_FINAL_OBJ_FREE
call GrObjVisGuardianMessageToVisWard
mov di, offset GrObjVisGuardianClass
mov ax,MSG_GO_QUICK_TOTAL_BODY_CLEAR
call ObjCallSuperNoLock
.leave
ret
GrObjVisGuardianQuickTotalBodyClear endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianFinalObjFree
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Generally guardian's do not flush their queue before
sending themselves MSG_META_FINAL_OBJ_FREE. However, the
vis wards always send MSG_META_FINAL_OBJ_FREE via the
queue. So the ward my still exist after the guardian
is gone. We must prevent the ward from attempt to send
messages to the guardian.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/30/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianFinalObjFree method dynamic GrObjVisGuardianClass,
MSG_META_FINAL_OBJ_FREE
.enter
clrdw cxdx
mov di,mask MF_FIXUP_DS
mov ax,MSG_GV_SET_GUARDIAN_LINK
call GrObjVisGuardianMessageToVisWard
mov ax,MSG_META_FINAL_OBJ_FREE
mov di,offset GrObjVisGuardianClass
call ObjCallSuperNoLock
.leave
ret
GrObjVisGuardianFinalObjFree endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianClearVisWardOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Default handler
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/30/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianClearVisWardOD method dynamic GrObjVisGuardianClass,
MSG_GOVG_CLEAR_VIS_WARD_OD
.enter
clr ax
mov ds:[di].GOVGI_ward.handle,ax
mov ds:[di].GOVGI_ward.chunk,ax
.leave
ret
GrObjVisGuardianClearVisWardOD endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianIncVisWardsInUseCount
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Increment the in use count of the block that the
vis ward is in. This is normally used when the
the guardian gains the target or focus so that
the ward won't be discarded while targeted or focused
CALLED BY: INTERNAL
GrObjVisGuardianQuickTotalBodyClear
PASS: *ds:si - guardian
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
wards is in same block as guardian
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 3/ 3/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianIncVisWardsInUseCount proc near
class GrObjVisGuardianClass
uses ax,bx,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject
EC < push si >
; If the ward is in the same block as the guardian then
; no need to lock the ward block
;
GrObjDeref di,ds,si
mov bx,ds:[di].GOVGI_ward.handle
tst bx
jz done
EC < mov si,ds:[di].GOVGI_ward.chunk >
cmp bx,ds:[LMBH_handle]
jne notSameBlock
call ObjIncInUseCount
done:
EC < pop si >
.leave
ret
notSameBlock:
push ds ;guardian segment
call ObjLockObjBlock ;lock ward block
mov ds,ax ;ward segment
call ObjIncInUseCount ;wards interactible
call MemUnlock ;unlock ward block
pop ds ;guardian segment
jmp done
GrObjVisGuardianIncVisWardsInUseCount endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianMetaObjFree
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pass message onto vis ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianMetaObjFree method dynamic GrObjVisGuardianClass,
MSG_META_OBJ_FREE
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
mov di,offset GrObjVisGuardianClass
GOTO ObjCallSuperNoLock
GrObjVisGuardianMetaObjFree endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianObjFree
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Free an object *now*
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianObjFree method dynamic GrObjVisGuardianClass,
MSG_GO_OBJ_FREE
; The Vis Wards must always use the queue flushing messages.
; For instance the text object may have a flash cursor
; message in the queue.
;
push ax
mov ax, MSG_META_OBJ_FREE
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
pop ax
mov di,offset GrObjVisGuardianClass
GOTO ObjCallSuperNoLock
GrObjVisGuardianObjFree endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianObjFreeGuaranteedNoQueuedMessages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Free an object *now* without queueing any messages.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/18/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianObjFreeGuaranteedNoQueuedMessages method dynamic \
GrObjVisGuardianClass, MSG_GO_OBJ_FREE_GUARANTEED_NO_QUEUED_MESSAGES
push ax
call GrObjVisGuardianIncVisWardsInUseCount
mov ax, MSG_META_FINAL_OBJ_FREE
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
pop ax
mov di,offset GrObjVisGuardianClass
GOTO ObjCallSuperNoLock
GrObjVisGuardianObjFreeGuaranteedNoQueuedMessages endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianNormalize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert the object into a rectangle with
its GrObjTransMatrix as the Identity Matrix
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianNormalize method dynamic GrObjVisGuardianClass,
MSG_GOVG_NORMALIZE
.enter
; Calculate the bounds of the object in the PARENT
; coordinate system. Use the dimensions of the
; bounds as the width and height
;
sub sp,size BoundingRectData
mov bp,sp
mov di,PARENT_GSTATE
call GrObjCreateGStateForBoundsCalc
mov ss:[bp].BRD_parentGState,di
mov di,PARENT_GSTATE
call GrObjCreateGStateForBoundsCalc
mov ss:[bp].BRD_destGState,di
mov ax,MSG_GO_GET_BOUNDING_RECTDWFIXED
call ObjCallInstanceNoLock
CallMod GrObjGlobalGetWWFixedDimensionsFromRectDWFixed
EC < ERROR_NC BUG_IN_DIMENSIONS_CALC >
mov di,ss:[bp].BRD_parentGState
call GrDestroyState
mov di,ss:[bp].BRD_destGState
call GrDestroyState
add sp, size BoundingRectData
rndwwf dxcx
rndwwf bxax
clr ax, cx
call GrObjSetOBJECTDimensionsAndIdentityMatrix
.leave
ret
GrObjVisGuardianNormalize endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianNotifyVisWardChangeBounds
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
Notify the guardian that the vis ward wishes to changes its
vis bounds.
This default handler sets the OBJECT dimensions to match
the desired vis bounds. Moves the grobj the amount
the vis bounds have moved. Sets the vis bounds of the
ward.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
ss:bp - Rect, desired vis bounds
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/11/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianNotifyVisWardChangeBounds method dynamic GrObjVisGuardianClass,
MSG_GOVG_NOTIFY_VIS_WARD_CHANGE_BOUNDS
uses cx,dx
moveDeltas local PointDWFixed
mov bx, bp ;ss:bx <- passed Rect
.enter
call GrObjVisGuardianBeginEditGeometryCommon
GrObjDeref di,ds,si
BitSet ds:[di].GOVGI_flags, GOVGF_VIS_BOUNDS_HAVE_CHANGED
; Set OBJECT dimensions from the new VisBounds
;
mov dx, ss:[bx].R_right
sub dx, ss:[bx].R_left
mov ax, ss:[bx].R_bottom
sub ax, ss:[bx].R_top
push bx ;passed frame offset
mov_tr bx,ax ;height int
clr ax, cx ;height/width frac
call GrObjSetNormalOBJECTDimensions
pop bx ;passed frame offset
; Calculate the delta from the original vis bound center
; to the new vis bounds center.
;
clr ax
mov cx, ss:[bx].R_right
add cx, ss:[bx].R_left
sarwwf cxax
movwwf ({WWFixed}ss:moveDeltas.PDF_x.DWF_frac),cxax
clr ax
mov cx, ss:[bx].R_bottom
add cx, ss:[bx].R_top
sarwwf cxax
movwwf ({WWFixed}ss:moveDeltas.PDF_y.DWF_frac),cxax
call GrObjVisGuardianGetWardWWFixedCenter
subwwf ({WWFixed}ss:moveDeltas.PDF_x.DWF_frac),dxcx
subwwf ({WWFixed}ss:moveDeltas.PDF_y.DWF_frac),bxax
; Convert to PointDWFixed
;
mov ax,moveDeltas.PDF_x.DWF_int.low
cwd
mov moveDeltas.PDF_x.DWF_int.high,dx
mov ax,moveDeltas.PDF_y.DWF_int.low
cwd
mov moveDeltas.PDF_y.DWF_int.high,dx
; Convert center delta into PARENT coords.
; We don't need to include the transformation from
; vis to object because we are setting the object dimensions
; to equal the vis bounds.
;
clr di ;no window
call GrCreateState
mov dx,di ;gstate
call GrObjApplyNormalTransformSansCenterTranslation
segmov es,ss
lea dx,ss:moveDeltas
call GrTransformDWFixed
mov dx,di ;gstate
call GrDestroyState
push bp ;locals frame
lea bp, ss:moveDeltas
call GrObjMoveNormalRelative
pop bp ;locals frame
; This leave restores the passed bp which has the
; Rectangle in it.
;
.leave
; Actually change bounds of ward
;
mov ax, MSG_GV_SET_VIS_BOUNDS
mov di,mask MF_FIXUP_DS or mask MF_STACK
mov dx, size Rectangle
call GrObjVisGuardianMessageToVisWard
mov ax,MSG_GO_CALC_PARENT_DIMENSIONS
call ObjCallInstanceNoLock
call GrObjVisGuardianEndEditGeometryCommon
ret
GrObjVisGuardianNotifyVisWardChangeBounds endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianBeginEditGeometryCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Perform some common functionality for the methods
the do geometry manipulations on a grobject
CALLED BY: INTERNAL UTILITY
PASS:
*ds:si - GrObject
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianBeginEditGeometryCommon proc far
uses ax,di,dx
.enter
EC < call ECGrObjCheckLMemObject >
; Get gstate to pass with handle drawing messages
;
mov di,BODY_GSTATE
call GrObjCreateGState
mov dx,di ;gstate
; Erase handle of object in case it is selected
;
mov ax,MSG_GO_UNDRAW_HANDLES
call ObjCallInstanceNoLock
mov ax,MSG_GO_UNDRAW_EDIT_INDICATOR
call ObjCallInstanceNoLock
; If we are being edited then let the object
; do any necessary invalidations to allow for
; object specific optimizations.
;
GrObjDeref di,ds,si
test ds:[di].GOI_tempState,mask GOTM_EDITED
jz invalidate
destroy:
mov di,dx
call GrDestroyState
.leave
ret
invalidate:
call GrObjOptInvalidate
jmp destroy
GrObjVisGuardianBeginEditGeometryCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianEndEditGeometryCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Perform some common functionality for the methods
the do geometry manipulations on a grobject
CALLED BY: INTERNAL UTILITY
PASS:
*ds:si - GrObject
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/21/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianEndEditGeometryCommon proc far
uses ax,di,dx
.enter
EC < call ECGrObjCheckLMemObject >
; Get gstate to pass with handle drawing messages
;
mov di,BODY_GSTATE
call GrObjCreateGState
mov dx,di ;gstate
; Redraw handles of object if it is selected
;
mov ax,MSG_GO_DRAW_HANDLES
call ObjCallInstanceNoLock
mov ax,MSG_GO_DRAW_EDIT_INDICATOR
call ObjCallInstanceNoLock
; If we are being edited then let the object
; do any necessary invalidations to allow for
; object specific optimizations.
;
GrObjDeref di,ds,si
test ds:[di].GOI_tempState,mask GOTM_EDITED
jz invalidate
destroy:
mov di,dx
call GrDestroyState
.leave
ret
invalidate:
call GrObjOptInvalidate
jmp destroy
GrObjVisGuardianEndEditGeometryCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianGetVisWardOD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return OD of vis ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
cx:dx - od
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 5/14/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianGetVisWardOD method dynamic GrObjVisGuardianClass,
MSG_GOVG_GET_VIS_WARD_OD
.enter
movdw cxdx,ds:[di].GOVGI_ward
.leave
ret
GrObjVisGuardianGetVisWardOD endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianRecreateCachedGStates
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pass message onto ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/26/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianRecreateCachedGStates method dynamic GrObjVisGuardianClass,
MSG_GO_RECREATE_CACHED_GSTATES
.enter
mov ax,MSG_VIS_RECREATE_CACHED_GSTATES
mov di,mask MF_FIXUP_DS
call GrObjVisGuardianMessageToVisWard
.leave
Destroy ax,cx,dx,bp
ret
GrObjVisGuardianRecreateCachedGStates endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianRoundOBJECTDimensions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Round width and height so that the OBJECT dimensions
can match up with the interger vis bounds of the ward
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - object
RETURN:
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 9/ 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianRoundOBJECTDimensions proc far
uses ax,bx,cx,dx
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
call GrObjGetNormalOBJECTDimensions
rndwwf dxcx
rndwwf bxax
clr ax,cx
call GrObjSetNormalOBJECTDimensions
.leave
ret
GrObjVisGuardianRoundOBJECTDimensions endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianQuickTransferTakeMouseGrabIfPossible
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Decides if this VisGuardian object should take the
mouse grab. This is called during a quick transfer when
the body has the grab but there is also an object within
the body that has the target exclusive.
CALLED BY: MSG_GO_QUICK_TRANSFER_TAKE_MOUSE_GRAB_IF_POSSIBLE
PASS: *ds:si = GrObjVisGuardianClass object
ds:di = GrObjVisGuardianClass instance data
ds:bx = GrObjVisGuardianClass object (same as *ds:si)
es = segment of GrObjVisGuardianClass
ax = message #
ss:bp = LargeMouseData
^lcx:dx = optr to the owner of the Quick Transfer Object
RETURN: carry: SET - Object was eligible and mouse was grabbed.
CLEAR - Object was not eligible, mouse grab was not changed.
DESTROYED: ax
SIDE EFFECTS:
May take mouse grab.
NOT TO BE CALLED WITH MF_STACK.
PSEUDO CODE/STRATEGY:
1) Check if this object's VisWard is the owner of the quick transfer
object.
2) Check to see if the mouse's position is inside our bounds.
If both of these are true, then take the mouse grab.
REVISION HISTORY:
Name Date Description
---- ---- -----------
JimG 7/20/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianQuickTransferTakeMouseGrabIfPossible method dynamic \
GrObjVisGuardianClass,
MSG_GO_QUICK_TRANSFER_TAKE_MOUSE_GRAB_IF_POSSIBLE
uses cx, dx, bp
.enter
; Check to see if the VisWard of this guardian is the owner of the
; quick transfer object.
cmpdw ds:[di].GOVGI_ward, cxdx
clc
jne exit ; not affected by C
; Check to see if the mouse point is inside my bounds!
; Will return false if this object is the floater.
mov bx, bp
lea bp, ss:[bp].LMD_location
mov ax, MSG_GO_IS_POINT_INSIDE_OBJECT_BOUNDS
mov dx, size PointDWFixed
call ObjCallInstanceNoLock
mov bp, bx
jnc exit ; not in bounds (clc)
; Okay.. we can now take the grab! Cool.
mov ax, MSG_GO_GRAB_MOUSE
call ObjCallInstanceNoLock
; SUCCESS!
stc
exit:
.leave
ret
GrObjVisGuardianQuickTransferTakeMouseGrabIfPossible endm
GrObjVisGuardianCode ends
GrObjStyleSheetCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianStyleCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: Forwards any MSG_META_STYLED_OBJECT_* messages to the
appropriate object(s).
Pass: *ds:si - GrObjVisGuardian object
ds:di - GrObjVisGuardian instance
ax - MSG_META_STYLED_OBJECT_* (except RECALL_STYLE)
cx,dx,bp - data
Return: nothing
Destroyed: nothing
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Apr 27, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianStyleCommon method dynamic GrObjVisGuardianClass,
MSG_META_STYLED_OBJECT_REQUEST_ENTRY_MONIKER,
MSG_META_STYLED_OBJECT_UPDATE_MODIFY_BOX,
MSG_META_STYLED_OBJECT_MODIFY_STYLE,
MSG_META_STYLED_OBJECT_DEFINE_STYLE,
MSG_META_STYLED_OBJECT_REDEFINE_STYLE,
MSG_META_STYLED_OBJECT_SAVE_STYLE,
MSG_META_STYLED_OBJECT_LOAD_STYLE_SHEET,
MSG_META_STYLED_OBJECT_DESCRIBE_STYLE,
MSG_META_STYLED_OBJECT_DESCRIBE_ATTRS,
MSG_META_STYLED_OBJECT_APPLY_STYLE,
MSG_META_STYLED_OBJECT_RETURN_TO_BASE_STYLE,
MSG_META_STYLED_OBJECT_DELETE_STYLE
.enter
push ax, cx, dx, bp
movdw cxdx, ss:[bp]
mov ax, MSG_META_IS_OBJECT_IN_CLASS
call ObjCallInstanceNoLock
pop ax, cx, dx, bp
jnc checkWard
;
; It's a grobj style message; call the super class
;
mov di, segment GrObjVisGuardianClass
mov es, di
mov di, offset GrObjVisGuardianClass
call ObjCallSuperNoLock
done:
.leave
ret
checkWard:
push ax, cx, dx, bp
movdw cxdx, ss:[bp]
mov ax, MSG_META_IS_OBJECT_IN_CLASS
mov di, mask MF_CALL
call GrObjVisGuardianMessageToVisWard
pop ax, cx, dx, bp
jnc done
;
; The style message is intended for the ward
;
clr di
call GrObjVisGuardianMessageToVisWard
jmp done
GrObjVisGuardianStyleCommon endm
GrObjStyleSheetCode ends
GrObjDrawCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianMessageToVisWard
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Send message to vis ward
CALLED BY: INTERNAL
GrObjVisGuardianSendGrObjMouseMessageToVisWard
PASS:
*ds:si - object
ax - message
cx,dx,bp - other data with message
di - MessageFlags
RETURN:
if no vis ward return
zero flag set
else
zero flag cleared
if MF_CALL
ax,cx,dx,bp
no flags except carry
otherwise
nothing
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 7/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianMessageToVisWard proc far
class GrObjVisGuardianClass
uses bx,si,di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
; If no ward, then return with zero flag set
;
GrObjDeref si,ds,si
mov bx,ds:[si].GOVGI_ward.handle
tst bx
jz done
mov si,ds:[si].GOVGI_ward.chunk
ornf di, mask MF_FIXUP_DS
call ObjMessage
; Clear zero flag to signify message being sent
;
ClearZeroFlagPreserveCarry si
done:
.leave
ret
GrObjVisGuardianMessageToVisWard endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianOptApplyOBJECTToVISTransform
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSYS: Apply transformation from OBJECT coordinate system to
the VIS to OBJECT coordinate system taking into
account the GOVGF_APPLY_OBJECT_TO_VIS_TRANSFORM bit
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - object
dx - gstate
RETURN:
dx - gstate with transform applied
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
opt bit not set
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/27/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianOptApplyOBJECTToVISTransform proc far
class GrObjVisGuardianClass
uses di
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
GrObjDeref di,ds,si
test ds:[di].GOVGI_flags, mask GOVGF_APPLY_OBJECT_TO_VIS_TRANSFORM
jnz send
call GrObjVisGuardianApplyOBJECTToVISTransform
done:
.leave
ret
send:
push ax
mov ax,MSG_GOVG_APPLY_OBJECT_TO_VIS_TRANSFORM
call ObjCallInstanceNoLock
pop ax
jmp done
GrObjVisGuardianOptApplyOBJECTToVISTransform endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianApplyOBJECTToVISTransform
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
Apply transformation from OBJECT coordinate system to
the VIS coordinate system
This will transform VIS coordinates into OBJECT coordinates
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
dx - gstate
RETURN:
dx - gstate with transform applied
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
The goal is to create a transformation to transform
the vis bounds into a rectangle with the same dimensions
as the object bounds with its center a 0,0.
This default handler does the following
A scale factor is calculated from the vis bounds
to the object dimensions and then applied. Then
the center of the vis bounds is translated to 0,0
KNOWN BUGS/SIDE EFFECTS/IDEAS:
WARNING: This method is not dynamic, so the passed
parameters are more limited and you must be careful
what you destroy.
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/11/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianApplyOBJECTToVISTransform method GrObjVisGuardianClass,
MSG_GOVG_APPLY_OBJECT_TO_VIS_TRANSFORM
uses ax,bx,cx,bp,di
.enter
mov di,dx ;gstate
; Calc scale factor from vis bounds to object dimensions
; and apply it if both not 1.0
;
call GrObjVisGuardianCalcScaleFactorVISToOBJECT
jc translate
call GrApplyScale
translate:
; Calc translation, (- center), and apply it
;
push di ;gstate
call GrObjVisGuardianGetWardWWFixedCenter
negwwf dxcx
negwwf bxax
pop di ;gstate
call GrApplyTranslation
mov dx,di ;gstate
.leave
ret
GrObjVisGuardianApplyOBJECTToVISTransform endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianApplySPRITEOBJECTToVISTransform
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
Apply transformation from SPRITEOBJECT coordinate system to
the VIS coordinate system
This will transform VIS coordinates into SPRITEOBJECT coordinates
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
dx - gstate
RETURN:
dx - gstate with transform applied
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
The goal is to create a transformation to transform
the vis bounds into a rectangle with the same dimensions
as the object bounds with its center a 0,0.
This default handler does the following
A scale factor is calculated from the vis bounds
to the object dimensions and then applied. Then
the center of the vis bounds is translated to 0,0
KNOWN BUGS/SIDE EFFECTS/IDEAS:
WARNING: This method is not dynamic, so the passed
parameters are more limited and you must be careful
what you destroy.
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/11/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianApplySPRITEOBJECTToVISTransform method dynamic \
GrObjVisGuardianClass, MSG_GOVG_APPLY_SPRITE_OBJECT_TO_VIS_TRANSFORM
uses ax,cx,bp
.enter
mov di,dx ;gstate
; Calc scale factor from vis bounds to object dimensions
; and apply it if both not 1.0
;
call GrObjVisGuardianCalcScaleFactorVISToSPRITEOBJECT
jc translate
call GrApplyScale
translate:
; Calc translation, (- center), and apply it
;
push di ;gstate
call GrObjVisGuardianGetWardWWFixedCenter
negwwf dxcx
negwwf bxax
pop di ;gstate
call GrApplyTranslation
mov dx,di ;gstate
.leave
ret
GrObjVisGuardianApplySPRITEOBJECTToVISTransform endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianCalcScaleFactorVISToOBJECT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate scale factor from vis wards vis bounds
to object dimensions of guardian
CALLED BY: INTERNAL
GrObjVisGuardianApplyOBJECTToVISTransform
BitmapGuardianGainedEditGrab
PASS:
*ds:si - GrObjVisGuardian
RETURN:
dx:cx - WWFixed x scale factor
bx:ax - WWFixed y scale factor
stc - if both scale factors are 1.0
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL_SIZE
as it is called for drawing and for each mouse event
Common cases:
Vis bounds equal object dimensions
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianCalcScaleFactorVISToOBJECT proc far
class GrObjVisGuardianClass
uses di,si
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
GrObjDeref di,ds,si
tst ds:[di].GOI_normalTransform
jz noNormalTransform
CallMod GrObjGetNormalOBJECTDimensions
call GrObjVisGuardianCalcScaleFactorVISToDimensions
done:
.leave
ret
noNormalTransform:
; There is no normalTransform so just return the scale factor
; as zero.
;
clr ax,bx,cx,dx ;clears carry
stc
jmp done
GrObjVisGuardianCalcScaleFactorVISToOBJECT endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianCalcScaleFactorVISToSPRITEOBJECT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate scale factor from vis wards vis bounds
to sprite object dimensions of guardian
CALLED BY: INTERNAL
GrObjVisGuardianApplySPRITE_OBJECTToVISTransform
PASS:
*ds:si - GrObjVisGuardian
RETURN:
dx:cx - WWFixed x scale factor
bx:ax - WWFixed y scale factor
stc - if both scale factors are 1.0
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL_SIZE
as it is called for drawing and for each mouse event during
a move or resize
Common cases:
Vis bounds equal object dimensions
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianCalcScaleFactorVISToSPRITEOBJECT proc far
class GrObjVisGuardianClass
uses di,si
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
GrObjDeref di,ds,si
tst ds:[di].GOI_spriteTransform
jz noSpriteTransform
CallMod GrObjGetSpriteOBJECTDimensions
call GrObjVisGuardianCalcScaleFactorVISToDimensions
done:
.leave
ret
noSpriteTransform:
; There is no spriteTransform so just return the scale factor
; as zero.
;
clr ax,bx,cx,dx ;clears carry
stc
jmp done
GrObjVisGuardianCalcScaleFactorVISToSPRITEOBJECT endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianCalcScaleFactorVISToDimensions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Calculate scale factor from vis ward's vis bounds
to passed dimensions
CALLED BY: INTERNAL
GrObjVisGuardianCalcScaleFactorVISToSPRITE
GrObjVisGuardianCalcScaleFactorVISToOBJECT
PASS:
*ds:si - GrObjVisGuardian
dxcx - WWFixed x dimension
bxax - WWFixed y dimension
RETURN:
dx:cx - WWFixed x scale factor
bx:ax - WWFixed y scale factor
stc - if both scale factors are 1.0
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SPEED over SMALL_SIZE
as it is called for drawing and for each mouse event
Common cases:
Vis bounds equal object dimensions
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/16/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianCalcScaleFactorVISToDimensions proc far
class GrObjVisGuardianClass
objectWidth local WWFixed
uses di,si
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
movwwf objectWidth, dxcx
call GrObjVisGuardianGetWardSize
;
; If either vis dimension is zero:
; actually, we want to stuff the Ward's Size such that
; that direction's transform is 1
jcxz fixFirst
checkOther:
tst dx
jz fixSecond
continue:
; Check for vis bounds equaling object dimensions
;
cmp bx,dx ;height ints
jne doDivide
cmp objectWidth.WWF_int,cx
jne doDivide
tst ax ;object height frac
jnz doDivide
tst objectWidth.WWF_frac
jnz doDivide
; Set both scale factors to 1.0 and flag nice results
;
mov cx,1
mov dx,cx
clr ax, bx
stc
done:
.leave
ret
fixFirst:
mov cx,bx ; if Ward's size was zero, stuff the
; int part of the passed coord into
; the size so we get a scale of 1
jmp checkOther
fixSecond:
mov dx,objectWidth.WWF_int ; same as above except in
; other dimension
jmp continue
doDivide:
; Divide object width and height by VIS width and height
;
push cx ;VIS width int
xchg dx,bx ;OBJECT height int, VIS height int
mov_tr cx,ax ;OBJECT height frac
clr ax ;VIS height frac
call GrSDivWWFixed ;calc y scale factor
pop bx ;VIS width int
push dx,cx ;y scale factor
movwwf dxcx,objectWidth
call GrSDivWWFixed ;calc x scale factor
pop bx,ax ;y scale factor
clc
jmp done
GrObjVisGuardianCalcScaleFactorVISToDimensions endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianDrawFGArea
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Draw the visual ward
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
cl - DrawFlags
dx - gstate
bp - GrObjDrawFlags
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 12/ 7/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianDrawFGArea method dynamic GrObjVisGuardianClass,
MSG_GO_DRAW_FG_AREA,
MSG_GO_DRAW_FG_AREA_HI_RES,
MSG_GO_DRAW_CLIP_AREA,
MSG_GO_DRAW_CLIP_AREA_HI_RES
.enter
mov di,dx ;gstate
call GrSaveTransform
call GrObjVisGuardianOptApplyOBJECTToVISTransform
; Send draw message to vis ward
;
push cx,dx,bp ;DrawFlags,gstate,GrObjDrawFlags
test bp, mask GODF_DRAW_OBJECTS_ONLY
jnz foolVisObjects
continue:
mov bp,dx ;gstate
mov di,mask MF_FIXUP_DS
mov ax, MSG_VIS_DRAW
call GrObjVisGuardianMessageToVisWard
pop cx,dx,bp ;DrawFlags,gstate,GrObjDrawFlags
; Restore gstate transformation
;
mov di,dx ;gstate
call GrRestoreTransform
.leave
ret
foolVisObjects:
; If we are supposed to only draw the objects prevent the vis objects
; from drawing their selections and such by passing the print flag.
;
ornf cl,mask DF_PRINT
jmp continue
GrObjVisGuardianDrawFGArea endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianGetWardWWFixedCenter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the WWFixed center of the vis wards vis bounds.
This routine can be used instead of
MSG_GV_GET_WWFIXED_CENTER for speed purposes.
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - GrObjVisGuardian
RETURN:
dx:cx - WWFixed x of center
bx:ax - WWFixed y of center
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/27/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianGetWardWWFixedCenter proc far
class VisClass
uses si,ds,bp
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
.warn -private
GrObjDeref si,ds,si
movdw bxsi,ds:[si].GOVGI_ward
tst bx
jz bummer
.warn +private
push bx ;ward handle
call ObjLockObjBlock
mov ds,ax
mov si,ds:[si]
add si,ds:[si].Vis_offset
; (width)/2 + left
;
mov dx,ds:[si].VI_bounds.R_right
mov bx,ds:[si].VI_bounds.R_left
sub dx,bx ;width int
clr cx ;width frac
sar dx,1 ;width/2 int
rcr cx,1 ;width/2 frac
add dx,bx ;width/2 + left
; (height)/2 + top
;
mov bp,ds:[si].VI_bounds.R_bottom
mov bx,ds:[si].VI_bounds.R_top
sub bp,bx ;height int
clr ax ;height frac
sar bp,1 ;height/2 rcr
rcr ax,1 ;height/2 frac
add bp,bx ;height/2 + top
pop bx ;ward handle
call MemUnlock
mov bx,bp
done:
.leave
ret
bummer:
; Hopefully this won't cause any trouble. This situation
; occurs when the text object decides to send out messages
; while it is handling MSG_META_FINAL_OBJ_FREE.
;
mov dx,10
mov bx,dx
clrdw axcx
jmp done
GrObjVisGuardianGetWardWWFixedCenter endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianGetWardSize
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Return the size of the vis bounds of the ward
This routine can be used instead of
MSG_VIS_GET_SIZE for speed purposes.
CALLED BY: INTERNAL UTILITY
PASS: *ds:si - GrObjVisGuardian
RETURN: cx -- width of object
dx -- height of object
DESTROYED:
nothing
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine should be optimized for SMALL SIZE over SPEED
Common cases:
unknown
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 8/27/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianGetWardSize proc far
class GrObjVisGuardianClass
uses ax,si,ds,bx
.enter
EC < call ECGrObjVisGuardianCheckLMemObject >
GrObjDeref si,ds,si
movdw bxsi,ds:[si].GOVGI_ward
tst bx
jz bummer
call ObjLockObjBlock
mov ds,ax
call VisGetSize
call MemUnlock
done:
.leave
ret
bummer:
; Hopefully this won't cause any trouble. This situation
; occurs when the text object decides to send out messages
; while it is handling MSG_META_FINAL_OBJ_FREE.
;
mov cx,10
mov dx,cx
jmp done
GrObjVisGuardianGetWardSize endp
GrObjDrawCode ends
GrObjAlmostRequiredCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianAfterAddedToBody
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sent to object just after it is added to the body
Set guardian link in vis ward
Mark the vis object as realized so it can draw and
set an upward link to the body. This is needed for
fuping characters and such.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 11/19/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianAfterAddedToBody method dynamic GrObjVisGuardianClass,
MSG_GO_AFTER_ADDED_TO_BODY
uses cx,dx,bp
.enter
mov di,offset GrObjVisGuardianClass
CallSuper MSG_GO_AFTER_ADDED_TO_BODY
push si ;guardian chunk
GrObjGetBodyOD
mov cx,bx ;body handle
mov dx,si ;body chunk
pop si ;guardian chunk
mov di, mask MF_FIXUP_DS
mov ax,MSG_GV_SET_REALIZED_AND_UPWARD_LINK
call GrObjVisGuardianMessageToVisWard
.leave
ret
GrObjVisGuardianAfterAddedToBody endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianBeforeRemovedFromBody
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sent to object just before it is removed from body.
Remove vis ward visually from body.
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjVisGuardianClass
RETURN:
nothing
DESTROYED:
ax
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 1/ 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianBeforeRemovedFromBody method dynamic GrObjVisGuardianClass,
MSG_GO_BEFORE_REMOVED_FROM_BODY
.enter
mov di, mask MF_FIXUP_DS
mov ax,MSG_GV_CLEAR_REALIZED_AND_UPWARD_LINK
call GrObjVisGuardianMessageToVisWard
mov ax,MSG_GO_BEFORE_REMOVED_FROM_BODY
mov di,offset GrObjVisGuardianClass
CallSuper MSG_GO_BEFORE_REMOVED_FROM_BODY
.leave
ret
GrObjVisGuardianBeforeRemovedFromBody endm
GrObjAlmostRequiredCode ends
GrObjRequiredInteractiveCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjVisGuardianPARENTPointForEdit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Have object evaluate the passed point in terms
of editing. (ie could the object edit it self
at this point)(eg for a bitmap, anywhere within
its bounds, for a spline, somewhere along the spline
or drawn control points).
PASS:
*(ds:si) - instance data of object
ds:[bx] - instance data of object
ds:[di] - master part of object (if any)
es - segment of GrObjClass
ss:bp - PointDWFixed in PARENT coordinate system
RETURN:
al - EvaluatePositionRating
dx - EvaluatePositionNotes
DESTROYED:
ah
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This method should be optimized for SMALL SIZE over SPEED
Common cases:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 4/29/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjVisGuardianPARENTPointForEdit method dynamic GrObjVisGuardianClass,
MSG_GO_EVALUATE_PARENT_POINT_FOR_EDIT
.enter
mov ax,MSG_GO_EVALUATE_PARENT_POINT_FOR_SELECTION
call ObjCallInstanceNoLock
call GrObjCanEdit?
jnc cantEdit
done:
.leave
ret
cantEdit:
; Object can't be edited, so evaluate as none but leave the
; notes intact.
;
mov al,EVALUATE_NONE
jmp done
GrObjVisGuardianPARENTPointForEdit endm
GrObjRequiredInteractiveCode ends
if ERROR_CHECK
GrObjErrorCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ECGrObjVisGuardianCheckLMemObject
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see if *ds:si* is a pointer to an object stored
in an object block and that it is an GrObjVisGuardianClass or one
of its subclasses
CALLED BY: INTERNAL
PASS:
*(ds:si) - object chunk to check
RETURN:
none
DESTROYED:
nothing - not even flags
PSEUDO CODE/STRATEGY:
none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
srs 2/24/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ECGrObjVisGuardianCheckLMemObject proc far
uses es,di
.enter
pushf
mov di,segment GrObjVisGuardianClass
mov es,di
mov di,offset GrObjVisGuardianClass
call ObjIsObjectInClass
ERROR_NC OBJECT_NOT_OF_CORRECT_CLASS
popf
.leave
ret
ECGrObjVisGuardianCheckLMemObject endp
GrObjErrorCode ends
endif
|
libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_tanh.asm | dikdom/z88dk | 1 | 3120 | <filename>libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_tanh.asm
SECTION code_fp_am9511
PUBLIC cam32_sdcc_tanh
EXTERN asm_sdcc_read1, _am9511_tanh
.cam32_sdcc_tanh
call asm_sdcc_read1
jp _am9511_tanh
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1335.asm | ljhsiun2/medusa | 9 | 11675 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_1335.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %r14
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x200f, %r8
nop
nop
nop
nop
nop
sub %r14, %r14
mov $0x6162636465666768, %r10
movq %r10, %xmm3
movups %xmm3, (%r8)
nop
nop
xor %rbx, %rbx
lea addresses_A_ht+0x15b7d, %rsi
lea addresses_D_ht+0x1a10, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
dec %r13
mov $126, %rcx
rep movsl
nop
nop
nop
nop
nop
add $42890, %r13
lea addresses_A_ht+0x1250f, %r8
nop
nop
nop
sub %r13, %r13
mov $0x6162636465666768, %rcx
movq %rcx, %xmm2
movups %xmm2, (%r8)
nop
nop
nop
nop
sub $36151, %r10
lea addresses_normal_ht+0x1ba0f, %r8
nop
nop
cmp $30290, %r10
mov (%r8), %r14
nop
nop
nop
nop
nop
dec %rcx
lea addresses_UC_ht+0x1bd4f, %r8
nop
nop
nop
nop
add %r14, %r14
vmovups (%r8), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rcx
nop
dec %rbx
lea addresses_WC_ht+0xd10f, %rbx
nop
and $16131, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
movups %xmm7, (%rbx)
nop
nop
xor $51003, %rcx
lea addresses_WT_ht+0x14b8f, %rdi
nop
nop
nop
nop
nop
add $38609, %rsi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm3
vmovups %ymm3, (%rdi)
nop
nop
nop
sub %rbx, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %rax
push %rbx
push %rsi
// Faulty Load
lea addresses_normal+0xad0f, %rsi
nop
nop
nop
sub %r13, %r13
vmovups (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %rax
lea oracles, %rsi
and $0xff, %rax
shlq $12, %rax
mov (%rsi,%rax,1), %rax
pop %rsi
pop %rbx
pop %rax
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 0, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
source/data.asm | paulscottrobson/rpl-32 | 0 | 162232 | ; ******************************************************************************
; ******************************************************************************
;
; Name : data.asm
; Purpose : Data Allocation.
; Author : <NAME> (<EMAIL>)
; Created : 3rd October 2019
;
; ******************************************************************************
; ******************************************************************************
; ******************************************************************************
;
; Default Address Spaces
;
; ******************************************************************************
BuildAddress = $A000 ; build the interpreter here
StackAddress = $0C00 ; 1k of stack space (256 x 32 bits)
MemoryStart = $1000 ; system memory starts here
MemoryEnd = $9F00 ; and ends here.
StructureStack = $0BFF ; structure stack (works down to $xx00)
ExtDataArea = $0800 ; space where non zp data goes
InputBuffer = $0900 ; Input Buffer
TokeniseBuffer = $0A00 ; Tokenising buffer
HashTableSize = 16 ; hash tables to search.
; ******************************************************************************
;
; Sections so library functions can allocate zero page
;
; ******************************************************************************
* = $0010
.dsection zeroPage
.cerror * > $8F,"Page Zero Overflow"
* = ExtDataArea
.dsection dataArea
;.cerror * > ExtDataArea+$100,"Data Area Overflow"
; ******************************************************************************
;
; Allocate Zero Page usage
;
; ******************************************************************************
.section zeroPage
CodePtr: .word ? ; code pointer
StructSP: .word ? ; structure stack pointer
zTemp0: .word ? ; temporary words
zTemp1: .word ?
zTemp2: .word ?
zTemp3: .word ?
zTemp4: .word ?
zLTemp1: .dword ? ; temporary longs
idDataAddr: .word ? ; data address.
.send zeroPage
; ******************************************************************************
;
; Non zero page data area
;
; ******************************************************************************
.section dataArea
SBuffer: .fill 32 ; string buffer
SBPosition: .byte ? ; position in String Buffer
NumConvCount: .byte ? ; used in int to string
breakCount: .byte ? ; used to stop break firing every execution.
SignCount: .byte ? ; sign count for divide
NumSuppress: .byte ? ; zero suppression flag
IFSHexFlag: .byte ? ; $FF if hex, $00 if dec
ReturnDefZero: .byte ? ; non-zero if undefined idents -> 0
.send dataArea
; ******************************************************************************
;
; Allocate Memory in the current instance space
;
; ******************************************************************************
* = MemoryStart
AZVariables: .fill 26*4 ; 26 x 4 byte variables, which are A-Z
HashTable: .fill HashTableSize * 2 ; n x 2 links for the hash tables.
VarMemory: .word 0 ; next free byte available for VARIABLES (going up)
AllocMemory: .word 0 ; last free byte availabel for ALLOC (going down)
ProgramStart = MemoryStart + $100 ; where code actually goes.
; ******************************************************************************
;
; Stack - actually four 1/4 stacks, one for each byte.
;
; ******************************************************************************
stack0 = StackAddress
stack1 = StackAddress+256
stack2 = StackAddress+512
stack3 = StackAddress+768
; ******************************************************************************
;
; Other constants
;
; ******************************************************************************
;
; Identifiers used in internal storage
;
IDT_VARIABLE = 'V' ; type markers for the information store.
IDT_PROCEDURE = 'P' ; standard procedure (e.g. in code)
IDT_CODEPROC = 'C' ; machine language procedure.
;
; Markers used on the structure stack.
;
STM_FOR = 'F' ; structure markers (for/next)
STM_CALL = 'C' ; call & return (& ;)
STM_REPEAT = 'R' ; repeat & until
;
; Colours.
;
COL_BLACK = 0
COL_RED = 1
COL_GREEN = 2
COL_YELLOW = 3
COL_BLUE = 4
COL_MAGENTA = 5
COL_CYAN = 6
COL_WHITE = 7
COL_RVS = 8
;
; Theming
;
CTH_ERROR = COL_MAGENTA
CTH_TOKEN = COL_WHITE
CTH_IDENT = COL_YELLOW
CTH_COMMENT = COL_GREEN|COL_RVS
CTH_LCOMMENT = COL_RED|COL_RVS
CTH_STRING = COL_MAGENTA
CTH_NUMBER = COL_CYAN
CTH_LINENO = COL_MAGENTA
;
; Screen Command
;
SCM_CLS = 147 ; clear screen
|
zad2_5.asm | tomwisniewskiprv/ASM | 1 | 23113 | <gh_stars>1-10
;worksheet 2
;exercise 5
;INT 16h AH = 00h - read keystroke
;Return: AL = character read from standard input
%TITLE "READ UNTIL ENTER"
.8086
.MODEL small
.STACK 256
.DATA
ENTER_KEY equ 0Dh
CHARS dw 010h
.CODE
MAIN PROC
mov ax , @DATA
mov ds , ax
mov bx , ENTER_KEY
mov cx , CHARS
readUntilEnter:
mov ah , 00h
int 16h
cmp bl , al ; pressed ENTER ?
je Exit
mov ah , 02h
mov dl , 2Ah
int 21h
loop readUntilEnter ; loop for 16 times
Exit:
mov ah , 4Ch
int 21h
MAIN ENDP
END MAIN |
tools/gen/gen-write_xml.adb | reznikmm/increment | 5 | 25024 | -- Copyright (c) 2015-2017 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with Anagram.Grammars.LR;
with Anagram.Grammars.LR_Tables;
with League.Strings;
with XML.SAX.Attributes;
with XML.SAX.Output_Destinations.Strings;
with XML.SAX.Pretty_Writers;
procedure Gen.Write_XML
(Name : String;
Plain : Anagram.Grammars.Grammar;
Table : Anagram.Grammars.LR_Tables.Table)
is
function "+" (Text : Wide_Wide_String)
return League.Strings.Universal_String
renames League.Strings.To_Universal_String;
procedure Write_Names
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer);
procedure Write_Counts
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer);
procedure Write_NT
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer);
procedure Write_States
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer);
procedure Write_Actions
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer);
-------------------
-- Write_Actions --
-------------------
procedure Write_Actions
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer)
is
use Anagram.Grammars.LR_Tables;
begin
Writer.Start_Element (+"actions");
for State in 1 .. Last_State (Table) loop
for Term in 0 .. Plain.Last_Terminal loop
declare
S : constant Anagram.Grammars.LR.State_Count :=
Shift (Table, State, Term);
R : constant Reduce_Iterator := Reduce (Table, State, Term);
begin
if Term in 0 and Finish (Table, State) then
Writer.Characters (+" F");
elsif S not in 0 then
declare
Text : constant Wide_Wide_String :=
Anagram.Grammars.LR.State_Count'Wide_Wide_Image (S);
begin
Writer.Characters (+" S");
Writer.Characters (+Text (2 .. Text'Last));
end;
elsif not Is_Empty (R) then
Writer.Characters
(Anagram.Grammars.Production_Index'Wide_Wide_Image
(Production (R)));
else
Writer.Characters (+" E");
end if;
end;
end loop;
for NT in 1 .. Plain.Last_Non_Terminal loop
declare
S : constant Anagram.Grammars.LR.State_Count :=
Shift (Table, State, NT);
R : constant Reduce_Iterator := Reduce (Table, State, NT);
begin
if S not in 0 then
declare
Text : constant Wide_Wide_String :=
Anagram.Grammars.LR.State_Count'Wide_Wide_Image (S);
begin
Writer.Characters (+" S");
Writer.Characters (+Text (2 .. Text'Last));
end;
elsif not Is_Empty (R) then
Writer.Characters
(Anagram.Grammars.Production_Index'Wide_Wide_Image
(Production (R)));
else
Writer.Characters (+" E");
end if;
end;
end loop;
end loop;
Writer.End_Element (+"actions");
end Write_Actions;
------------------
-- Write_Counts --
------------------
procedure Write_Counts
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer)
is
use type Anagram.Grammars.Part_Count;
begin
Writer.Start_Element (+"counts");
for Prod of Plain.Production loop
Writer.Characters
(+Anagram.Grammars.Part_Count'Wide_Wide_Image
(Prod.Last - Prod.First + 1));
end loop;
Writer.End_Element (+"counts");
end Write_Counts;
-----------------
-- Write_Names --
-----------------
procedure Write_Names
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer)
is
Name : constant League.Strings.Universal_String := +"name";
Names : XML.SAX.Attributes.SAX_Attributes;
begin
Names.Set_Value
(+"term",
+Anagram.Grammars.Terminal_Count'Wide_Wide_Image
(Plain.Last_Terminal));
Names.Set_Value
(+"nt",
+Anagram.Grammars.Non_Terminal_Count'Wide_Wide_Image
(Plain.Last_Non_Terminal));
Writer.Start_Element (+"names", Names);
Names.Clear;
for Term in 1 .. Plain.Last_Terminal loop
Names.Set_Value (Name, Plain.Terminal (Term).Image);
Writer.Start_Element (Name, Names);
Writer.End_Element (Name);
end loop;
for NT in 1 .. Plain.Last_Non_Terminal loop
Names.Set_Value (Name, Plain.Non_Terminal (NT).Name);
Writer.Start_Element (Name, Names);
Writer.End_Element (Name);
end loop;
Writer.End_Element (+"names");
end Write_Names;
procedure Write_NT
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer) is
begin
Writer.Start_Element (+"nt");
for NT of Plain.Non_Terminal loop
Writer.Characters
(+Anagram.Grammars.Production_Index'Wide_Wide_Image (NT.First));
Writer.Characters
(+Integer'Wide_Wide_Image (-Positive (NT.Last)));
end loop;
Writer.End_Element (+"nt");
end Write_NT;
procedure Write_States
(Writer : in out XML.SAX.Pretty_Writers.XML_Pretty_Writer)
is
use Anagram.Grammars.LR_Tables;
List : XML.SAX.Attributes.SAX_Attributes;
begin
List.Set_Value
(+"count",
+Anagram.Grammars.LR.State_Count'Wide_Wide_Image
(Last_State (Table)));
Writer.Start_Element (+"states", List);
for State in 1 .. Last_State (Table) loop
for NT in 1 .. Plain.Last_Non_Terminal loop
declare
S : constant Anagram.Grammars.LR.State_Count :=
Shift (Table, State, NT);
begin
Writer.Characters
(+Anagram.Grammars.LR.State_Count'Wide_Wide_Image (S));
end;
end loop;
end loop;
Writer.End_Element (+"states");
end Write_States;
File : Ada.Wide_Wide_Text_IO.File_Type;
-- Empty : XML.SAX.Attributes.SAX_Attributes;
Writer : XML.SAX.Pretty_Writers.XML_Pretty_Writer;
Output : aliased
XML.SAX.Output_Destinations.Strings.String_Output_Destination;
begin
Writer.Set_Output_Destination (Output'Unchecked_Access);
Writer.Start_Document;
Writer.Start_Element (+"incr");
Write_Names (Writer);
Write_Counts (Writer);
Write_NT (Writer);
Write_States (Writer);
Write_Actions (Writer);
Writer.End_Element (+"incr");
Writer.End_Document;
Ada.Wide_Wide_Text_IO.Create (File, Name => Name);
Ada.Wide_Wide_Text_IO.Put_Line (File, Output.Get_Text.To_Wide_Wide_String);
Ada.Wide_Wide_Text_IO.Close (File);
end Gen.Write_XML;
|
Task/Echo-server/Ada/echo-server-2.ada | mbirabhadra/RosettaCodeData | 1 | 10093 | with Ada.Text_IO;
with Ada.IO_Exceptions;
with GNAT.Sockets;
procedure echo_server_multi is
-- Multiple socket connections example based on Rosetta Code echo server.
Tasks_To_Create : constant := 3; -- simultaneous socket connections.
-------------------------------------------------------------------------------
-- Use stack to pop the next free task index. When a task finishes its
-- asynchronous (no rendezvous) phase, it pushes the index back on the stack.
type Integer_List is array (1..Tasks_To_Create) of integer;
subtype Counter is integer range 0 .. Tasks_To_Create;
subtype Index is integer range 1 .. Tasks_To_Create;
protected type Info is
procedure Push_Stack (Return_Task_Index : in Index);
procedure Initialize_Stack;
entry Pop_Stack (Get_Task_Index : out Index);
private
Task_Stack : Integer_List; -- Stack of free-to-use tasks.
Stack_Pointer: Counter := 0;
end Info;
protected body Info is
procedure Push_Stack (Return_Task_Index : in Index) is
begin -- Performed by tasks that were popped, so won't overflow.
Stack_Pointer := Stack_Pointer + 1;
Task_Stack(Stack_Pointer) := Return_Task_Index;
end;
entry Pop_Stack (Get_Task_Index : out Index) when Stack_Pointer /= 0 is
begin -- guarded against underflow.
Get_Task_Index := Task_Stack(Stack_Pointer);
Stack_Pointer := Stack_Pointer - 1;
end;
procedure Initialize_Stack is
begin
for I in Task_Stack'range loop
Push_Stack (I);
end loop;
end;
end Info;
Task_Info : Info;
-------------------------------------------------------------------------------
task type SocketTask is
-- Rendezvous the setup, which sets the parameters for entry Echo.
entry Setup (Connection : GNAT.Sockets.Socket_Type;
Client : GNAT.Sockets.Sock_Addr_Type;
Channel : GNAT.Sockets.Stream_Access;
Task_Index : Index);
-- Echo accepts the asynchronous phase, i.e. no rendezvous. When the
-- communication is over, push the task number back on the stack.
entry Echo;
end SocketTask;
task body SocketTask is
my_Connection : GNAT.Sockets.Socket_Type;
my_Client : GNAT.Sockets.Sock_Addr_Type;
my_Channel : GNAT.Sockets.Stream_Access;
my_Index : Index;
begin
loop -- Infinitely reusable
accept Setup (Connection : GNAT.Sockets.Socket_Type;
Client : GNAT.Sockets.Sock_Addr_Type;
Channel : GNAT.Sockets.Stream_Access;
Task_Index : Index) do
-- Store parameters and mark task busy.
my_Connection := Connection;
my_Client := Client;
my_Channel := Channel;
my_Index := Task_Index;
end;
accept Echo; -- Do the echo communications.
begin
Ada.Text_IO.Put_Line ("Task " & integer'image(my_Index));
loop
Character'Output (my_Channel, Character'Input(my_Channel));
end loop;
exception
when Ada.IO_Exceptions.End_Error =>
Ada.Text_IO.Put_Line ("Echo " & integer'image(my_Index) & " end");
when others =>
Ada.Text_IO.Put_Line ("Echo " & integer'image(my_Index) & " err");
end;
GNAT.Sockets.Close_Socket (my_Connection);
Task_Info.Push_Stack (my_Index); -- Return to stack of unused tasks.
end loop;
end SocketTask;
-------------------------------------------------------------------------------
-- Setup the socket receiver, initialize the task stack, and then loop,
-- blocking on Accept_Socket, using Pop_Stack for the next free task from the
-- stack, waiting if necessary.
task type SocketServer (my_Port : GNAT.Sockets.Port_Type) is
entry Listen;
end SocketServer;
task body SocketServer is
Receiver : GNAT.Sockets.Socket_Type;
Connection : GNAT.Sockets.Socket_Type;
Client : GNAT.Sockets.Sock_Addr_Type;
Channel : GNAT.Sockets.Stream_Access;
Worker : array (1..Tasks_To_Create) of SocketTask;
Use_Task : Index;
begin
accept Listen;
GNAT.Sockets.Create_Socket (Socket => Receiver);
GNAT.Sockets.Set_Socket_Option
(Socket => Receiver,
Option => (Name => GNAT.Sockets.Reuse_Address, Enabled => True));
GNAT.Sockets.Bind_Socket
(Socket => Receiver,
Address => (Family => GNAT.Sockets.Family_Inet,
Addr => GNAT.Sockets.Inet_Addr ("127.0.0.1"),
Port => my_Port));
GNAT.Sockets.Listen_Socket (Socket => Receiver);
Task_Info.Initialize_Stack;
Find: loop -- Block for connection and take next free task.
GNAT.Sockets.Accept_Socket
(Server => Receiver,
Socket => Connection,
Address => Client);
Ada.Text_IO.Put_Line ("Connect " & GNAT.Sockets.Image(Client));
Channel := GNAT.Sockets.Stream (Connection);
Task_Info.Pop_Stack(Use_Task); -- Protected guard waits if full house.
-- Setup the socket in this task in rendezvous.
Worker(Use_Task).Setup(Connection,Client, Channel,Use_Task);
-- Run the asynchronous task for the socket communications.
Worker(Use_Task).Echo; -- Start echo loop.
end loop Find;
end SocketServer;
Echo_Server : SocketServer(my_Port => 12321);
-------------------------------------------------------------------------------
begin
Echo_Server.Listen;
end echo_server_multi;
|
data/baseStats_weird/omanyte_alt.asm | longlostsoul/EvoYellow | 16 | 27543 | <gh_stars>10-100
db DEX_OMANYTE ; pokedex id
db 35 ; base hp
db 40 ; base attack
db 100 ; base defense
db 35 ; base speed
db 90 ; base special
db BUG ; species type 1
db WATER ; species type 2
db 33 ; catch rate
db 120 ; base exp yield
INCBIN "pic/ymon/omanyte.pic",0,1 ; 55, sprite dimensions
dw OmanytePicFront
dw OmanytePicBack
; attacks known at lvl 0
db WATER_GUN
db WITHDRAW
db LEECH_LIFE
db 0
db 0 ; growth rate
; learnset
tmlearn 6,8
tmlearn 9,10,11,12,13,14
tmlearn 20
tmlearn 31,32
tmlearn 33,34
tmlearn 44
tmlearn 50,53
db BANK(OmanytePicFront)
|
programs/oeis/157/A157112.asm | karttu/loda | 1 | 24163 | ; A157112: a(n) = 5651522*n^2 - 8761372*n + 3395619.
; 285769,8478963,27975201,58774483,100876809,154282179,218990593,295002051,382316553,480934099,590854689,712078323,844605001,988434723,1143567489,1310003299,1487742153,1676784051,1877128993,2088776979,2311728009,2545982083,2791539201,3048399363,3316562569,3596028819,3886798113,4188870451,4502245833,4826924259,5162905729,5510190243,5868777801,6238668403,6619862049,7012358739,7416158473,7831261251,8257667073,8695375939,9144387849,9604702803,10076320801,10559241843,11053465929,11558993059,12075823233,12603956451,13143392713,13694132019,14256174369,14829519763,15414168201,16010119683,16617374209,17235931779,17865792393,18506956051,19159422753,19823192499,20498265289,21184641123,21882320001,22591301923,23311586889,24043174899,24786065953,25540260051,26305757193,27082557379,27870660609,28670066883,29480776201,30302788563,31136103969,31980722419,32836643913,33703868451,34582396033,35472226659,36373360329,37285797043,38209536801,39144579603,40090925449,41048574339,42017526273,42997781251,43989339273,44992200339,46006364449,47031831603,48068601801,49116675043,50176051329,51246730659,52328713033,53421998451,54526586913,55642478419,56769672969,57908170563,59057971201,60219074883,61391481609,62575191379,63770204193,64976520051,66194138953,67423060899,68663285889,69914813923,71177645001,72451779123,73737216289,75033956499,76341999753,77661346051,78991995393,80333947779,81687203209,83051761683,84427623201,85814787763,87213255369,88623026019,90044099713,91476476451,92920156233,94375139059,95841424929,97319013843,98807905801,100308100803,101819598849,103342399939,104876504073,106421911251,107978621473,109546634739,111125951049,112716570403,114318492801,115931718243,117556246729,119192078259,120839212833,122497650451,124167391113,125848434819,127540781569,129244431363,130959384201,132685640083,134423199009,136172060979,137932225993,139703694051,141486465153,143280539299,145085916489,146902596723,148730580001,150569866323,152420455689,154282348099,156155543553,158040042051,159935843593,161842948179,163761355809,165691066483,167632080201,169584396963,171548016769,173522939619,175509165513,177506694451,179515526433,181535661459,183567099529,185609840643,187663884801,189729232003,191805882249,193893835539,195993091873,198103651251,200225513673,202358679139,204503147649,206658919203,208825993801,211004371443,213194052129,215395035859,217607322633,219830912451,222065805313,224312001219,226569500169,228838302163,231118407201,233409815283,235712526409,238026540579,240351857793,242688478051,245036401353,247395627699,249766157089,252147989523,254541125001,256945563523,259361305089,261788349699,264226697353,266676348051,269137301793,271609558579,274093118409,276587981283,279094147201,281611616163,284140388169,286680463219,289231841313,291794522451,294368506633,296953793859,299550384129,302158277443,304777473801,307407973203,310049775649,312702881139,315367289673,318043001251,320730015873,323428333539,326137954249,328858878003,331591104801,334334634643,337089467529,339855603459,342633042433,345421784451,348221829513,351033177619
mov $1,$0
cal $1,157111 ; a(n) = 137842*n - 106846.
pow $1,2
sub $1,960752016
div $1,11303044
mul $1,3362
add $1,285769
|
src/Categories/Category/Unbundled/Properties.agda | Trebor-Huang/agda-categories | 279 | 13798 | <filename>src/Categories/Category/Unbundled/Properties.agda
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Unbundled.Properties where
-- The Obj-unbundled Category is equivalent (as a type) to the
-- usual kind. Quite straightforward and because of η, the proofs are just refl.
open import Data.Product using (Σ; _,_)
open import Level
open import Function using (_↔_; mk↔′)
open import Relation.Binary.PropositionalEquality using (refl)
open import Categories.Category.Core using (Category)
open import Categories.Category.Unbundled renaming (Category to Unb-Cat)
private
variable
o ℓ e : Level
unpack : Category o ℓ e → Σ (Set o) (λ Obj → Unb-Cat Obj ℓ e)
unpack C = C.Obj , record { C }
where module C = Category C
unpack′ : (C : Category o ℓ e) → Unb-Cat (Category.Obj C) ℓ e
unpack′ C = record { C }
where module C = Category C
pack : Σ (Set o) (λ Obj → Unb-Cat Obj ℓ e) → Category o ℓ e
pack (o , uc) = record { Obj = o; UC }
where module UC = Unb-Cat uc
pack′ : {Obj : Set o} → Unb-Cat Obj ℓ e → Category o ℓ e
pack′ {Obj = o} uc = record { Obj = o; UC }
where module UC = Unb-Cat uc
equiv : (Category o ℓ e) ↔ (Σ (Set o) (λ Obj → Unb-Cat Obj ℓ e))
equiv = mk↔′ unpack pack (λ _ → refl) λ _ → refl
|
oeis/157/A157855.asm | neoneye/loda-programs | 11 | 11832 | ; A157855: 103680000n^2 - 46108800n + 5126401.
; 62697601,327628801,799920001,1479571201,2366582401,3460953601,4762684801,6271776001,7988227201,9912038401,12043209601,14381740801,16927632001,19680883201,22641494401,25809465601,29184796801,32767488001,36557539201,40554950401,44759721601,49171852801,53791344001,58618195201,63652406401,68893977601,74342908801,79999200001,85862851201,91933862401,98212233601,104697964801,111391056001,118291507201,125399318401,132714489601,140237020801,147966912001,155904163201,164048774401,172400745601
mul $0,1728000
add $0,1343760
pow $0,2
mov $1,$0
div $1,288
mov $0,$1
sub $0,6269760200
div $0,100
add $0,62697601
|
src/VMTranslator/fixtures/FunctionCalls/StaticsTest/StaticsTest.raw.asm | tuzmusic/HackManager | 1 | 85486 | <reponame>tuzmusic/HackManager
@256 // ** 0A: BOOTSTRAP THE SYSTEM ** (set the start of the stack to addr 256)
D=A // store the current address as a value
@SP // write value of D to "SP"
M=D // write value of D to current location -
@Sys.init$ret.11 // ** 0B: CALL Sys.init **
D=A // D=retAddr
@SP // >>> push retAddr onto stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@LCL // >>> saving "LCL"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@ARG // >>> saving "ARG"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THIS // >>> saving "THIS"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THAT // >>> saving "THAT"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@SP // >>> reposition: LCL = SP
D=M // store the stack pointer (after pushing the retAddr & segments)
@LCL
M=D // save SP to LCL
@5 // >>> reposition ARG = SP-n-5
D=D-A // subtract (frame + num of args) from the stored SP
@ARG
M=D // save SP-n-5 to ARG
@Sys.init // jump to the function
0;JMP -
@SP // ** 1: function Class1.set 0 **
D=M // store SP value
@LCL
M=D // store stack address in LCL (no local vars so we're done) -
@ARG // ** 2: push argument 0 ** (move to argument)
D=M // store the "argument" base address
@0 // move to address representing offset
A=D+A // new addr = base addr + offset
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 3: pop static 0 ** (>> pop stack to Class1.0 << (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@Class1.0
M=D // write value of D to current location -
@ARG // ** 4: push argument 1 ** (move to argument)
D=M // store the "argument" base address
@1 // move to address representing offset
A=D+A // new addr = base addr + offset
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 5: pop static 1 ** (>> pop stack to Class1.1 << (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@Class1.1
M=D // write value of D to current location -
@0 // ** 6: push constant 0 **
D=A // store the current address as a value
@SP // >> push constant value (0) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@LCL // ** 7: return ** (>>> store LCL as FRAME)
D=M // store current memory value
@FRAME // go to "FRAME"
M=D // save the stored value in "FRAME"
@5 // >>> save RET
A=D-A // move to location of retAddr (RET=FRAME-5)
D=M // store current memory value
@RET // go to "RET"
M=D // save the stored value in "RET"
@SP // >> pop stack to *ARG <<
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@ARG
A=M // move to "ARG"
M=D // write value of D to current location
D=A // >>> restore caller's SP. (in prev step, A=ARG)
@SP
M=D+1 // point SP to ARG+1 (one past returned value)
@LCL // >>> restoring saved "THAT"
A=M-1 // move to LCL-1: saved "THAT"
D=M // store saved "THAT"
@THAT
M=D // restore saved "THAT"
@LCL // >>> restoring saved "THIS"
A=M-1 // move to LCL-2: saved "THIS"
A=A-1
D=M // store saved "THIS"
@THIS
M=D // restore saved "THIS"
@LCL // >>> restoring saved "ARG"
A=M-1 // move to LCL-3: saved "ARG"
A=A-1
A=A-1
D=M // store saved "ARG"
@ARG
M=D // restore saved "ARG"
@LCL // >>> restoring saved "LCL"
A=M-1 // move to LCL-4: saved "LCL"
A=A-1
A=A-1
A=A-1
D=M // store saved "LCL"
@LCL
M=D // restore saved "LCL"
@RET // >>> move to the return address, to restore control to caller
A=M // prepare to jump to address stored in RET
0;JMP -
@SP // ** 8: function Class1.get 0 **
D=M // store SP value
@LCL
M=D // store stack address in LCL (no local vars so we're done) -
@Class1.0 // ** 9: push static 0 **
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@Class1.1 // ** 10: push static 1 **
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 11: sub ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M-D // perform binary operation: sub
@SP // increment stack pointer
M=M+1 -
@LCL // ** 12: return ** (>>> store LCL as FRAME)
D=M // store current memory value
@FRAME // go to "FRAME"
M=D // save the stored value in "FRAME"
@5 // >>> save RET
A=D-A // move to location of retAddr (RET=FRAME-5)
D=M // store current memory value
@RET // go to "RET"
M=D // save the stored value in "RET"
@SP // >> pop stack to *ARG <<
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@ARG
A=M // move to "ARG"
M=D // write value of D to current location
D=A // >>> restore caller's SP. (in prev step, A=ARG)
@SP
M=D+1 // point SP to ARG+1 (one past returned value)
@LCL // >>> restoring saved "THAT"
A=M-1 // move to LCL-1: saved "THAT"
D=M // store saved "THAT"
@THAT
M=D // restore saved "THAT"
@LCL // >>> restoring saved "THIS"
A=M-1 // move to LCL-2: saved "THIS"
A=A-1
D=M // store saved "THIS"
@THIS
M=D // restore saved "THIS"
@LCL // >>> restoring saved "ARG"
A=M-1 // move to LCL-3: saved "ARG"
A=A-1
A=A-1
D=M // store saved "ARG"
@ARG
M=D // restore saved "ARG"
@LCL // >>> restoring saved "LCL"
A=M-1 // move to LCL-4: saved "LCL"
A=A-1
A=A-1
A=A-1
D=M // store saved "LCL"
@LCL
M=D // restore saved "LCL"
@RET // >>> move to the return address, to restore control to caller
A=M // prepare to jump to address stored in RET
0;JMP -
@SP // ** 1: function Class2.set 0 **
D=M // store SP value
@LCL
M=D // store stack address in LCL (no local vars so we're done) -
@ARG // ** 2: push argument 0 ** (move to argument)
D=M // store the "argument" base address
@0 // move to address representing offset
A=D+A // new addr = base addr + offset
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 3: pop static 0 ** (>> pop stack to Class2.0 << (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@Class2.0
M=D // write value of D to current location -
@ARG // ** 4: push argument 1 ** (move to argument)
D=M // store the "argument" base address
@1 // move to address representing offset
A=D+A // new addr = base addr + offset
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 5: pop static 1 ** (>> pop stack to Class2.1 << (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@Class2.1
M=D // write value of D to current location -
@0 // ** 6: push constant 0 **
D=A // store the current address as a value
@SP // >> push constant value (0) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@LCL // ** 7: return ** (>>> store LCL as FRAME)
D=M // store current memory value
@FRAME // go to "FRAME"
M=D // save the stored value in "FRAME"
@5 // >>> save RET
A=D-A // move to location of retAddr (RET=FRAME-5)
D=M // store current memory value
@RET // go to "RET"
M=D // save the stored value in "RET"
@SP // >> pop stack to *ARG <<
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@ARG
A=M // move to "ARG"
M=D // write value of D to current location
D=A // >>> restore caller's SP. (in prev step, A=ARG)
@SP
M=D+1 // point SP to ARG+1 (one past returned value)
@LCL // >>> restoring saved "THAT"
A=M-1 // move to LCL-1: saved "THAT"
D=M // store saved "THAT"
@THAT
M=D // restore saved "THAT"
@LCL // >>> restoring saved "THIS"
A=M-1 // move to LCL-2: saved "THIS"
A=A-1
D=M // store saved "THIS"
@THIS
M=D // restore saved "THIS"
@LCL // >>> restoring saved "ARG"
A=M-1 // move to LCL-3: saved "ARG"
A=A-1
A=A-1
D=M // store saved "ARG"
@ARG
M=D // restore saved "ARG"
@LCL // >>> restoring saved "LCL"
A=M-1 // move to LCL-4: saved "LCL"
A=A-1
A=A-1
A=A-1
D=M // store saved "LCL"
@LCL
M=D // restore saved "LCL"
@RET // >>> move to the return address, to restore control to caller
A=M // prepare to jump to address stored in RET
0;JMP -
@SP // ** 8: function Class2.get 0 **
D=M // store SP value
@LCL
M=D // store stack address in LCL (no local vars so we're done) -
@Class2.0 // ** 9: push static 0 **
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@Class2.1 // ** 10: push static 1 **
D=M // store current memory value in D
@SP // >>> push memory value to top of stack
A=M // move to top of stack
M=D // write value of D to current location -
@SP // ** 11: sub ** (PREPARE Y (pop Y into D) (SP decremented above))
A=M // move to top of stack
D=M // store the top stack value into D
@SP // "pop" X
M=M-1
A=M // PREPARE X (prep X "into" M)
M=M-D // perform binary operation: sub
@SP // increment stack pointer
M=M+1 -
@LCL // ** 12: return ** (>>> store LCL as FRAME)
D=M // store current memory value
@FRAME // go to "FRAME"
M=D // save the stored value in "FRAME"
@5 // >>> save RET
A=D-A // move to location of retAddr (RET=FRAME-5)
D=M // store current memory value
@RET // go to "RET"
M=D // save the stored value in "RET"
@SP // >> pop stack to *ARG <<
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@ARG
A=M // move to "ARG"
M=D // write value of D to current location
D=A // >>> restore caller's SP. (in prev step, A=ARG)
@SP
M=D+1 // point SP to ARG+1 (one past returned value)
@LCL // >>> restoring saved "THAT"
A=M-1 // move to LCL-1: saved "THAT"
D=M // store saved "THAT"
@THAT
M=D // restore saved "THAT"
@LCL // >>> restoring saved "THIS"
A=M-1 // move to LCL-2: saved "THIS"
A=A-1
D=M // store saved "THIS"
@THIS
M=D // restore saved "THIS"
@LCL // >>> restoring saved "ARG"
A=M-1 // move to LCL-3: saved "ARG"
A=A-1
A=A-1
D=M // store saved "ARG"
@ARG
M=D // restore saved "ARG"
@LCL // >>> restoring saved "LCL"
A=M-1 // move to LCL-4: saved "LCL"
A=A-1
A=A-1
A=A-1
D=M // store saved "LCL"
@LCL
M=D // restore saved "LCL"
@RET // >>> move to the return address, to restore control to caller
A=M // prepare to jump to address stored in RET
0;JMP -
@SP // ** 1: function Sys.init 0 **
D=M // store SP value
@LCL
M=D // store stack address in LCL (no local vars so we're done) -
@6 // ** 2: push constant 6 **
D=A // store the current address as a value
@SP // >> push constant value (6) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@8 // ** 3: push constant 8 **
D=A // store the current address as a value
@SP // >> push constant value (8) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@Class1.set$ret.7 // ** 4: call Class1.set 2 **
D=A // D=retAddr
@SP // >>> push retAddr onto stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@LCL // >>> saving "LCL"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@ARG // >>> saving "ARG"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THIS // >>> saving "THIS"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THAT // >>> saving "THAT"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@SP // >>> reposition: LCL = SP
D=M // store the stack pointer (after pushing the retAddr & segments)
@LCL
M=D // save SP to LCL
@7 // >>> reposition ARG = SP-n-5
D=D-A // subtract (frame + num of args) from the stored SP
@ARG
M=D // save SP-n-5 to ARG
@Class1.set // jump to the function
0;JMP -
@SP // ** 5: pop temp 0 ** (>> pop stack to 5 <<)
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@5
M=D // write value of D to current location -
@23 // ** 6: push constant 23 **
D=A // store the current address as a value
@SP // >> push constant value (23) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@15 // ** 7: push constant 15 **
D=A // store the current address as a value
@SP // >> push constant value (15) onto stack <<
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1 -
@Class2.set$ret.8 // ** 8: call Class2.set 2 **
D=A // D=retAddr
@SP // >>> push retAddr onto stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@LCL // >>> saving "LCL"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@ARG // >>> saving "ARG"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THIS // >>> saving "THIS"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THAT // >>> saving "THAT"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@SP // >>> reposition: LCL = SP
D=M // store the stack pointer (after pushing the retAddr & segments)
@LCL
M=D // save SP to LCL
@7 // >>> reposition ARG = SP-n-5
D=D-A // subtract (frame + num of args) from the stored SP
@ARG
M=D // save SP-n-5 to ARG
@Class2.set // jump to the function
0;JMP -
@SP // ** 9: pop temp 0 ** (>> pop stack to 5 <<)
M=M-1
A=M // move to top of stack
D=M // store the top stack value into D
@5
M=D // write value of D to current location -
@Class1.get$ret.9 // ** 10: call Class1.get 0 **
D=A // D=retAddr
@SP // >>> push retAddr onto stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@LCL // >>> saving "LCL"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@ARG // >>> saving "ARG"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THIS // >>> saving "THIS"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THAT // >>> saving "THAT"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@SP // >>> reposition: LCL = SP
D=M // store the stack pointer (after pushing the retAddr & segments)
@LCL
M=D // save SP to LCL
@5 // >>> reposition ARG = SP-n-5
D=D-A // subtract (frame + num of args) from the stored SP
@ARG
M=D // save SP-n-5 to ARG
@Class1.get // jump to the function
0;JMP -
@Class2.get$ret.10 // ** 11: call Class2.get 0 **
D=A // D=retAddr
@SP // >>> push retAddr onto stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@LCL // >>> saving "LCL"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@ARG // >>> saving "ARG"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THIS // >>> saving "THIS"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@THAT // >>> saving "THAT"
D=M // store current memory value in D
@SP // > push stored value to top of stack
A=M // move to top of stack
M=D // write value of D to current location
@SP // increment stack pointer
M=M+1
@SP // >>> reposition: LCL = SP
D=M // store the stack pointer (after pushing the retAddr & segments)
@LCL
M=D // save SP to LCL
@5 // >>> reposition ARG = SP-n-5
D=D-A // subtract (frame + num of args) from the stored SP
@ARG
M=D // save SP-n-5 to ARG
@Class2.get // jump to the function
0;JMP - -
@WHILE.VM // ** 13: goto WHILE) ** |
nasm assembly/test -1/abhi_test.asm | AI-Factor-y/NASM-library | 0 | 18164 | <filename>nasm assembly/test -1/abhi_test.asm<gh_stars>0
section .data
msg1 : db 'debug here --',10
l1 : equ $-msg1
msg2 : db 'enter the size of array 1 (n1): '
l2 : equ $-msg2
msg3 : db 'enter the sorted array 1 (ascending) : ',10
l3 : equ $-msg3
msg4 : db 'enter the size of array 2 (n2): '
l4: equ $-msg4
msg5 : db 'enter the sorted array 2 (decending) : ',10
l5: equ $-msg5
msg6 : db 'the merged array is (ascending) =>',10
l6: equ $-msg6
space:db ' '
newline:db '',10
section .bss
num: resd 1
counter: resd 1
n: resd 10
array: resd 50
n1: resd 10
n2: resd 10
array1: resd 50
array2: resd 50
merged: resd 100
merge_count: resd 1
section .text
global _start
_start:
mov eax, 4
mov ebx, 1
mov ecx, msg2
mov edx, l2
int 80h
call read_num
mov ax,word[num]
mov [n1],ax
mov eax, 4
mov ebx, 1
mov ecx, msg3
mov edx, l3
int 80h
mov ebx, array1
mov ax,word[n1]
mov [n],ax
call read_array
mov eax, 4
mov ebx, 1
mov ecx, msg4
mov edx, l4
int 80h
call read_num
mov ax,word[num]
mov [n2],ax
mov eax, 4
mov ebx, 1
mov ecx, msg5
mov edx, l5
int 80h
mov ebx, array2
mov ax,word[n2]
mov [n],ax
call read_array
call merge_array
;; array have been merged .. now print the array
mov eax, 4
mov ebx, 1
mov ecx, msg6
mov edx, l6
int 80h
mov ebx,merged
mov eax,[merge_count]
mov [n],eax
mov eax , 0
call print_array
exit:
mov eax,1
mov ebx,0
int 80h
; section for procedures
;----------------------------
merge_array:
section .bss
cond1: resb 1
cond2: resb 1
num1: resd 1
num2: resd 1
counterFirst: resd 1
counterSecond: resd 1
section .text
push rax
push rbx
push rcx
mov ebx, array1
mov eax,0
mov word[counterFirst],0
mov ax, word[n2]
mov word[counterSecond],ax
mov word[merge_count],0
mov eax,0
loop1:
mov eax,[counterFirst]
cmp eax,dword[n1]
setb cl
mov byte[cond1], cl
mov eax,[counterSecond]
cmp eax, 1
setae cl
mov byte[cond2], cl
mov bl, [cond1]
mov cl,[cond2]
and bl,cl
cmp bl,1
jne exit_loop1
; call debugger
mov ebx, array1 ;; taking num1 = array1[i]
mov eax, [counterFirst]
mov cx,word[ebx+2*eax]
mov word[num1],cx
dec word[counterSecond]
mov ebx, array2
mov eax, [counterSecond] ;; taking num2 = array2[j]
mov cx,word[ebx+2*eax]
mov word[num2],cx
inc word[counterSecond]
; mov bx,word[num1]
; mov word[num], bx
; call print_num
; mov word[num], cx
; call print_num
cmp word[num1],cx
jbe selec_num1
mov cx,word[num2]
mov ebx,merged
mov eax,[merge_count]
; call debugger
mov word[ebx+2*eax],cx
inc word[merge_count]
dec word[counterSecond]
jmp exit_check_cond
selec_num1:
mov cx,word[num1]
mov ebx,merged
mov eax,[merge_count]
; call debugger2
mov word[ebx+2*eax],cx
inc word[merge_count]
inc word[counterFirst]
exit_check_cond:
jmp loop1
exit_loop1:
loop2:
mov eax,[counterFirst]
cmp eax,dword[n1]
jae exit_loop2
mov ebx, array1 ;; taking num1 = array1[i]
mov eax, [counterFirst]
mov cx,word[ebx+2*eax]
mov word[num1],cx
mov cx,word[num1]
; putting residue values to merge array
mov ebx,merged
mov eax,[merge_count]
mov word[ebx+2*eax],cx
inc word[merge_count]
inc word[counterFirst]
jmp loop2
exit_loop2:
loop3:
mov eax,[counterSecond]
cmp eax,1
jb exit_loop3
dec word[counterSecond]
mov ebx, array2 ;; taking num2 = array2[i]
mov eax, [counterSecond]
mov cx,word[ebx+2*eax]
mov word[num2],cx
mov cx,word[num2]
inc word[counterSecond]
; putting residue values to merge array
mov ebx,merged
mov eax,[merge_count]
mov word[ebx+2*eax],cx
inc word[merge_count]
dec word[counterSecond]
jmp loop3
exit_loop3:
pop rcx
pop rbx
pop rax
ret
debugger2:
section .data
msg_debugger2 : db 'execution stops here',10
msg_debugger_l2 : equ $-msg_debugger2
section .text
push rax
push rbx
push rcx
; debug----
mov eax, 4
mov ebx, 1
mov ecx, msg_debugger2
mov edx, msg_debugger_l2
int 80h
;debug ---
pop rcx
pop rbx
pop rax
; action
ret
debugger:
section .data
msg_debugger : db 'debug here --',10
msg_debugger_l : equ $-msg_debugger
section .text
push rax
push rbx
push rcx
; debug----
mov eax, 4
mov ebx, 1
mov ecx, msg_debugger
mov edx, msg_debugger_l
int 80h
;debug ---
pop rcx
pop rbx
pop rax
; action
ret
print_array:
; usage
;-------
; 1: base address of array in ebx mov ebx,array
; 2: size of array in n
push rax ; push all
push rbx
push rcx
mov eax,0
print_loop:
cmp eax,dword[n]
je end_print1
mov cx,word[ebx+2*eax]
mov word[num],cx
;;The number to be printed is copied to ’num’
; before calling print num function
push rax
push rbx
call print_num
pop rbx
pop rax
inc eax
jmp print_loop
end_print1:
; popa
pop rcx
pop rbx
pop rax ; pop all
ret
read_array:
; usage
;-------
; 1: base address of array in ebx
; 2: size of array in n
push rax ; push all
push rbx
push rcx
mov eax ,0
read_loop:
cmp eax,dword[n]
je end_read_1
push rax
push rbx
call read_num
pop rbx
pop rax
;;read num stores the input in ’num’
mov cx,word[num]
mov word[ebx+2*eax],cx
inc eax
;;Here, each word consists of two bytes, so the counter should be
; incremented by multiples of two. If the array is declared in bytes do mov word[ebx+eax],cx
jmp read_loop
end_read_1:
pop rcx
pop rbx
pop rax ; pop all
ret
print_num:
;usage
;------
; 1: create a variable num(word)
; 2: move number to print to num (word)
section .data
nwl_for_printnum :db ' ',10
nwl_l_printnum : equ $-nwl_for_printnum
section .bss
count_printnum : resb 10
temp_printnum : resb 1
section .text
push rax ; push all
push rbx
push rcx
mov byte[count_printnum],0
;call push_reg
extract_no:
cmp word[num], 0
je print_no
inc byte[count_printnum]
mov dx, 0
mov ax, word[num]
mov bx, 10
div bx
push dx ; recursion here
mov word[num], ax
jmp extract_no
print_no:
cmp byte[count_printnum], 0
je end_print
dec byte[count_printnum]
pop dx
mov byte[temp_printnum], dl ; dx is further divided into dh and dl
add byte[temp_printnum], 30h
mov eax, 4
mov ebx, 1
mov ecx, temp_printnum
mov edx, 1
int 80h
jmp print_no
end_print:
mov eax,4
mov ebx,1
mov ecx,nwl_for_printnum
mov edx,nwl_l_printnum
int 80h
;;The memory location ’newline’ should be declared with the ASCII key for new popa
;call pop_reg
pop rcx
pop rbx
pop rax ; pop all
ret
read_num:
;usage
;------
; 1: create a variable num(word)
; 2: the input number is stored into num(word)
section .bss
temp_for_read: resb 1
section .text
push rax ; push all
push rbx
push rcx
mov word[num], 0
loop_read:
;; read a digit
mov eax, 3
mov ebx, 0
mov ecx, temp_for_read
mov edx, 1
int 80h
;;check if the read digit is the end of number, i.e, the enter-key whose ASCII cmp byte[temp], 10
cmp byte[temp_for_read], 10
je end_read
mov ax, word[num]
mov bx, 10
mul bx
mov bl, byte[temp_for_read]
sub bl, 30h
mov bh, 0
add ax, bx
mov word[num], ax
jmp loop_read
end_read:
;;pop all the used registers from the stack using popa
;call pop_reg
pop rcx
pop rbx
pop rax
ret
|
src/NfModel.agda | andreasabel/ipl | 19 | 13017 | -- A Beth model of normal forms
open import Library hiding (_∈_; All)
module NfModel (Base : Set) where
import Formulas ; open module Form = Formulas Base
import Derivations; open module Der = Derivations Base
-- Beth model
-- A cover for Γ is the skeleton of a case tree that can be formed in Γ.
-- It contains the (neutral) scrutinees we case over and the markers (hole)
-- for the leaves that have to be filled by the branches of the case statement.
data Cover (Γ : Cxt) : Set where
hole : Cover Γ
falseC : (t : Ne Γ False) → Cover Γ
orC : ∀{A B} (t : Ne Γ (A ∨ B)) (c : Cover (Γ ∙ A)) (d : Cover (Γ ∙ B)) → Cover Γ
-- Choice of names.
-- hole : has the same role as the hole-evaluation context (identity).
-- falseC: basically falseE.
-- orC : basically orE.
-- Given c : Cover Γ, a path p : Δ ∈ c leads us from the root to one of the leaves (hole)
-- of the case tree. Δ is the context at the leaf.
data _∈_ Δ : ({Γ} : Cxt) (c : Cover Γ) → Set where
here : Δ ∈ hole {Δ}
left : ∀{Γ A B c d} {t : Ne Γ (A ∨ B)} (e : Δ ∈ c) → Δ ∈ orC t c d
right : ∀{Γ A B c d} {t : Ne Γ (A ∨ B)} (e : Δ ∈ d) → Δ ∈ orC t c d
-- Given a case tree c : Cover Γ and a context-indexed set P,
-- f : All c P is an assignment of things in P Δ to holes
-- of type Δ reached by pathes e : Δ ∈ c.
All : ∀{Γ} (c : Cover Γ) (P : (Δ : Cxt) → Set) → Set
All c P = ∀{Δ} (e : Δ ∈ c) → P Δ
-- We can also use All c P with a property P on context,
-- to express that all holes of c satify P.
-- We might want to depend on the path e : Δ ∈ c also:
All' : ∀{Γ} (c : Cover Γ) (P : ∀ {Δ} (e : Δ ∈ c) → Set) → Set
All' c P = ∀{Δ} (e : Δ ∈ c) → P e
-- If c : Cover Γ and e : Δ ∈ C, then Δ must be an extension of Γ.
-- Here, we only prove that it is a thinning.
coverWk : ∀{Γ} {c : Cover Γ} → All c (_≤ Γ)
coverWk here = id≤
coverWk (left e) = coverWk e • weak id≤
coverWk (right e) = coverWk e • weak id≤
-- We can substitute leaves in the case tree by case trees in turn.
-- The following is a ``parallel substitution'' operations for covers.
-- If c : Cover Γ and f is a mapping from the leaves of c to case trees
-- we can graft f onto c to get a new case tree transC c f.
-- Here, the case tree substitution is given as a function from pathes
-- p : Δ ∈ c to covers.
transC : ∀{Γ} (c : Cover Γ) (f : All c Cover) → Cover Γ
transC hole f = f here
transC (falseC t) f = falseC t
transC (orC t c d) f = orC t (transC c (f ∘ left)) (transC d (f ∘ right))
-- Composition of pathes.
-- Assume a c : Cover Γ and a substitution f : Δ ∈ c → ∁over Δ and a path e : Δ ∈ c.
-- Then any path p : Φ ∈ f e can be extended to a path q : Φ ∈ transC c f
-- by essentially concatenating e and p.
-- Note that we maintain f only for the sake of typing.
-- trans∈ : ∀{Γ} (c : Cover Γ) (f : All c Cover) →
-- ∀ {Δ} (e : Δ ∈ c) {Φ} → Φ ∈ f e → Φ ∈ transC c f
trans∈ : ∀{Γ} (c : Cover Γ) (f : All c Cover) →
All' c λ {Δ} (e : Δ ∈ c) → All (f e) (_∈ transC c f)
trans∈ hole f here = id
trans∈ (falseC t) f ()
trans∈ (orC t c d) f (left e) = left ∘ trans∈ c (f ∘ left ) e
trans∈ (orC t c d) f (right e) = right ∘ trans∈ d (f ∘ right) e
-- Splitting of pathes.
-- In a situation similar to the previous lemma:
-- If we have a path q : Φ ∈ transC c f we can split it into some
-- e : Δ ∈ c and p : Φ ∈ f e.
split∈ : ∀{Γ} (c : Cover Γ) (f : All c Cover) {Φ} (q : Φ ∈ transC c f)
→ ∃ λ Δ → ∃ λ (e : Δ ∈ c) → Φ ∈ f e
split∈ hole f q = _ , _ , q
split∈ (falseC t) f ()
split∈ (orC t c d) f (left q) with split∈ c (f ∘ left) q
... | Δ , e₁ , e₂ = Δ , left e₁ , e₂
split∈ (orC t c d) f (right q) with split∈ d (f ∘ right) q
... | Δ , e₁ , e₂ = Δ , right e₁ , e₂
-- Syntactic paste (from Thorsten).
-- If for each leave e : Δ ∈ c of a case tree c : Cover Γ we have a normal form
-- f e : Nf Δ A of type A, grafting these nfs onto c gives us a Nf Γ A.
pasteNf : ∀{A Γ} (c : Cover Γ) (f : All c λ Δ → Nf Δ A) → Nf Γ A
pasteNf hole f = f here
pasteNf (falseC t) f = falseE t
pasteNf (orC t c d) f = orE t (pasteNf c (f ∘ left)) (pasteNf d (f ∘ right))
-- Weakening covers: A case tree in Γ can be transported to a thinning Δ
-- by weakening all the scrutinees.
-- monC : ∀{Γ Δ} (τ : Δ ≤ Γ) (c : Cover Γ) → Cover Δ
monC : Mon Cover
monC τ hole = hole
monC τ (falseC t) = falseC (monNe τ t)
monC τ (orC t c d) = orC (monNe τ t) (monC (lift τ) c) (monC (lift τ) d)
-- Undoing a weakening on a path.
--
-- If we have a path e : Φ ∈ monC τ c in a case tree c : Cover Γ transported
-- to Δ via thinning τ : Δ ≤ Γ, we also get a path e' : Ψ ∈ c in the original
-- case tree c such that Ψ is a strenthening of Φ (Φ ≤ Ψ).
mon∈ : ∀{Γ Δ Φ} (c : Cover Γ) (τ : Δ ≤ Γ) (e : Φ ∈ monC τ c) → ∃ λ Ψ → Ψ ∈ c × Φ ≤ Ψ
mon∈ hole τ here = _ , here , τ
mon∈ (falseC t) τ ()
mon∈ (orC t c d) τ (left e) with mon∈ c (lift τ) e
... | Ψ , e' , σ = Ψ , left e' , σ
mon∈ (orC t c d) τ (right e) with mon∈ d (lift τ) e
... | Ψ , e' , σ = Ψ , right e' , σ
-- Packaging a case tree with its valuation.
CovExt : (Γ : Cxt) (P : Cxt → Set) → Set
CovExt Γ P = Σ (Cover Γ) λ c → All c P
transCE : ∀ {P Γ} (c : Cover Γ) (f : All c λ Δ → CovExt Δ P) → CovExt Γ P
transCE c f = transC c (proj₁ ∘ f) , λ e →
let _ , e₁ , e₂ = split∈ c (proj₁ ∘ f) e
in f e₁ .proj₂ e₂
monCE : ∀{P} → Mon P → Mon λ Γ → CovExt Γ P
monCE monP τ (c , f) = monC τ c , λ {Φ} e →
let Ψ , e' , σ = mon∈ c τ e
in monP σ (f {Ψ} e')
-- The syntactic Beth model.
-- We interpret base propositions Atom P by their normal deriviations.
-- ("Normal" is important; "neutral is not sufficient since we need case trees here.)
-- The negative connectives True, ∧, and ⇒ are explained as usual by η-expansion
-- and the meta-level connective.
-- The positive connectives False and ∨ are inhabited by case trees.
-- In case False, the tree has no leaves.
-- In case A ∨ B, each leaf must be in the semantics of either A or B.
T⟦_⟧ : (A : Form) (Γ : Cxt) → Set
T⟦ Atom P ⟧ Γ = Nf Γ (Atom P)
T⟦ True ⟧ Γ = ⊤
T⟦ False ⟧ Γ = CovExt Γ λ Δ → ⊥
T⟦ A ∨ B ⟧ Γ = CovExt Γ λ Δ → T⟦ A ⟧ Δ ⊎ T⟦ B ⟧ Δ
T⟦ A ∧ B ⟧ Γ = T⟦ A ⟧ Γ × T⟦ B ⟧ Γ
T⟦ A ⇒ B ⟧ Γ = ∀{Δ} (τ : Δ ≤ Γ) → T⟦ A ⟧ Δ → T⟦ B ⟧ Δ
-- Monotonicity of the model is proven by induction on the proposition,
-- using monotonicity of covers and the built-in monotonicity at implication.
-- monT : ∀ A {Γ Δ} (τ : Δ ≤ Γ) → T⟦ A ⟧ Γ → T⟦ A ⟧ Δ
monT : ∀ A → Mon T⟦ A ⟧
monT (Atom P) = monNf
monT True = _
monT False = monCE λ τ ()
monT (A ∨ B) = monCE λ τ → map-⊎ (monT A τ) (monT B τ)
monT (A ∧ B) τ (a , b) = monT A τ a , monT B τ b
monT (A ⇒ B) τ f σ = f (σ • τ)
-- Reflection / reification, proven simultaneously by induction on the proposition.
-- Reflection is η-expansion (and recursively reflection);
-- at positive connections we build a case tree with a single scrutinee: the neutral
-- we are reflecting.
-- At implication, we need reification, which produces introductions
-- and reifies the stored case trees.
mutual
reflect : ∀{Γ} A (t : Ne Γ A) → T⟦ A ⟧ Γ
reflect (Atom P) t = ne t
reflect True t = _
reflect False t = falseC t , λ()
reflect (A ∨ B) t = orC t hole hole , λ where
(left here) → inj₁ (reflect A (hyp top))
(right here) → inj₂ (reflect B (hyp top))
reflect (A ∧ B) t = reflect A (andE₁ t) , reflect B (andE₂ t)
reflect (A ⇒ B) t τ a = reflect B (impE (monNe τ t) (reify A a))
reify : ∀{Γ} A (⟦f⟧ : T⟦ A ⟧ Γ) → Nf Γ A
reify (Atom P) t = t
reify True _ = trueI
reify False (c , f) = pasteNf c (⊥-elim ∘ f)
reify (A ∨ B) (c , f) = pasteNf c ([ orI₁ ∘ reify A , orI₂ ∘ reify B ] ∘ f)
reify (A ∧ B) (a , b) = andI (reify A a) (reify B b)
reify (A ⇒ B) ⟦f⟧ = impI (reify B (⟦f⟧ (weak id≤) (reflect A (hyp top))))
-- Semantic paste.
-- This grafts semantic values f onto a case tree c : Cover Γ.
-- For atomic propositions, this is grafting of normal forms (defined before).
paste : ∀ A {Γ} (c : Cover Γ) (f : All c (T⟦ A ⟧)) → T⟦ A ⟧ Γ
paste (Atom P) = pasteNf
paste True = _
paste False = transCE
paste (A ∨ B) = transCE
paste (A ∧ B) c f = paste A c (proj₁ ∘ f) , paste B c (proj₂ ∘ f)
paste (A ⇒ B) c f τ a = paste B (monC τ c) λ {Δ} e →
let Ψ , e' , σ = mon∈ c τ e
in f e' σ (monT A (coverWk e) a)
-- Fundamental theorem
-- Extension of T⟦_⟧ to contexts
G⟦_⟧ : ∀ (Γ Δ : Cxt) → Set
G⟦ ε ⟧ Δ = ⊤
G⟦ Γ ∙ A ⟧ Δ = G⟦ Γ ⟧ Δ × T⟦ A ⟧ Δ
-- monG : ∀{Γ Δ Φ} (τ : Φ ≤ Δ) → G⟦ Γ ⟧ Δ → G⟦ Γ ⟧ Φ
monG : ∀{Γ} → Mon G⟦ Γ ⟧
monG {ε} τ _ = _
monG {Γ ∙ A} τ (γ , a) = monG τ γ , monT A τ a
-- Variable case.
fundH : ∀{Γ Δ A} (x : Hyp A Γ) (γ : G⟦ Γ ⟧ Δ) → T⟦ A ⟧ Δ
fundH top = proj₂
fundH (pop x) = fundH x ∘ proj₁
-- A lemma for the orE case.
orElim : ∀ {Γ A B E} → T⟦ A ∨ B ⟧ Γ →
(∀{Δ} (τ : Δ ≤ Γ) → T⟦ A ⟧ Δ → T⟦ E ⟧ Δ) →
(∀{Δ} (τ : Δ ≤ Γ) → T⟦ B ⟧ Δ → T⟦ E ⟧ Δ) →
T⟦ E ⟧ Γ
orElim (c , f) g h = paste _ c λ e → case f e of [ g (coverWk e) , h (coverWk e) ]
-- A lemma for the falseE case.
-- Casts an empty cover into any semantic value (by contradiction).
falseElim : ∀{Γ A} → T⟦ False ⟧ Γ → T⟦ A ⟧ Γ
falseElim (c , f) = paste _ c (⊥-elim ∘ f)
-- The fundamental theorem
fund : ∀{Γ A} (t : Γ ⊢ A) {Δ} (γ : G⟦ Γ ⟧ Δ) → T⟦ A ⟧ Δ
fund (hyp x) = fundH x
fund (impI t) γ τ a = fund t (monG τ γ , a)
fund (impE t u) γ = fund t γ id≤ (fund u γ)
fund (andI t u) γ = fund t γ , fund u γ
fund (andE₁ t) = proj₁ ∘ fund t
fund (andE₂ t) = proj₂ ∘ fund t
fund (orI₁ t) γ = hole , inj₁ ∘ λ{ here → fund t γ }
fund (orI₂ t) γ = hole , inj₂ ∘ λ{ here → fund t γ }
fund (orE t u v) γ = orElim (fund t γ)
(λ τ a → fund u (monG τ γ , a))
(λ τ b → fund v (monG τ γ , b))
fund (falseE t) γ = falseElim (fund t γ)
fund trueI γ = _
-- Identity environment
ide : ∀ Γ → G⟦ Γ ⟧ Γ
ide ε = _
ide (Γ ∙ A) = monG (weak id≤) (ide Γ) , reflect A (hyp top)
-- Normalization
norm : ∀{Γ A} (t : Γ ⊢ A) → Nf Γ A
norm t = reify _ (fund t (ide _))
-- Q.E.D. -}
|
programs/oeis/193/A193641.asm | karttu/loda | 1 | 9212 | <filename>programs/oeis/193/A193641.asm<gh_stars>1-10
; A193641: Number of arrays of -1..1 integers x(1..n) with every x(i) in a subsequence of length 1 or 2 with sum zero.
; 1,3,7,15,33,73,161,355,783,1727,3809,8401,18529,40867,90135,198799,438465,967065,2132929,4704323,10375711,22884351,50473025,111321761,245527873,541528771,1194379303,2634286479,5810101729,12814582761,28263452001,62337005731,137488594223,303240640447,668818286625,1475125167473,3253490975393,7175800237411,15826725642295,34906942259983,76989684757377,169806095157049,374519132574081,826027949905539,1821861994968127,4018243122510335,8862514194926209
cal $0,232059 ; Number of n X 2 0..2 arrays with every 0 next to a 1 and every 1 next to a 2 horizontally or vertically, with no adjacent values equal.
mov $1,$0
div $1,2
|
CSE312/HW1/src/BubbleSort.asm | abdcelik/GTU | 2 | 163211 | <reponame>abdcelik/GTU
.data
msg.size: .asciiz "Enter the size: "
msg.size_err: .asciiz "Error! Size must be positive integer.\n"
msg.item: .asciiz ". item: "
msg.comma: .asciiz ", "
msg.newline: .asciiz "\n"
.text
.globl main
main:
getPosInt:
la $a0, msg.size
addiu $v0, $zero, 4
syscall # print size message
addiu $v0, $zero, 5
syscall # read integer
slt $t0, $zero, $v0
bne $t0, $zero, getPostIntExit
la $a0, msg.size_err
addiu $v0, $zero, 4
syscall
j getPosInt
getPostIntExit:
addu $s0, $zero, $v0 # $s0 -> size
addu $a0, $zero, $s0
sll $a0, $a0, 2
addiu $v0, $zero, 9
syscall # allocate memory
addu $s1, $zero, $v0 # $s1 -> arr
addu $a0, $zero, $s1
addu $a1, $zero, $s0
jal getInt
addu $a0, $zero, $s1
addu $a1, $zero, $s0
jal BubbleSort
addu $a0, $zero, $s1
addu $a1, $zero, $s0
jal printArr
addiu $v0, $zero, 10
syscall # terminate execution
# $a0 -> address of dynamic array
# $a1 -> size of array
BubbleSort:
addi $sp, $sp, -28
sw $ra, 0($sp)
sw $s0, 4($sp)
sw $s1, 8($sp)
sw $s2, 12($sp)
sw $s3, 16($sp)
sw $s4, 20($sp)
sw $s5, 24($sp)
addu $s0, $zero, $a0 # $t0 = address of dynamic array
addu $s1, $zero, $a1 # $t1 = size of array
and $s2, $s2, $zero # i = 0
addiu $s3, $s1, -1 # size - 1
loop_i:
slt $t9, $s2, $s3
beq $t9, $zero, loop_i_exit
and $s4, $s4, $zero # j = 0
sub $s5, $s3, $s2 # size - 1 - i
loop_j:
slt $t9, $s4, $s5
beq $t9, $zero, loop_j_exit
sll $t0, $s4, 2
addu $t1, $t0, $s0
lw $t2, 0($t1) # arr[j]
lw $t3, 4($t1) # arr[j+1]
slt $t9, $t2, $t3
bne $t9, $zero, ifExit
addu $a0, $zero, $t1
jal swap
ifExit:
addiu $s4, $s4, 1
j loop_j
loop_j_exit:
addiu $s2, $s2, 1
j loop_i
loop_i_exit:
lw $ra, 0($sp)
lw $s0, 4($sp)
lw $s1, 8($sp)
lw $s2, 12($sp)
lw $s3, 16($sp)
lw $s4, 20($sp)
lw $s5, 24($sp)
addi $sp, $sp, 28
jr $ra
# $a0 -> address of sequence item
swap:
lw $t0, 0($a0)
lw $t1, 4($a0)
addu $t2, $zero, $t0
addu $t0 $zero, $t1
addu $t1, $zero, $t2
sw $t0, 0($a0)
sw $t1, 4($a0)
jr $ra
# $a0 -> address of dynamic array
# $a1 -> size of array
getInt:
addu $t0, $zero, $a0 # arr
addu $t1, $zero, $a1 # size
addiu $t2, $zero, 0 # i = 0
getIntLoop:
slt $t3, $t2, $t1
beq $t3, $zero, getIntReturn
addu $a0, $zero, $t2
addiu $a0, $a0, 1
addiu $v0, $zero, 1
syscall # print i+1
la $a0, msg.item
addiu $v0, $zero, 4
syscall # print ".item" message
addiu $v0, $zero, 5
syscall # get integet
sll $t3, $t2, 2
addu $t4, $t0, $t3
sw $v0, 0($t4) # place integer to postion
addiu $t2, $t2, 1
j getIntLoop
getIntReturn:
jr $ra
# $a0 -> address of dynamic array
# $a1 -> size of array
printArr:
addu $t0, $zero, $a0 # arr
addi $a1, $a1, -1
sll $t1, $a1, 2 # size * 4
addu $t1, $t1, $a0 # arr + size
printArrLoop:
slt $t2, $t1, $t0
bne $t2, $zero, printArrReturn
lw $a0, 0($t0)
addiu $v0, $zero, 1
syscall
beq $t0, $t1, printArrElse
la $a0, msg.comma
addiu $v0, $zero, 4
syscall
j printArrExit
printArrElse:
la $a0, msg.newline
addiu $v0, $zero, 4
syscall
j printArrExit
printArrExit:
addiu $t0, $t0, 4
j printArrLoop
printArrReturn:
jr $ra
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_ix/scalbln.asm | meesokim/z88dk | 0 | 15715 | <filename>libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_ix/scalbln.asm
SECTION code_fp_math48
PUBLIC _scalbln
EXTERN cm48_sdccix_scalbln
defc _scalbln = cm48_sdccix_scalbln
|
src/Relation/Ternary/Separation.agda | laMudri/linear.agda | 34 | 9031 | <filename>src/Relation/Ternary/Separation.agda
{-# OPTIONS --safe --without-K #-}
-- Proof relevant separation algebras
module Relation.Ternary.Separation where
open import Function
open import Level
open import Data.Unit using (tt; ⊤)
open import Data.Product hiding (map)
open import Data.List.Relation.Ternary.Interleaving.Propositional hiding (map)
open import Data.List.Relation.Binary.Equality.Propositional
open import Relation.Unary hiding (Empty)
open import Relation.Unary.PredicateTransformer using (Pt)
open import Relation.Binary hiding (_⇒_)
open import Relation.Binary.PropositionalEquality as P using (_≡_)
open import Algebra
open import Algebra.Structures using (IsMonoid)
open import Algebra.FunctionProperties.Core
∥_∥ : ∀ {ℓ a} {A : Set a} {P : Pred A ℓ} {Φ} → P Φ → A
∥_∥ {Φ = Φ} _ = Φ
Exactly : ∀ {a} {A : Set a} → A → Pred A a
Exactly x y = y ≡ x
module _ where
open import Data.List
Just : ∀ {a} {A : Set a} → A → Pred (List A) _
Just t = Exactly [ t ]
record RawSep {a} (Carrier : Set a) : Set (suc a) where
SPred : (ℓ : Level) → Set _
SPred ℓ = Pred Carrier ℓ
field
_⊎_≣_ : (Φ₁ Φ₂ : Carrier) → SPred a
-- we can see the three point relation as a predicate on the carrier
_⊎_ = _⊎_≣_
-- buy one, get a preorder for free
_≤_ : Rel Carrier _
Φ₁ ≤ Φ = ∃ λ Φ₂ → Φ₁ ⊎ Φ₂ ≣ Φ
-- remainder
rem : ∀ {x y} → x ≤ y → Carrier
rem (z , _) = z
-- separating conjunction
infixr 10 _×⟨_⟩_
record Conj {p q} (P : SPred p) (Q : ∀ {Φ} → P Φ → SPred q) Φ : Set (p ⊔ q ⊔ a) where
inductive
constructor _×⟨_⟩_
field
{Φₗ Φᵣ} : Carrier
px : P Φₗ
sep : Φₗ ⊎ Φᵣ ≣ Φ
qx : Q px Φᵣ
infixr 9 ∃[_]✴_
∃[_]✴_ = Conj
infixr 9 _✴_
_✴_ : ∀ {p q} → SPred p → SPred q → SPred (p ⊔ q ⊔ a)
P ✴ Q = ∃[ P ]✴ const Q
-- | Separating implication / magic is what you wand
infixr 8 _─✴[_]_
record _─✴[_]_ {b p q} {A : Set b} (P : Pred A p) (j : A → Carrier) (Q : SPred q) (Φᵢ : Carrier) : Set (p ⊔ q ⊔ a ⊔ b) where
constructor wand
field
app : ∀ {Φₚ} → P Φₚ → ∀ {Φ} → Φᵢ ⊎ j Φₚ ≣ Φ → Q Φ
open _─✴[_]_ public
infixr 8 _─✴_
_─✴_ : ∀ {p q} (P : SPred p) (Q : SPred q) → SPred (p ⊔ q ⊔ a)
_─✴_ = _─✴[ id ]_
_$⟨_⟩_ : ∀ {p q Φ₁ Φ₂ Φ} {P : SPred p} {Q : SPred q} →
(P ─✴ Q) Φ₁ → Φ₁ ⊎ Φ₂ ≣ Φ → P Φ₂ → Q Φ
f $⟨ σ ⟩ px = app f px σ
-- | The update modality
-- the naked version, which doesn't coop well with inference:
⤇' : ∀ {p} (P : SPred p) → SPred (a ⊔ p)
⤇' P Φᵢ = ∀ {Φⱼ Φₖ} → Φᵢ ⊎ Φⱼ ≣ Φₖ → ∃₂ λ Φₗ Φ → Φₗ ⊎ Φⱼ ≣ Φ × P Φₗ
-- Φᵢ is what we own, Φⱼ is an arbitrary frame.
-- We may update Φᵢ as long as we do not disturb the framing
-- wrapped
record ⤇ {p} (P : SPred p) Φᵢ : Set (a ⊔ p) where
constructor local
field
update : ⤇' P Φᵢ
open ⤇ public
infixr 8 _==✴_
_==✴_ : ∀ {p q} → (P : SPred p) (Q : SPred q) → SPred (p ⊔ q ⊔ a)
P ==✴ Q = P ─✴ (⤇ Q)
record IsSep {ℓ₁} {A} (s : RawSep {ℓ₁} A) : Set ℓ₁ where
open RawSep s
field
⊎-comm : ∀ {Φ₁ Φ₂} → ∀[ Φ₁ ⊎ Φ₂ ⇒ Φ₂ ⊎ Φ₁ ]
⊎-assoc : ∀ {a b ab c abc} → a ⊎ b ≣ ab → ab ⊎ c ≣ abc →
∃ λ bc → a ⊎ bc ≣ abc × b ⊎ c ≣ bc
⊎-unassoc : ∀ {b c bc a abc} → a ⊎ bc ≣ abc → b ⊎ c ≣ bc →
∃ λ ab → a ⊎ b ≣ ab × ab ⊎ c ≣ abc
⊎-unassoc σ₁ σ₂ =
let _ , σ₃ , σ₄ = ⊎-assoc (⊎-comm σ₂) (⊎-comm σ₁)
in -, ⊎-comm σ₄ , ⊎-comm σ₃
variable
Φ₁ Φ₂ Φ₃ Φ : A
module _ where
resplit : ∀ {a b c d ab cd abcd} →
a ⊎ b ≣ ab → c ⊎ d ≣ cd → ab ⊎ cd ≣ abcd →
∃₂ λ ac bd → a ⊎ c ≣ ac × b ⊎ d ≣ bd × ac ⊎ bd ≣ abcd
resplit σ₁ σ₂ σ with ⊎-assoc σ₁ σ
... | bcd , σ₃ , σ₄ with ⊎-unassoc σ₄ (⊎-comm σ₂)
... | bd , σ₅ , σ₆ with ⊎-unassoc σ₃ σ₆
... | abd , σ₇ , σ₈ with ⊎-unassoc (⊎-comm σ₈) σ₇
... | ac , τ , τ' = -, -, ⊎-comm τ , σ₅ , τ'
-- pairs commute
module _ {p q} {P : SPred p} {Q : SPred q} where
✴-swap : ∀[ (P ✴ Q) ⇒ (Q ✴ P) ]
✴-swap (px ×⟨ σ ⟩ qx) = qx ×⟨ ⊎-comm σ ⟩ px
-- pairs rotate and reassociate
module _ {p q r} {P : SPred p} {Q : SPred q} {R : SPred r} where
✴-assocₗ : ∀[ P ✴ (Q ✴ R) ⇒ (P ✴ Q) ✴ R ]
✴-assocₗ (p ×⟨ σ₁ ⟩ (q ×⟨ σ₂ ⟩ r)) =
let _ , σ₃ , σ₄ = ⊎-assoc (⊎-comm σ₂) (⊎-comm σ₁) in
(p ×⟨ ⊎-comm σ₄ ⟩ q) ×⟨ ⊎-comm σ₃ ⟩ r
✴-assocᵣ : ∀[ (P ✴ Q) ✴ R ⇒ P ✴ (Q ✴ R) ]
✴-assocᵣ ((p ×⟨ σ₁ ⟩ q) ×⟨ σ₂ ⟩ r) =
let _ , σ₃ , σ₄ = ⊎-assoc σ₁ σ₂ in
p ×⟨ σ₃ ⟩ q ×⟨ σ₄ ⟩ r
✴-rotateᵣ : ∀[ P ✴ (Q ✴ R) ⇒ R ✴ P ✴ Q ]
✴-rotateᵣ (p ×⟨ σ₁ ⟩ (q ×⟨ σ₂ ⟩ r)) =
let _ , σ₃ , σ₄ = ⊎-assoc (⊎-comm σ₂) (⊎-comm σ₁) in
r ×⟨ σ₃ ⟩ p ×⟨ ⊎-comm σ₄ ⟩ q
✴-rotateₗ : ∀[ P ✴ (Q ✴ R) ⇒ Q ✴ R ✴ P ]
✴-rotateₗ (p ×⟨ σ₁ ⟩ (q ×⟨ σ₂ ⟩ r)) =
let _ , σ₃ , σ₄ = ⊎-assoc σ₂ (⊎-comm σ₁) in
q ×⟨ σ₃ ⟩ r ×⟨ σ₄ ⟩ p
module _ {p q} {P : SPred p} {Q : SPred q} where
apply : ∀[ (P ─✴ Q) ✴ P ⇒ Q ]
apply (px ×⟨ sep ⟩ qx) = app px qx sep
-- mapping
module _ {p q p' q'}
{P : SPred p} {Q : SPred q} {P' : SPred p'} {Q' : SPred q'} where
⟨_⟨✴⟩_⟩ : ∀[ P ⇒ P' ] → ∀[ Q ⇒ Q' ] → ∀[ P ✴ Q ⇒ P' ✴ Q' ]
⟨_⟨✴⟩_⟩ f g (px ×⟨ sep ⟩ qx) = (f px) ×⟨ sep ⟩ (g qx)
both : ∀[ (P ─✴ P') ✴ (Q ─✴ Q') ⇒ P ✴ Q ─✴ P' ✴ Q' ]
app (both (f ×⟨ σ₁ ⟩ g)) (px ×⟨ σ₂ ⟩ qx) σ₃ with resplit σ₁ σ₂ σ₃
... | _ , _ , σ₄ , σ₅ , σ₆ = apply (f ×⟨ σ₄ ⟩ px) ×⟨ σ₆ ⟩ apply (g ×⟨ σ₅ ⟩ qx)
module _ {p q r} {P : SPred p} {Q : SPred q} {R : SPred r} where
✴-curry : ∀[ (P ─✴ (Q ─✴ R)) ⇒ (P ✴ Q) ─✴ R ]
app (✴-curry f) (p ×⟨ σ₁ ⟩ q) σ₂ =
let _ , σ₃ , σ₄ = ⊎-unassoc σ₂ σ₁ in app (app f p σ₃) q σ₄
intro : ∀[ (P ✴ Q) ⇒ R ] → ∀[ P ⇒ (Q ─✴ R) ]
app (intro f px) qx s = f (px ×⟨ s ⟩ qx)
com : ∀[ (P ─✴ Q) ✴ (Q ─✴ R) ⇒ (P ─✴ R) ]
app (com (f ×⟨ s ⟩ g)) px s' = let _ , eq₁ , eq₂ = ⊎-assoc (⊎-comm s) s' in app g (app f px eq₂) eq₁
✴-uncurry : ∀[ (P ✴ Q ─✴ R) ⇒ P ─✴ (Q ─✴ R) ]
app (app (✴-uncurry f) p σ₁) q σ₂ = let _ , σ₃ , σ₄ = ⊎-assoc σ₁ σ₂ in app f (p ×⟨ σ₄ ⟩ q) σ₃
module _ where
≤-trans : Φ₁ ≤ Φ₂ → Φ₂ ≤ Φ₃ → Φ₁ ≤ Φ₃
≤-trans (τ₁ , Φ₁⊎τ₁=Φ₂) (τ₂ , Φ₂⊎τ₂=Φ₃) =
let τ₃ , p , q = ⊎-assoc Φ₁⊎τ₁=Φ₂ Φ₂⊎τ₂=Φ₃ in τ₃ , p
module _ where
-- disjointness
_◆_ : _ → _ → SPred _
Φₗ ◆ Φᵣ = Exactly Φₗ ✴ Exactly Φᵣ
record IsUnitalSep {c} {C : Set c} (sep : RawSep C) un : Set (suc c) where
field
overlap {{ isSep }} : IsSep sep
open RawSep sep
ε = un
field
⊎-idˡ : ∀ {Φ} → ε ⊎ Φ ≣ Φ
⊎-id⁻ˡ : ∀ {Φ₁ Φ₂} → ε ⊎ Φ₁ ≣ Φ₂ → Φ₁ ≡ Φ₂
open IsSep isSep
⊎-idʳ : ∀ {Φ} → Φ ⊎ ε ≣ Φ
⊎-idʳ = ⊎-comm ⊎-idˡ
⊎-id⁻ʳ : ∀ {Φ} → ∀[ (Φ ⊎ ε) ⇒ (Φ ≡_) ]
⊎-id⁻ʳ = ⊎-id⁻ˡ ∘ ⊎-comm
infix 10 ε[_]
ε[_] : ∀ {ℓ} → Pred C ℓ → Set ℓ
ε[ P ] = P ε
{- Emptyness -}
module _ where
data Empty {p} (P : Set p) : SPred (c ⊔ p) where
emp : P → Empty P ε
pattern empty = emp tt
Emp : SPred c
Emp = Empty ⊤
module _ where
ε⊎ε : ∀[ ε ⊎ ε ⇒ Emp ]
ε⊎ε p with ⊎-id⁻ˡ p
... | (P.refl) = empty
✴-idʳ : ∀ {p} {P : SPred p} → ∀[ P ⇒ P ✴ Emp ]
✴-idʳ px = px ×⟨ ⊎-idʳ ⟩ empty
-- a resource-polymorphic function is a pure wand
wandit : ∀ {p q} {P : SPred p} {Q : SPred q} → ∀[ P ⇒ Q ] → ε[ P ─✴ Q ]
app (wandit f) p σ rewrite ⊎-id⁻ˡ σ = f p
_⟨✴⟩_ : ∀ {p q} {P : SPred p} {Q : SPred q} → ε[ P ─✴ Q ] → ∀[ P ⇒ Q ]
w ⟨✴⟩ p = app w p ⊎-idˡ
{- A free preorder -}
module _ where
≤-reflexive : Φ₁ ≡ Φ₂ → Φ₁ ≤ Φ₂
≤-reflexive P.refl = ε , ⊎-idʳ
≤-isPreorder : IsPreorder _≡_ _≤_
≤-isPreorder = record
{ isEquivalence = P.isEquivalence
; reflexive = ≤-reflexive
; trans = ≤-trans }
≤-preorder : Preorder _ _ _
≤-preorder = record { isPreorder = ≤-isPreorder }
ε-minimal : ∀ {Φ} → ε ≤ Φ
ε-minimal {Φ} = Φ , ⊎-idˡ
{- Framing where we forget the actual resource owned -}
module ↑-Frames where
infixl 1000 _↑
_↑ : ∀ {ℓ} → SPred ℓ → SPred _
P ↑ = P ✴ U
pattern _⇑_ p sep = p ×⟨ sep ⟩ tt
module _ {ℓ} {P : SPred ℓ} where
return : ∀[ P ⇒ P ↑ ]
return p = p ×⟨ ⊎-idʳ ⟩ tt
join : ∀[ (P ↑) ↑ ⇒ P ↑ ]
join ((p ×⟨ σ₁ ⟩ tt) ×⟨ σ₂ ⟩ tt) =
let _ , σ₃ = ≤-trans (-, σ₁) (-, σ₂) in p ×⟨ σ₃ ⟩ tt
module _ {ℓ₁ ℓ₂} {P : SPred ℓ₁} {Q : SPred ℓ₂} where
map : ∀[ P ⇒ Q ] → ∀[ P ↑ ⇒ Q ↑ ]
map f (px ⇑ sep) = f px ⇑ sep
module _ {ℓ₁ ℓ₂} {P : SPred ℓ₁} {Q : SPred ℓ₂} where
↑-bind : ∀[ P ⇒ Q ↑ ] → ∀[ P ↑ ⇒ Q ↑ ]
↑-bind f px = join (map f px)
{- Projections out of separating conjunction using framing -}
module _ where
π₁ : ∀ {p q} {P : SPred p} {Q : SPred q} → ∀[ (P ✴ Q) ⇒ P ↑ ]
π₁ (px ×⟨ sep ⟩ _) = px ⇑ sep
π₂ : ∀ {p q} {P : SPred p} {Q : SPred q} → ∀[ (P ✴ Q) ⇒ Q ↑ ]
π₂ (_ ×⟨ sep ⟩ qx) = qx ⇑ ⊎-comm sep
record IsConcattative {c} {C : Set c} (sep : RawSep C) : Set (suc c) where
open RawSep sep
field
overlap {{ isSep }} : IsSep sep
_∙_ : C → C → C
⊎-∙ₗ : ∀ {Φ₁ Φ₂ Φ Φₑ} → Φ₁ ⊎ Φ₂ ≣ Φ → (Φₑ ∙ Φ₁) ⊎ Φ₂ ≣ (Φₑ ∙ Φ)
open IsSep isSep
⊎-∙ᵣ : ∀ {Φ₁ Φ₂ Φ Φₑ} → Φ₁ ⊎ Φ₂ ≣ Φ → Φ₁ ⊎ (Φₑ ∙ Φ₂) ≣ (Φₑ ∙ Φ)
⊎-∙ᵣ s = ⊎-comm (⊎-∙ₗ (⊎-comm s))
record IsPositive {c} {C : Set c} (sep : RawSep C) : Set (suc c) where
open RawSep sep
field
{ε} : _
overlap {{ isUnitalSep }} : IsUnitalSep sep ε
overlap {{ isSep }} : IsSep sep
open IsUnitalSep isUnitalSep using (⊎-id⁻ˡ)
field
⊎-εˡ : ∀ {Φ₁ Φ₂} → Φ₁ ⊎ Φ₂ ≣ ε → Φ₁ ≡ ε
⊎-ε : ∀ {Φ₁ Φ₂} → Φ₁ ⊎ Φ₂ ≣ ε → Φ₁ ≡ ε × Φ₂ ≡ ε
⊎-ε σ with ⊎-εˡ σ
... | P.refl with ⊎-id⁻ˡ σ
... | P.refl = P.refl , P.refl
record Separation c : Set (suc c) where
field
Carrier : Set c
overlap {{ raw }} : RawSep Carrier
overlap {{ isSep }} : IsSep raw
record UnitalSep c : Set (suc c) where
field
Carrier : Set c
ε : _
overlap {{ sep }} : RawSep Carrier
overlap {{ isUnitalSep }} : IsUnitalSep sep ε
record MonoidalSep c : Set (suc c) where
field
Carrier : Set c
ε : _
overlap {{ sep }} : RawSep Carrier
overlap {{ isSep }} : IsSep sep
overlap {{ isUnitalSep }} : IsUnitalSep sep ε
overlap {{ isConcat }} : IsConcattative sep
open RawSep sep
open IsSep isSep
open IsConcattative isConcat
open IsUnitalSep isUnitalSep hiding (ε)
field
overlap {{ monoid }} : IsMonoid {A = Carrier} _≡_ _∙_ ε
open IsMonoid monoid
⊎-∙ : ∀ {Φₗ Φᵣ : Carrier} → Φₗ ⊎ Φᵣ ≣ (Φₗ ∙ Φᵣ)
⊎-∙ {Φₗ} {Φᵣ} =
P.subst (λ φ → φ ⊎ Φᵣ ≣ (Φₗ ∙ Φᵣ))
(identityʳ Φₗ)
(⊎-∙ₗ {Φₑ = Φₗ} (⊎-idˡ {Φᵣ}))
instance unital : UnitalSep _
unital = record { ε = ε }
module _ {c} {C : Set c} where
εOf : ∀ (r : RawSep C) {u} {{ _ : IsUnitalSep r u }} → C
εOf _ {{ un }}= IsUnitalSep.ε un
open RawSep ⦃...⦄ public
open IsConcattative ⦃...⦄ public
open IsUnitalSep ⦃...⦄ public
open IsPositive ⦃...⦄ hiding (ε) public
open UnitalSep ⦃...⦄ public hiding (Carrier; ε)
open IsSep ⦃...⦄ public
open MonoidalSep ⦃...⦄ public hiding (Carrier; ε)
|
specs/ada/common/tkmrpc-request-convert.ads | DrenfongWong/tkm-rpc | 0 | 5166 | <reponame>DrenfongWong/tkm-rpc
with Ada.Streams;
with Ada.Unchecked_Conversion;
package Tkmrpc.Request.Convert is
subtype Stream_Range is Ada.Streams.Stream_Element_Offset range
1 .. Request_Size;
subtype Stream_Type is Ada.Streams.Stream_Element_Array (Stream_Range);
function To_Stream is new Ada.Unchecked_Conversion (
Source => Data_Type,
Target => Stream_Type);
-- Convert given request data to stream array.
function From_Stream is new Ada.Unchecked_Conversion (
Source => Stream_Type,
Target => Data_Type);
-- Convert stream array to request data.
end Tkmrpc.Request.Convert;
|
test.asm | mattbernardini/virtual-machine | 0 | 92812 | READ X
READ Y
READ Z
LOAD X
ADD Y
ADD Z
STORE X
WRITE X
STOP
X 0
Y 0
Z 0 |
oeis/164/A164110.asm | neoneye/loda-programs | 11 | 175896 | <reponame>neoneye/loda-programs
; A164110: a(n) = 12*a(n-1) - 34*a(n-2) for n > 1; a(0) = 5, a(1) = 36.
; Submitted by <NAME>
; 5,36,262,1920,14132,104304,771160,5707584,42271568,313200960,2321178208,17205305856,127543611200,945542935296,7010032442752,51971929512960,385322051101952,2856819009782784,21180878379927040,157038694226509824,1164314465800598528,8632457985905848320,64002803993649829888,474530076402999115776,3518265581051895173120,26085164374920772141056,193400942743284829806592,1433915724172111704883200,10631356636793656245174272,78823145019672076976062464,584411614585080611376824320
mov $1,6
mov $3,5
lpb $0
sub $0,1
mov $2,$3
sub $2,$1
mul $2,2
mul $3,6
add $3,$1
mul $1,8
add $1,$2
lpe
mov $0,$3
|
libsrc/_DEVELOPMENT/math/float/math48/c/sccz80/cm48_sccz80p_ddiv.asm | jpoikela/z88dk | 640 | 164576 |
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sccz80p_ddiv
EXTERN cm48_sccz80p_dcallee1_0, am48_ddiv
cm48_sccz80p_ddiv:
; sccz80 float primitive
;
; enter : AC'(BCDEHL') = divisor = double x (math48)
; stack = dividend y (sccz80), ret
;
; exit : AC'(BCDEHL') = y/x
;
; uses : all except iy
call cm48_sccz80p_dcallee1_0
; AC = divisor (x)
; AC'= dividend (y)
jp am48_ddiv ; AC'= AC'/AC
|
TypeTheory/FibDataTypes/Types.agda | hbasold/Sandbox | 0 | 16201 | <reponame>hbasold/Sandbox
module Types where
import Level
open import Data.Unit as Unit renaming (tt to ∗)
open import Data.List as List
open import Data.Product
open import Categories.Category using (Category)
open import Function
open import Relation.Binary.PropositionalEquality as PE hiding ([_]; subst)
open import Relation.Binary using (module IsEquivalence; Setoid; module Setoid)
open ≡-Reasoning
open import Common.Context as Context
-- open import Categories.Object.BinaryCoproducts ctx-cat
-- Codes
mutual
data TermCtxCode : Set where
emptyC : TermCtxCode
cCtxC : (γ : TermCtxCode) → TypeCode γ → TermCtxCode
TyCtxCode : Set
data TypeCode (δ : TyCtxCode) (γ : TermCtxCode) : Set where
closeAppTyC : TypeCode δ γ
data TyFormerCode (γ : TermCtxCode) : Set where
univ : TyFormerCode γ
abs : (A : TypeCode γ) → (TyFormerCode (cCtxC γ A)) → TyFormerCode γ
TyCtxCode = Ctx (Σ TermCtxCode TyFormerCode)
TyVarCode : TyCtxCode → {γ : TermCtxCode} → TyFormerCode γ → Set
TyVarCode δ {γ} T = Var δ (γ , T)
emptyTy : TyCtxCode
emptyTy = []
{-
ctxTyFormer : (γ : TermCtxCode) → TyFormerCode γ → TyFormerCode emptyC
ctxTyFormer = ?
-}
data AppTypeCode (δ : TyCtxCode) (γ : TermCtxCode) : Set where
varC : (T : TyFormerCode γ) → (x : TyVarCode δ T) → AppTypeCode δ γ
appTyC : (T : TyFormerCode γ) → AppTypeCode δ γ T
μC : (γ₁ : TermCtxCode) → (t : TypeCode (ctxTyFormer γ univ ∷ δ) γ₁)
→ AppTypeCode δ γ
{- (T : TyFormerCode) → (A : TypeCode δ γ univ)
→ (B : TypeCode δ γ (cCtxC γ A T)) → (t : TermCode γ A)
→ Type Δ Γ (subst B t) -}
{-
-- Just one constructor/destructor for now
μ : (Γ Γ₁ : TermCtx) → (t : Type (ctxTyFormer Γ univ ∷ Δ) Γ₁ univ)
→ Type Δ Γ (ctxTyFormer Γ univ)
ν : (Γ Γ₁ : TermCtx) → (t : Type (ctxTyFormer Γ univ ∷ Δ) Γ₁ univ)
→ Type Δ Γ (ctxTyFormer Γ univ)
-}
{-
mutual
data TermCtx : Set where
empty : TermCtx
cCtx : (Γ : TermCtx) → TypeCode Γ → TermCtx
data TypeCode (Γ : TermCtx) : Set where
appTy : TypeCode Γ
Type : (Γ : TermCtx) → TypeCode Γ → Set
data Term : (Γ : TermCtx) → TypeCode Γ → Set where
data TyFormer (Γ : TermCtx) : Set where
univ : TyFormer Γ
abs : (A : TypeCode Γ) → (TyFormer (cCtx Γ A)) → TyFormer Γ
subst : {Γ : TermCtx} → {A : TypeCode Γ}
→ TyFormer (cCtx Γ A) → Term Γ A → TyFormer Γ
subst = {!!}
Type Γ appTy = Σ (TypeCode Γ) (λ A →
Σ (AppType emptyTy Γ (abs A univ)) (λ B →
Term Γ A))
ctxTyFormer : (Γ : TermCtx) → TyFormer Γ → TyFormer
ctxTyFormer empty T = T
ctxTyFormer (cCtx Γ A) T = ctxTyFormer Γ (abs Γ A)
TyCtx : Set
TyCtx = Ctx (Σ TermCtx TyFormer)
TyVar : TyCtx → {Γ : TermCtx} → TyFormer Γ → Set
TyVar Δ {Γ} T = Var Δ (Γ , T)
emptyTy : TyCtx
emptyTy = []
-- | Type syntax
data AppType (Δ : TyCtx) : (Γ : TermCtx) → TyFormer Γ → Set where
var : (Γ : TermCtx) → (T : TyFormer Γ) → (x : TyVar Δ T) → AppType Δ Γ T
appTy : (Γ : TermCtx) → (T : TyFormer) → (A : Type Δ Γ univ)
→ (B : Type Δ Γ (cCtx Γ A T)) → (t : Term Γ)
→ Type Δ Γ (subst B t)
-- Just one constructor/destructor for now
μ : (Γ Γ₁ : TermCtx) → (t : Type (ctxTyFormer Γ univ ∷ Δ) Γ₁ univ)
→ Type Δ Γ (ctxTyFormer Γ univ)
ν : (Γ Γ₁ : TermCtx) → (t : Type (ctxTyFormer Γ univ ∷ Δ) Γ₁ univ)
→ Type Δ Γ (ctxTyFormer Γ univ)
-}
{-
succ' : ∀{Δ} (x : TyVar Δ) → TyVar (∗ ∷ Δ)
succ' = Context.succ ∗
-}
{-
-- | Congruence for types
data _≅T_ {Γ Γ' : Ctx} : Type Γ → Type Γ' → Set where
unit : unit ≅T unit
var : ∀{x : TyVar Γ} {x' : TyVar Γ'} → (x ≅V x') → var x ≅T var x'
_⊕_ : ∀{t₁ t₂ : Type Γ} {t₁' t₂' : Type Γ'} →
(t₁ ≅T t₁') → (t₂ ≅T t₂') →
(t₁ ⊕ t₂) ≅T (t₁' ⊕ t₂')
_⊗_ : ∀{t₁ t₂ : Type Γ} {t₁' t₂' : Type Γ'} →
(t₁ ≅T t₁') → (t₂ ≅T t₂') →
(t₁ ⊗ t₂) ≅T (t₁' ⊗ t₂')
μ : ∀{t : Type (∗ ∷ Γ)} {t' : Type (∗ ∷ Γ')} →
(t ≅T t') →
(μ t) ≅T (μ t')
_⇒_ : ∀{t₁ t₁' : Type []} {t₂ : Type Γ} {t₂' : Type Γ'} →
(t₁ ≅T t₁') → (t₂ ≅T t₂') →
(t₁ ⇒ t₂) ≅T (t₁' ⇒ t₂')
ν : ∀{t : Type (∗ ∷ Γ)} {t' : Type (∗ ∷ Γ')} →
(t ≅T t') →
(ν t) ≅T (ν t')
Trefl : ∀ {Γ : Ctx} {t : Type Γ} → t ≅T t
Trefl {t = unit} = unit
Trefl {t = var x} = var e.refl
where
module s = Setoid
module e = IsEquivalence (s.isEquivalence ≅V-setoid)
Trefl {t = t₁ ⊕ t₂} = Trefl ⊕ Trefl
Trefl {t = μ t} = μ Trefl
Trefl {t = t ⊗ t₁} = Trefl ⊗ Trefl
Trefl {t = t ⇒ t₁} = Trefl ⇒ Trefl
Trefl {t = ν t} = ν Trefl
Tsym : ∀ {Γ Γ' : Ctx} {t : Type Γ} {t' : Type Γ'} → t ≅T t' → t' ≅T t
Tsym unit = unit
Tsym (var u) = var (Vsym u)
Tsym (u₁ ⊕ u₂) = Tsym u₁ ⊕ Tsym u₂
Tsym (u₁ ⊗ u₂) = Tsym u₁ ⊗ Tsym u₂
Tsym (μ u) = μ (Tsym u)
Tsym (u₁ ⇒ u₂) = Tsym u₁ ⇒ Tsym u₂
Tsym (ν u) = ν (Tsym u)
Ttrans : ∀ {Γ₁ Γ₂ Γ₃ : Ctx} {t₁ : Type Γ₁} {t₂ : Type Γ₂} {t₃ : Type Γ₃} →
t₁ ≅T t₂ → t₂ ≅T t₃ → t₁ ≅T t₃
Ttrans unit unit = unit
Ttrans (var u₁) (var u₂) = var (Vtrans u₁ u₂)
Ttrans (u₁ ⊕ u₂) (u₃ ⊕ u₄) = Ttrans u₁ u₃ ⊕ Ttrans u₂ u₄
Ttrans (u₁ ⊗ u₂) (u₃ ⊗ u₄) = Ttrans u₁ u₃ ⊗ Ttrans u₂ u₄
Ttrans (μ u₁) (μ u₂) = μ (Ttrans u₁ u₂)
Ttrans (u₁ ⇒ u₂) (u₃ ⇒ u₄) = Ttrans u₁ u₃ ⇒ Ttrans u₂ u₄
Ttrans (ν u₁) (ν u₂) = ν (Ttrans u₁ u₂)
≡→≅T : ∀ {Γ : Ctx} {t₁ t₂ : Type Γ} →
t₁ ≡ t₂ → t₁ ≅T t₂
≡→≅T {Γ} {t₁} {.t₁} refl = Trefl
-- Note: makes the equality homogeneous in Γ
≅T-setoid : ∀ {Γ} → Setoid _ _
≅T-setoid {Γ} = record
{ Carrier = Type Γ
; _≈_ = _≅T_
; isEquivalence = record
{ refl = Trefl ; sym = Tsym ; trans = Ttrans }
}
-- | Ground type
GType = Type []
unit′ : GType
unit′ = unit
-- | Variable renaming in types
rename : {Γ Δ : TyCtx} → (ρ : Γ ▹ Δ) → Type Γ → Type Δ
rename ρ unit = unit
rename ρ (var x) = var (ρ ∗ x)
rename ρ (t₁ ⊕ t₂) = rename ρ t₁ ⊕ rename ρ t₂
rename {Γ} {Δ} ρ (μ t) = μ (rename ρ' t)
where
ρ' : (∗ ∷ Γ) ▹ (∗ ∷ Δ)
ρ' = ctx-id {[ ∗ ]} ⧻ ρ
rename ρ (t₁ ⊗ t₂) = rename ρ t₁ ⊗ rename ρ t₂
rename ρ (t₁ ⇒ t₂) = t₁ ⇒ rename ρ t₂
rename {Γ} {Δ} ρ (ν t) = ν (rename ρ' t)
where
ρ' : (∗ ∷ Γ) ▹ (∗ ∷ Δ)
ρ' = ctx-id {[ ∗ ]} ⧻ ρ
-------------------------
---- Generating structure on contexts (derived from renaming)
weaken : {Γ : TyCtx} (Δ : TyCtx) → Type Γ -> Type (Δ ∐ Γ)
weaken {Γ} Δ = rename {Γ} {Δ ∐ Γ} (i₂ {Δ} {Γ})
exchange : (Γ Δ : TyCtx) → Type (Γ ∐ Δ) -> Type (Δ ∐ Γ)
exchange Γ Δ = rename [ i₂ {Δ} {Γ} , i₁ {Δ} {Γ} ]
contract : {Γ : TyCtx} → Type (Γ ∐ Γ) -> Type Γ
contract = rename [ ctx-id , ctx-id ]
-- weaken-id-empty-ctx : (Δ : TyCtx) (t : GType) → weaken {[]} Δ t ≡ t
-- weaken-id-empty-ctx = ?
Subst : TyCtx → TyCtx → Set
Subst Γ Δ = TyVar Γ → Type Δ
id-subst : ∀{Γ : TyCtx} → Subst Γ Γ
id-subst x = var x
update : ∀{Γ Δ : TyCtx} → Subst Γ Δ → Type Δ → (Subst (∗ ∷ Γ) Δ)
update σ a zero = a
update σ _ (succ′ _ x) = σ x
single-subst : ∀{Γ : TyCtx} → Type Γ → (Subst (∗ ∷ Γ) Γ)
single-subst a zero = a
single-subst _ (succ′ _ x) = var x
lift : ∀{Γ Δ} → Subst Γ Δ → Subst (∗ ∷ Γ) (∗ ∷ Δ)
lift σ = update (weaken [ ∗ ] ∘ σ) (var zero)
-- | Simultaneous substitution
subst : {Γ Δ : TyCtx} → (σ : Subst Γ Δ) → Type Γ → Type Δ
subst σ unit = unit
subst σ (var x) = σ x
subst σ (t₁ ⊕ t₂) = subst σ t₁ ⊕ subst σ t₂
subst {Γ} {Δ} σ (μ t) = μ (subst (lift σ) t)
subst σ (t₁ ⊗ t₂) = subst σ t₁ ⊗ subst σ t₂
subst σ (t₁ ⇒ t₂) = t₁ ⇒ subst σ t₂
subst {Γ} {Δ} σ (ν t) = ν (subst (lift σ) t)
subst₀ : {Γ : TyCtx} → Type Γ → Type (∗ ∷ Γ) → Type Γ
subst₀ {Γ} a = subst (update id-subst a)
rename′ : {Γ Δ : TyCtx} → (ρ : Γ ▹ Δ) → Type Γ → Type Δ
rename′ ρ = subst (var ∘ (ρ ∗))
-- | Unfold lfp
unfold-μ : (Type [ ∗ ]) → GType
unfold-μ a = subst₀ (μ a) a
-- | Unfold gfp
unfold-ν : (Type [ ∗ ]) → GType
unfold-ν a = subst₀ (ν a) a
--------------------------------------------------
---- Examples
Nat : Type []
Nat = μ (unit ⊕ x)
where x = var zero
Str-Fun : {Γ : TyCtx} → Type Γ → Type (∗ ∷ Γ)
Str-Fun a = (weaken [ ∗ ] a ⊗ x)
where x = var zero
Str : {Γ : TyCtx} → Type Γ → Type Γ
Str a = ν (Str-Fun a)
lemma : ∀ {Γ : Ctx} {a b : Type Γ} {σ : Subst Γ Γ} →
subst (update σ b) (weaken [ ∗ ] a) ≅T subst σ a
lemma {a = unit} = unit
lemma {a = var x} = Trefl
lemma {a = a₁ ⊕ a₂} = lemma {a = a₁} ⊕ lemma {a = a₂}
lemma {a = μ a} = μ {!!}
lemma {a = a₁ ⊗ a₂} = lemma {a = a₁} ⊗ lemma {a = a₂}
lemma {a = a₁ ⇒ a₂} = Trefl ⇒ lemma {a = a₂}
lemma {a = ν a} = ν {!!}
lift-id-is-id-ext : ∀ {Γ : Ctx} (x : TyVar (∗ ∷ Γ)) →
(lift (id-subst {Γ})) x ≡ id-subst x
lift-id-is-id-ext zero = refl
lift-id-is-id-ext (succ′ ∗ x) = refl
lift-id-is-id : ∀ {Γ : Ctx} → lift (id-subst {Γ}) ≡ id-subst
lift-id-is-id = η-≡ lift-id-is-id-ext
id-subst-id : ∀ {Γ : Ctx} {a : Type Γ} →
subst id-subst a ≅T a
id-subst-id {a = unit} = unit
id-subst-id {a = var x} = var Vrefl
id-subst-id {a = a ⊕ a₁} = id-subst-id ⊕ id-subst-id
id-subst-id {a = μ a} =
μ (Ttrans (≡→≅T (cong (λ u → subst u a) lift-id-is-id)) id-subst-id)
id-subst-id {a = a ⊗ a₁} = id-subst-id ⊗ id-subst-id
id-subst-id {a = a ⇒ a₁} = Trefl ⇒ id-subst-id
id-subst-id {a = ν a} =
ν (Ttrans (≡→≅T (cong (λ u → subst u a) lift-id-is-id)) id-subst-id)
lemma₂ : ∀ {Γ : Ctx} {a b : Type Γ} →
subst (update id-subst b) (weaken [ ∗ ] a) ≅T a
lemma₂ {Γ} {a} {b} = Ttrans (lemma {Γ} {a} {b} {σ = id-subst}) id-subst-id
unfold-str : ∀{a : Type []} → (unfold-ν (Str-Fun a)) ≅T (a ⊗ Str a)
unfold-str {a} = lemma₂ ⊗ Trefl
LFair : {Γ : TyCtx} → Type Γ → Type Γ → Type Γ
LFair a b = ν (μ ((w a ⊗ x) ⊕ (w b ⊗ y)))
where
x = var zero
y = var (succ zero)
Δ = ∗ ∷ [ ∗ ]
w = weaken Δ
-}
|
programs/oeis/087/A087404.asm | karttu/loda | 0 | 6823 | <gh_stars>0
; A087404: a(n) = 4a(n-1) + 5a(n-2).
; 2,4,26,124,626,3124,15626,78124,390626,1953124,9765626,48828124,244140626,1220703124,6103515626,30517578124,152587890626,762939453124,3814697265626,19073486328124,95367431640626,476837158203124
mov $2,$0
add $2,1
mov $3,$2
mod $3,2
mov $1,$3
mov $4,5
pow $4,$0
add $1,$4
div $1,2
sub $1,1
mul $1,2
add $1,2
|
alloy4fun_models/trashltl/models/5/FZ28CNLebygEuv5XR.als | Kaixi26/org.alloytools.alloy | 0 | 1933 | open main
pred idFZ28CNLebygEuv5XR_prop6 {
all f:File | f in Trash implies always f in Trash
}
pred __repair { idFZ28CNLebygEuv5XR_prop6 }
check __repair { idFZ28CNLebygEuv5XR_prop6 <=> prop6o } |
programs/oeis/070/A070595.asm | karttu/loda | 1 | 102987 | <reponame>karttu/loda
; A070595: n^5 mod 9.
; 0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1,5,0,7,2,0,4,8,0,1
mov $1,$0
pow $1,5
mod $1,9
|
language/alloy/exercises/tree.als | pogin503/vbautil | 0 | 3631 | module exercises/tree
sig Tree {
root: Node
right: Tree -> Tree
left: Tree -> Tree
}
pred isTree (r: unitv -> univ) {
/* hasNode, hasLeaf, left, right
木の性質とは
*/
}
run isTree for 4
|
Klient/klient_assets_package.adb | albinjal/Ada_Project | 4 | 27932 | with TJa.Sockets; use TJa.Sockets;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Yatzy_graphics_package; use Yatzy_graphics_package;
with TJa.Window.Text; use TJa.Window.Text;
with TJa.Window.Elementary; use TJa.Window.Elementary;
with TJa.Window.Graphic; use TJa.Window.Graphic;
with TJa.Keyboard; use TJa.Keyboard;
with Ada.Numerics.Discrete_Random;
package body Klient_Assets_Package is
procedure Bootup(Socket: out Socket_Type; Adress: in String; Port: in Positive) is
begin
Initiate(Socket);
Connect(Socket, Adress, Port);
Put("Ansluten till servern");
New_Line;
end Bootup;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure graphics is
begin
Clear_Window;
Set_Graphical_Mode(On);
background;
Start_screen(35, 12);
--vinst(25, 12);
Skip_Line;
background;
protocoll_background(125, 4);
logo_background(24, 4);
logo(24, 4);
end graphics;
function Generate
return Integer is
subtype Nums is Integer range 1..6;
package RN is
new Ada.Numerics.Discrete_Random(Nums);
Gen : RN.Generator;
begin
RN.Reset(Gen);
return RN.Random(Gen);
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Start_Game(Socket: in Socket_Type; Player: out Positive; Prot1, Prot2: out Protocoll_Type) is
TX : String(1..100);
TL : Natural;
begin -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
for I in 1..15 loop
Prot1(I) := -1;
-- if I = 1 then Prot1(1) := 2; end if; -- DEBUG, REMOVE
end loop;
Prot2 := Prot1;
Get_Line(Socket, TX, TL);
if TX(1) = '1' then
message(33, 18, "Du är spelare 1, väntar på spelare 2");
Player := 1;
Get_Line(Socket, TX, TL);
New_Line;
if TX(1) = '3' then
message(33, 18, "Båda spelare anslutna");
end if;
elsif TX(1) = '2' then
message(33, 18, "Du är spelare 2");
Player := 2;
else
raise DATATYPE_ERROR;
end if;
New_Line;
message(33, 18, "Nu startar spelet");
New_Line;
update_protocoll(125,4,Prot1, Prot2, 0, 0);
end Start_Game;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Read(C: in Character)
return Natural is
S: String(1..1);
begin
S(1) := C;
return Integer'Value(S);
end Read;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Get_Rolls(Socket: in Socket_Type; Roll: out Rolls_Type) is
TX: String(1..100);
TL: Natural;
begin
Get_Line(Socket, TX, TL);
-- New_Line;
if TX(1) = '4' then -- 4 betyder inkomande tärningar
Roll.I := Read(TX(2));
for X in 1..Roll.I loop -- A betyder här antalet tärningar
Roll.Rolls(X) := Read(TX(X+2));
end loop;
elsif TX(1) = '5' then -- 5 betyder info om gamestate
if TX(2) = '0' then -- Annan spelare slår
Roll.I := 6;
elsif TX(2) = '1' then -- Annan spelare har slagit
Roll.I := 7;
for X in 1..5 loop
Roll.Rolls(X) := Read(TX(X+2));
end loop;
elsif TX(2) = '2' then -- Annan spelare vill placera
Roll.I := 8;
for X in 1..5 loop
Roll.Rolls(X) := Read(TX(X+2));
end loop;
end if;
else
raise DATATYPE_ERROR;
end if;
end Get_Rolls;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function GetI(Roll: in Rolls_Type)
return Integer is
begin
return Roll.I;
end GetI;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function GetR(Roll: in Rolls_Type)
return Arr is
begin
return Roll.Rolls;
end GetR;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Playerroll(Socket: in Socket_Type) is
begin
Put_Line(Socket, "51");
end Playerroll;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Sort(Arrayen_Med_Talen: in out Arr) is
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Swap(Tal_1,Tal_2: in out Integer) is
Tal_B : Integer; -- Temporary buffer
begin
Tal_B := Tal_1;
Tal_1 := Tal_2;
Tal_2 := Tal_B;
end Swap;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Minsta_Talet, Minsta_Talet_Index : Integer;
begin
Minsta_Talet := 0;
for IOuter in Arrayen_Med_Talen'Range loop
for I in IOuter..Arrayen_Med_Talen'Last loop
if I = IOuter or Arrayen_Med_Talen(I) > Minsta_Talet then
Minsta_Talet := Arrayen_Med_Talen(I);
Minsta_Talet_Index := I;
end if;
end loop;
Swap(Arrayen_Med_Talen(IOuter), Arrayen_Med_Talen(Minsta_Talet_Index));
end loop;
end Sort;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- --
function Calcpoints(Prot: Protocoll_Type; Rolls: Arr) -- -- --
return Protocoll_Type is -- -- --
-- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Ental(I: Integer; Rolls: Arr) -- -- --
return Integer is -- -- --
-- -- --
C : Integer := 0; -- -- --
begin -- -- --
for X in 1..5 loop -- -- --
if Rolls(X) = I then -- -- --
C := C + I; -- -- --
end if; -- -- --
end loop; -- -- --
return C; -- -- --
end Ental; -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function FourPair(Rolls: Arr) -- -- --
return Integer is -- -- --
-- -- --
begin -- -- --
for I in 1..2 loop -- -- --
if Rolls(I) = Rolls(I+1) and Rolls(I) = Rolls(I+2) and Rolls(I) = Rolls(I+3) then -- -- --
return 4 * Rolls(I); -- -- --
end if; -- -- --
end loop; -- -- --
-- -- --
return 0; -- -- --
end FourPair; -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Pair(Rolls: Arr) -- -- --
return Integer is -- -- --
begin -- -- --
for I in 1..4 loop
if Rolls(I) = Rolls(I+1) then
return 2 * Rolls(I);
end if;
end loop;
return 0;
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function TwoPair(Rolls: Arr)
return Integer is
begin
if FourPair(Rolls) /= 0 then
return 0;
end if;
for I in 1..2 loop
if Rolls(I) = Rolls(I+1) then
for X in (I+2)..4 loop
if Rolls(X) = Rolls(X+1) then
return 2 * ( Rolls(I) + Rolls(X) );
end if;
end loop;
return 0;
end if;
end loop;
return 0;
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Triss(Rolls: Arr)
return Integer is
begin
for I in 1..3 loop
if Rolls(I) = Rolls(I+1) and Rolls(I) = Rolls(I+2) then
return 3 * Rolls(I);
end if;
end loop;
return 0;
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Stege(I: Integer; Rolls: Arr)
return Integer is
begin
case I is
when 11 =>
--Liten
for X in 1..5 loop
if Rolls(6-X) /= X then
return 0;
end if;
end loop;
return 15;
when 12 =>
--Stor
for X in 2..6 loop
if Rolls(7-X) /= X then
return 0;
end if;
end loop;
return 20;
when others =>
null;
return 0;
end case;
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Chans(Rolls: Arr)
return Integer is
X : Integer := 0;
begin
for I in 1..5 loop
X := X + Rolls(I);
end loop;
return X;
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Kaok(Rolls: Arr)
return Integer is
begin
for X in 1..2 loop
exit when Rolls(X) /= Rolls(X+1);
if X = 2 then
if Rolls(4) = Rolls(5) and Rolls(5) /= Rolls(1) then
return Chans(Rolls);
else
return 0;
end if;
end if;
end loop;
if Rolls(1) = Rolls(2) then
if Rolls(3) = Rolls(4) and Rolls(3) = Rolls(5) then
return Chans(Rolls);
end if;
end if;
return 0;
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Yatzy(Rolls: Arr)
return Integer is
begin
for X in 1..4 loop
if Rolls(X) /= Rolls(X+1) then
return 0;
end if;
end loop;
return 50;
end;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
TRolls: Arr := Rolls;
Result: Protocoll_Type;
begin
Sort(TRolls);
for I in 1..15 loop
if Prot(I) /= -1 then
Result(I) := -1;
-- New_Line; New_Line; Put("INDEX " & Integer'Image(I) & " WAS -1");
else
-- New_Line; New_Line; Put("INDEX " & Integer'Image(I) & " WAS NOT -1, IT WAS = " & Integer'Image(Prot(I)));
case I is
when 1..6 =>
Result(I) := Ental(I, TRolls);
when 7 =>
Result(I) := Pair(TRolls);
when 8 =>
Result(I) := TwoPair(TRolls);
when 9 =>
Result(I) := Triss(Trolls);
when 10 =>
Result(I) := FourPair(Trolls);
when 11 =>
Result(I) := Kaok(Trolls);
when 12..13 =>
Result(I) := Stege(I, Trolls);
when 14 =>
Result(I) := Chans(Trolls);
when 15 =>
Result(I) := Yatzy(Trolls);
when others =>
Result(I) := 0;
end case;
end if;
end loop;
return Result;
end Calcpoints;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
function Roll_loop(Socket: Socket_Type; Player: Positive; Own_Protocoll: in Protocoll_Type)
return Rolls_Type is
type Rerolls is array(1..5) of Integer;
Number_Of_Rerolls_Entered: Integer;
Reroll, t: Rerolls;
Result : Arr;
Roll: Rolls_Type;
Key : Key_Type;
temp_resp_int: Integer;
temp_num_of_other_player_rolls: Integer := 0;
--C0 : Character := 0;
--C1 : Character := 1;
begin -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Get_Rolls(Socket, Roll);
-- Slår Jag?
if GetI(Roll) > 5 then -- Jag slår inte - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
temp_num_of_other_player_rolls := temp_num_of_other_player_rolls + 1;
loop
if GetI(Roll) = 6 then
if temp_num_of_other_player_rolls > 1 then
message(33, 18, "Spelare " & Integer'Image(3-Player) & " slår igen");
else
message(33, 18, "Spelare " & Integer'Image(3-Player) & " slår");
end if;
elsif GetI(Roll) = 7 then
if temp_num_of_other_player_rolls > 1 then
message(33, 18, "Spelare " & Integer'Image(3-Player) & " har slagit igen:");
else
message(33, 18, "Spelare " & Integer'Image(3-Player) & " har slagit:");
end if;
Result := GetR(Roll);
dice_placement(Roll.Rolls(1), Roll.Rolls(2), Roll.Rolls(3), Roll.Rolls(4), Roll.Rolls(5));
end if;
Get_Rolls(Socket, Roll);
exit when Roll.I = 8;
end loop;
else -- Jag slår - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
for I in 1..5 loop
Reroll(I) := 0;
end loop;
message(33, 18, "Din tur");
for I in 1..3 loop -- Man kan slå max 3 gånger totalt per omgång
-- New_Line; Put("Händer det här? 1338"); -- DEBUG --
Result := GetR(Roll);
message(33, 18, "Tryck enter för att slå...");
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Set_Buffer_Mode(Off);
Set_Echo_Mode(Off);
loop -- Infinite loop waiting for return key
for X in 1..5 loop
t(X) := Generate;
end loop;
dice_placement(t(1), t(2),t(3), t(4), t(5));
Get_Immediate(Key);
if Is_Return(Key) then
exit;
end if;
end loop;
Set_Echo_Mode(On);
Set_Buffer_Mode(On);
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
message(33, 18, "Wow, du fick:");
dice_placement(Roll.Rolls(1), Roll.Rolls(2), Roll.Rolls(3), Roll.Rolls(4), Roll.Rolls(5));
-- Tell server that we have played
Put(Socket,"51"); New_Line(Socket);
-- New_Line; Put("Händer det här? 1340"); -- DEBUG --
-- If third time, exit loop and do not allow user to roll again
exit when I = 3;
message(33, 18, "Tryck 1 för att slå igen och 0 för att placera: ");
-- Calculate points and update protocoll
update_protocoll( 125 , 4 , Calcpoints(Own_Protocoll, GetR(Roll)) , Calcpoints(Own_Protocoll, GetR(Roll)), Player, 1);
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Set_Buffer_Mode(Off);
Set_Echo_Mode(Off);
loop -- Infinite loop waiting for either 1 or 0
-- New_Line; Put("Händer det här? 1339"); -- DEBUG --
Get_Immediate(Key);
if To_String(Key) = "0" then
temp_resp_int := 0;
exit;
elsif To_String(Key) = "1" then
temp_resp_int := 1;
exit;
end if;
end loop;
Set_Echo_Mode(On);
Set_Buffer_Mode(On);
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
if temp_resp_int = 0 then
exit; -- exit loop, move to placement
elsif temp_resp_int = 1 then
message(33, 18, "Välj vilka tärningar som ska slås om");
message2(33, 18, "tryck 1-5, godkänn med retur");
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Set_Buffer_Mode(Off);
Set_Echo_Mode(Off);
loop -- Infinite loop waiting for 1, 2, 3, 4 or 5. Enter exits the input
Get_Immediate(Key);
if To_String(Key) = "1" or To_String(Key) = "2" or To_String(Key) = "3" or To_String(Key) = "4" or To_String(Key) = "5" then
if Reroll( Integer'Value( To_String(Key) ) ) = 1 then
Reroll( Integer'Value( To_String(Key) ) ) := 0;
else
Reroll( Integer'Value( To_String(Key) ) ) := 1;
end if;
-- DEBUG New_Line; -- DEBUG
-- Put(Reroll(1), 2); Put("+"); Put(Reroll(2), 2); Put("+"); Put(Reroll(3), 2); Put("+"); Put(Reroll(4), 2); Put("+"); Put(Reroll(5), 2); Put("+"); -- DEBUG
update_reroll_arrow_graphics(Reroll(1), Reroll(2), Reroll(3), Reroll(4), Reroll(5));
elsif Is_Return(Key) then
-- Calculate number of inputs
Number_Of_Rerolls_Entered := 0;
if Reroll(1) = 1 then Number_Of_Rerolls_Entered := Number_Of_Rerolls_Entered + 1; end if;
if Reroll(2) = 1 then Number_Of_Rerolls_Entered := Number_Of_Rerolls_Entered + 1; end if;
if Reroll(3) = 1 then Number_Of_Rerolls_Entered := Number_Of_Rerolls_Entered + 1; end if;
if Reroll(4) = 1 then Number_Of_Rerolls_Entered := Number_Of_Rerolls_Entered + 1; end if;
if Reroll(5) = 1 then Number_Of_Rerolls_Entered := Number_Of_Rerolls_Entered + 1; end if;
if Number_Of_Rerolls_Entered > 0 then -- At least one dice needs to be selected
-- clear graphical arrows
update_reroll_arrow_graphics(0,0,0,0,0);
exit;
else -- no dice selected, show error message
message3(33, 0, "Du måste välja minst en tärning");
end if;
end if;
end loop;
Set_Echo_Mode(On);
Set_Buffer_Mode(On);
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
Put(Socket,'6'); Put(Socket,Number_Of_Rerolls_Entered,0);
for A in 1..5 loop
Put(Socket,Reroll(A),0);
end loop;
New_Line(Socket);
-- RESET VALUES
Reroll(1) := 0;
Reroll(2) := 0;
Reroll(3) := 0;
Reroll(4) := 0;
Reroll(5) := 0;
Get_Rolls(Socket, Roll);
end if;
end loop;
Put_Line(Socket, "7"); -- 7 = placement
end if;
return Roll;
end Roll_loop;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Watch_Placement(Socket: Socket_Type; Dices: Rolls_Type; Protocoll: in out Protocoll_Type; Player: in Positive) is
temp_place_points: String(1..100);
temp_place_points_l: Integer;
begin
-- message4(0, 0, "Välkommen, spelare " & Integer'Image(Player));
message(33, 18, "Spelare " & Integer'Image(3 - Player) & " ska placera");
Get_Line(Socket, temp_place_points, temp_place_points_l);
Protocoll( Integer'Value(temp_place_points(1..2)) ) := Integer'Value(temp_place_points(3..temp_place_points_l) );
-- Own_Protocoll.selected_index := Protocoll.selected_index;
--clear_protocoll( 125, 4, Player);
update_protocoll( 125 , 4 , Protocoll , Protocoll, 3 - Player, 0);
end Watch_Placement;
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
procedure Place(Socket: Socket_Type; Dices: Rolls_Type; Protocoll: in out Protocoll_Type; Player: in Positive) is
selected_index: Integer;
temp_place_points: String(1..100);
temp_place_points_l: Integer;
begin
message(33, 18, "Du ska placera");
--New_Line; New_Line; Put("-FFS " & Integer'Image(GetR(Dices)(1)) & "+" & Integer'Image(GetR(Dices)(2)) & "+" & Integer'Image(GetR(Dices)(3)) & "+" & Integer'Image(GetR(Dices)(4)) & "+" & Integer'Image(GetR(Dices)(5)) & " FFS-");
--New_Line; Put("1. " & Integer'Image( Calcpoints(Protocoll, GetR(Dices))(1) ));
place_graphics( Calcpoints(Protocoll, GetR(Dices) ), selected_index, Player);
Put_Line(Socket, Integer'Image(selected_index)); -- 7 = placement
Get_Line(Socket, temp_place_points, temp_place_points_l);
-- SERVER RESPONDS WITH VALUE AND INDEX
Protocoll(selected_index) := Integer'Value(temp_place_points(1..temp_place_points_l) );
-- Own_Protocoll.selected_index := Protocoll.selected_index;
clear_protocoll( 125, 4, Player);
update_protocoll( 125 , 4 , Protocoll , Protocoll, Player, 0);
end Place;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
function Calcfirstsum(Prot: in Protocoll_Type) return Integer is
sum: Integer := 0;
begin
for I in 1..6 loop
if Prot(I) > 0 AND Prot(I) < 999 then
sum := sum + Prot(I);
end if;
end loop;
return sum;
end;
function Calctotsum(Prot: in Protocoll_Type) return Integer is
sum: Integer := 0;
begin
for I in 1..15 loop
if Prot(I) > 0 AND Prot(I) < 999 then
sum := sum + Prot(I);
end if;
end loop;
sum := sum + Bonus(Prot);
return sum;
end;
function Bonus(Prot: in Protocoll_Type) return Integer is
begin
if Calcfirstsum(Prot) >= 50 then
return 50;
end if;
return 0;
end;
end Klient_Assets_Package;
|
tests/ships-test_data-tests-proto_ships_container.ads | thindil/steamsky | 80 | 4752 | package Ships.Test_Data.Tests.Proto_Ships_Container is
end Ships.Test_Data.Tests.Proto_Ships_Container;
|
programs/oeis/134/A134479.asm | neoneye/loda | 22 | 165671 | ; A134479: Row sums of triangle A134478.
; 1,3,9,18,30,45,63,84,108,135,165,198,234,273,315,360,408,459,513,570,630,693,759,828,900,975,1053,1134,1218,1305,1395,1488,1584,1683,1785,1890,1998,2109,2223,2340,2460,2583,2709,2838,2970,3105,3243,3384,3528,3675,3825,3978,4134,4293,4455,4620,4788,4959,5133,5310,5490,5673,5859,6048,6240,6435,6633,6834,7038,7245,7455,7668,7884,8103,8325,8550,8778,9009,9243,9480,9720,9963,10209,10458,10710,10965,11223,11484,11748,12015,12285,12558,12834,13113,13395,13680,13968,14259,14553,14850
add $0,1
bin $0,2
mul $0,3
trn $0,1
add $0,1
|
src/main_slave_itsybitsy.adb | hgrodriguez/spi_two_devices | 0 | 4466 | --===========================================================================
--
-- This is the main slave program for the ItsyBitsy for the
-- use cases:
-- 2: Master Pico -> Slave ItsyBitsy
-- 4: Master ItsyBitsy -> Slave ItsyBitsy
--
--===========================================================================
--
-- Copyright 2022 (C) <NAME>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with HAL;
with HAL.SPI;
with RP.Clock;
with RP.GPIO;
with RP.Device;
with ItsyBitsy;
with SPI_Slave_ItsyBitsy;
procedure Main_Slave_ItsyBitsy is
Data_In : HAL.SPI.SPI_Data_16b (1 .. 1) := (others => 0);
Status_In : HAL.SPI.SPI_Status;
THE_VALUE : constant HAL.UInt16 := HAL.UInt16 (16#A5A5#);
Data_Out : HAL.SPI.SPI_Data_16b (1 .. 1) := (others => THE_VALUE);
Status_Out : HAL.SPI.SPI_Status;
use HAL;
begin
RP.Clock.Initialize (ItsyBitsy.XOSC_Frequency);
RP.Clock.Enable (RP.Clock.PERI);
RP.Device.Timer.Enable;
ItsyBitsy.LED.Configure (RP.GPIO.Output);
SPI_Slave_ItsyBitsy.Initialize;
loop
-- do this to get the slave ready
SPI_Slave_ItsyBitsy.SPI.Transmit (Data_Out, Status_Out);
for I in 1 .. 1 loop
SPI_Slave_ItsyBitsy.SPI.Receive (Data_In, Status_In, 0);
Data_Out (1) := not Data_In (1); -- THE_VALUE
SPI_Slave_ItsyBitsy.SPI.Transmit (Data_Out, Status_Out);
end loop;
RP.Device.Timer.Delay_Milliseconds (10);
ItsyBitsy.LED.Toggle;
end loop;
end Main_Slave_ItsyBitsy;
|
programs/oeis/046/A046818.asm | neoneye/loda | 22 | 2990 | ; A046818: Number of 1's in binary expansion of 3n+1.
; 1,1,3,2,3,1,3,3,3,3,5,2,3,2,4,4,3,3,5,4,5,1,3,3,3,3,5,3,4,3,5,5,3,3,5,4,5,3,5,5,5,5,7,2,3,2,4,4,3,3,5,4,5,2,4,4,4,4,6,4,5,4,6,6,3,3,5,4,5,3,5,5,5,5,7,4,5,4,6,6,5,5,7,6,7,1,3,3,3,3,5,3,4,3,5,5,3,3,5,4
mul $0,3
add $0,1
seq $0,120 ; 1's-counting sequence: number of 1's in binary expansion of n (or the binary weight of n).
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_176.asm | ljhsiun2/medusa | 9 | 247769 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_176.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x11d08, %r12
nop
nop
nop
nop
and %r9, %r9
mov $0x6162636465666768, %rax
movq %rax, (%r12)
nop
cmp $65183, %r15
lea addresses_UC_ht+0xc0c8, %r8
nop
and %rdi, %rdi
movb (%r8), %r15b
nop
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WC_ht+0x2544, %r15
nop
nop
and $13468, %rdx
mov (%r15), %r8w
nop
nop
nop
nop
dec %rdx
lea addresses_WC_ht+0x20c8, %rsi
lea addresses_normal_ht+0x7f48, %rdi
nop
nop
nop
cmp %r8, %r8
mov $91, %rcx
rep movsb
nop
nop
nop
nop
nop
inc %r15
lea addresses_A_ht+0x6548, %r15
nop
nop
nop
nop
sub $60318, %rcx
mov (%r15), %rdi
nop
xor %rdx, %rdx
lea addresses_normal_ht+0xb6a, %rsi
lea addresses_UC_ht+0x448, %rdi
nop
nop
nop
sub $49261, %r15
mov $45, %rcx
rep movsw
nop
nop
nop
nop
nop
xor %r8, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %rax
push %rbx
push %rsi
// Load
lea addresses_D+0xc8c8, %rax
nop
nop
nop
nop
sub %r11, %r11
mov (%rax), %r8d
nop
dec %r14
// Load
lea addresses_D+0x21c8, %rsi
nop
nop
nop
nop
nop
and %rbx, %rbx
mov (%rsi), %r14d
nop
nop
nop
nop
nop
sub %rax, %rax
// Store
lea addresses_UC+0x78c8, %rax
nop
nop
nop
xor $42465, %r14
movb $0x51, (%rax)
nop
nop
nop
nop
sub $14501, %r8
// Faulty Load
lea addresses_RW+0x1f4c8, %r15
nop
nop
nop
nop
xor %rax, %rax
movups (%r15), %xmm2
vpextrq $0, %xmm2, %r11
lea oracles, %rbx
and $0xff, %r11
shlq $12, %r11
mov (%rbx,%r11,1), %r11
pop %rsi
pop %rbx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
fasm/simple.asm | Kharacternyk/ceto19 | 0 | 242599 | <reponame>Kharacternyk/ceto19
; Fill `cubes` array.
cubes=buffer
zer rdi
@@: inc rdi
mov rbx, rdi
imul rbx, rdi; ^2
imul rbx, rdi; ^3
mov [cubes+rdi*8], rbx
cmp rbx, rax
jb @b
; Store the highest index.
mov rcx, rdi
; Counter.
zer r9
; Check every combination, x>=y>=z.
mov r15, rax
mov r12, 1 ; x
xLoop:
mov r13, 1 ; y
yLoop:
mov r14, 1 ; z
zLoop:
mov rbx, [cubes+r12*8]
add rbx, [cubes+r13*8]
add rbx, [cubes+r14*8]
cmp rbx, r15
jne @f
push LF
push r12
push TAB
push r13
push TAB
push r14
inc r9
@@: inc r14
cmp r14, r13
jna zLoop
inc r13
cmp r13, r12
jna yLoop
inc r12
cmp r12, rcx
jna xLoop
; Push a counter.
push LF
push r9
|
c2000/C2000Ware_1_00_06_00/libraries/dsp/VCU/c28/examples/fft/2837x_vcu0_cfft_64/cfft_64_data.asm | ramok/Themis_ForHPSDR | 0 | 27405 | ;******************************************************************************
;******************************************************************************
;
; FILE: cfft_64_data.asm
;
; DESCRIPTION: Input test data for the FFT
;
;******************************************************************************
; $TI Release: C28x VCU Library V2.10.00.00 $
; $Release Date: Oct 18, 2018 $
; $Copyright: Copyright (C) 2018 Texas Instruments Incorporated -
; http://www.ti.com/ ALL RIGHTS RESERVED $
;******************************************************************************
; This software is licensed for use with Texas Instruments C28x
; family DSCs. This license was provided to you prior to installing
; the software. You may review this license by consulting a copy of
; the agreement in the doc directory of this library.
; ------------------------------------------------------------------------
;******************************************************************************
;.cdecls C,LIST,"fft.h"
;############################################################################
;
;/*! \page CFFT_64_DATA (Input test data to the FFT)
;
; The input test data is a two tone function. We run the fft on this
; data and compare to the expected output.
;*/
;############################################################################
.sect .econst
.align 128
.global _CFFT16_64p_in_data,_CFFT16_64p_out_data
; FFT input data, two-tone test
_CFFT16_64p_in_data:
.word 0, 2232, 0, 1930, 0, 1165, 0, 286
.word 0, -347, 0, -560, 0, -445, 0, -286
.word 0, -373, 0, -809, 0, -1440, 0, -1930
.word 0, -1957, 0, -1406, 0, -445, 0, 560
.word 0, 1237, 0, 1406, 0, 1165, 0, 809
.word 0, 648, 0, 809, 0, 1165, 0, 1406
.word 0, 1237, 0, 560, 0, -445, 0, -1406
.word 0, -1957, 0, -1930, 0, -1440, 0, -809
.word 0, -373, 0, -286, 0, -445, 0, -560
.word 0, -347, 0, 286, 0, 1165, 0, 1930
.word 0, 2232, 0, 1930, 0, 1165, 0, 286
.word 0, -347, 0, -560, 0, -445, 0, -286
.word 0, -373, 0, -809, 0, -1440, 0, -1930
.word 0, -1957, 0, -1406, 0, -445, 0, 560
.word 0, 1237, 0, 1406, 0, 1165, 0, 809
.word 0, 648, 0, 809, 0, 1165, 0, 1406
; FFT output data
_CFFT16_64p_out_data:
.word 0, 75, 17, 83, 51, 119, 383, 569
.word -109, -113, -53, -40, -37, -20, -28, -11
.word -23, 390, -19, -3, -17, -1, -15, 1
.word -13, 2, -11, 2, -10, 4, -9, 4
.word -8, 5, -7, 5, -7, 5, -6, 6
.word -5, 5, -5, 5, -5, 6, -4, 6
.word -4, 6, -3, 6, -3, 6, -2, 6
.word -1, 6, -2, 7, -1, 6, 0, 5
.word 0, 7, 0, 5, 1, 6, 2, 7
.word 1, 6, 2, 6, 3, 6, 3, 6
.word 4, 6, 4, 6, 5, 6, 5, 5
.word 5, 5, 6, 6, 7, 5, 7, 5
.word 8, 5, 9, 4, 10, 4, 11, 2
.word 13, 2, 15, 1, 17, -1, 19, -3
.word 23, 390, 28, -11, 37, -20, 53, -40
.word 109, -113, -383, 569, -51, 119, -17, 83
|
test/Succeed/Issue4970.agda | shlevy/agda | 0 | 1422 |
open import Agda.Builtin.Sigma renaming (fst to proj₁; snd to proj₂)
open import Agda.Builtin.Nat renaming (Nat to ℕ)
NEX : Set₁
NEX = Σ Set λ A → (ℕ → A)
variable
A : NEX
B : A .proj₁ → NEX
[Σ] : (A : NEX) → (B : A .proj₁ → NEX) → NEX
[Σ] A B .proj₁ = Σ (A .proj₁) λ x → B x .proj₁
[Σ] A B .proj₂ n = A .proj₂ n , B _ .proj₂ n
_[→]_ : (A B : NEX) → NEX
(A [→] B) .proj₁ = A .proj₁ → B .proj₁
(A [→] B) .proj₂ n x = B .proj₂ n
-- B.A is underdetermined and solved with (A .proj₁ , _snd) for a fresh meta
-- _snd : ℕ → A .proj₁, which is then generalized over. The bug was that _snd
-- turned into an explicit rather than implicit argument.
[π₁] : ([Σ] A B [→] A) .proj₁
[π₁] {A = A} {B = B} {snd = snd} x = x .proj₁
|
src/renderer.ads | Kidev/DemoAdaPhysics2D | 5 | 29231 | with Entities; use Entities;
with Worlds; use Worlds;
with Vectors2D; use Vectors2D;
with HAL.Bitmap; use HAL.Bitmap;
with Materials; use Materials;
with DemoLogic; use DemoLogic;
with Links; use Links;
package Renderer is
-- Displays the entities passed
procedure Render(W : in out World; Cue : VisualCue);
procedure RenderList(L : EntsListAcc; Selected : EntityClassAcc := null);
procedure RenderCue(Cue : VisualCue);
procedure RenderLinksList(L : LinksListAcc);
-- Failsafe translation to int Coords
function GetIntCoords(flCoords : Vec2D) return Point
with Post => GetIntCoords'Result.X <= 240 and GetIntCoords'Result.Y <= 320;
function GetBezierPoint(Link : LinkAcc; i : Natural; n : Positive; UseMul : Float := 0.0) return Point;
-- Gets the color appropriate for the material
function GetColor(Mat : in Material) return Bitmap_Color;
-- Gets the color for the link
function GetLinkColor(L : LinkAcc) return Bitmap_Color;
function GetCenteredPos(E : EntityClassAcc) return Point;
-- Tells if an entity is invalid
function InvalidEnt(E : EntityClassAcc) return Boolean;
procedure DrawRope(Link : LinkAcc);
procedure DrawSpring(Link : LinkAcc);
end Renderer;
|
test/Succeed/ForallForParameters.agda | redfish64/autonomic-agda | 3 | 12393 | module ForallForParameters
(F : Set -> Set -> Set) X {Y} (Z : F X Y) where
data List A : Set where
[] : List A
_::_ : A -> List A -> List A
module M A {B} (C : F A B) where
data D : Set -> Set where
d : A -> D A
data P A : D A -> Set where
data Q {A} X : P A X -> Set where
module N I J K = M I {J} K
open module O I J K = N I J K
record R {I J} (K : F I J) : Set where
|
libsrc/_DEVELOPMENT/l/z80/l_compare_de_hl.asm | meesokim/z88dk | 0 | 26708 |
SECTION code_l
PUBLIC l_compare_de_hl
EXTERN l_jpix
l_compare_de_hl:
; enter : ix = compare function
; de = left operand
; hl = right operand
;
; exit : *de >= *hl if p flag set
; *de << *hl if m flag set
; *de == *hl if z flag set and a==0
; carry reset
;
; uses : af
push hl
push bc
push de
push ix
;******************************
IF __SDCC | __SDCC_IX | __SDCC_IY
;******************************
push hl
push de
call l_jpix ; compare(de, hl)
ld a,h
or a
ld a,l
pop de
pop hl
;******************************
ELSE
;******************************
push de
push hl
call l_jpix ; compare(de, hl)
ld a,h
or a
ld a,l
pop hl
pop de
;******************************
ENDIF
;******************************
pop ix
pop de
pop bc
pop hl
ret
|
src/coreclr/src/vm/amd64/UMThunkStub.asm | AlFasGD/runtime | 2 | 243093 | <reponame>AlFasGD/runtime
; Licensed to the .NET Foundation under one or more agreements.
; The .NET Foundation licenses this file to you under the MIT license.
; See the LICENSE file in the project root for more information.
; ==++==
;
;
; ==--==
include <AsmMacros.inc>
include AsmConstants.inc
extern TheUMEntryPrestubWorker:proc
extern UMEntryPrestubUnwindFrameChainHandler:proc
;
; METHODDESC_REGISTER: UMEntryThunk*
;
NESTED_ENTRY TheUMEntryPrestub, _TEXT, UMEntryPrestubUnwindFrameChainHandler
TheUMEntryPrestub_STACK_FRAME_SIZE = SIZEOF_MAX_OUTGOING_ARGUMENT_HOMES
; XMM save area
TheUMEntryPrestub_XMM_SAVE_OFFSET = TheUMEntryPrestub_STACK_FRAME_SIZE
TheUMEntryPrestub_STACK_FRAME_SIZE = TheUMEntryPrestub_STACK_FRAME_SIZE + SIZEOF_MAX_FP_ARG_SPILL
; Ensure that the new rsp will be 16-byte aligned. Note that the caller has
; already pushed the return address.
if ((TheUMEntryPrestub_STACK_FRAME_SIZE + 8) MOD 16) ne 0
TheUMEntryPrestub_STACK_FRAME_SIZE = TheUMEntryPrestub_STACK_FRAME_SIZE + 8
endif
alloc_stack TheUMEntryPrestub_STACK_FRAME_SIZE
save_reg_postrsp rcx, TheUMEntryPrestub_STACK_FRAME_SIZE + 8h
save_reg_postrsp rdx, TheUMEntryPrestub_STACK_FRAME_SIZE + 10h
save_reg_postrsp r8, TheUMEntryPrestub_STACK_FRAME_SIZE + 18h
save_reg_postrsp r9, TheUMEntryPrestub_STACK_FRAME_SIZE + 20h
save_xmm128_postrsp xmm0, TheUMEntryPrestub_XMM_SAVE_OFFSET
save_xmm128_postrsp xmm1, TheUMEntryPrestub_XMM_SAVE_OFFSET + 10h
save_xmm128_postrsp xmm2, TheUMEntryPrestub_XMM_SAVE_OFFSET + 20h
save_xmm128_postrsp xmm3, TheUMEntryPrestub_XMM_SAVE_OFFSET + 30h
END_PROLOGUE
;
; Do prestub-specific stuff
;
mov rcx, METHODDESC_REGISTER
call TheUMEntryPrestubWorker
;
; we're going to tail call to the exec stub that we just setup
;
mov rcx, [rsp + TheUMEntryPrestub_STACK_FRAME_SIZE + 8h]
mov rdx, [rsp + TheUMEntryPrestub_STACK_FRAME_SIZE + 10h]
mov r8, [rsp + TheUMEntryPrestub_STACK_FRAME_SIZE + 18h]
mov r9, [rsp + TheUMEntryPrestub_STACK_FRAME_SIZE + 20h]
movdqa xmm0, xmmword ptr [rsp + TheUMEntryPrestub_XMM_SAVE_OFFSET]
movdqa xmm1, xmmword ptr [rsp + TheUMEntryPrestub_XMM_SAVE_OFFSET + 10h]
movdqa xmm2, xmmword ptr [rsp + TheUMEntryPrestub_XMM_SAVE_OFFSET + 20h]
movdqa xmm3, xmmword ptr [rsp + TheUMEntryPrestub_XMM_SAVE_OFFSET + 30h]
;
; epilogue
;
add rsp, TheUMEntryPrestub_STACK_FRAME_SIZE
TAILJMP_RAX
NESTED_END TheUMEntryPrestub, _TEXT
end
|
src/intel/tools/tests/gen6/sel.asm | SoftReaper/Mesa-Renoir-deb | 0 | 26984 | (+f0.0) sel(8) g40<1>UD g5<4>UD g6<4>UD { align16 1Q };
(-f0.0) sel(8) g6<1>UD g13<8,8,1>UD 0x00000000UD { align1 1Q };
(-f0.0) sel(16) g7<1>UD g9<8,8,1>UD 0x00000000UD { align1 1H };
(+f0.0) sel(8) g2<1>UD g31<8,8,1>UD g34<8,8,1>UD { align1 1Q };
(+f0.0) sel(8) m1<1>UD g67<8,8,1>UD 0x3f800000UD { align1 1Q };
(+f0.0) sel(16) g2<1>UD g35<8,8,1>UD g41<8,8,1>UD { align1 1H };
(+f0.0) sel(16) m1<1>UD g31<8,8,1>UD 0x3f800000UD { align1 1H };
(+f0.0.all4h) sel(8) g45<1>UD g23<4>UD g24<4>UD { align16 1Q };
sel.ge(8) g64<1>F g5<8,8,1>F 0x0F /* 0F */ { align1 1Q };
sel.ge(16) g17<1>F g3<8,8,1>F 0x0F /* 0F */ { align1 1H };
sel.ge(8) g3<1>.yF g7<4>.xF 0x0F /* 0F */ { align16 1Q };
sel.l(8) g11<1>.xF g7<4>.wF 0x43000000F /* 128F */ { align16 1Q };
(-f0.0.z) sel(8) g3<1>.zUD g17<4>.xUD 0x00000000UD { align16 1Q };
(+f0.0.x) sel(8) g32<1>.xUD g12<4>.yUD 0x41a80000UD { align16 1Q };
(-f0.0.x) sel(8) g33<1>.xUD g32<4>.xUD 0x41b80000UD { align16 1Q };
(+f0.0) sel(8) m1<1>UD g9<8,8,1>UD g12<8,8,1>UD { align1 1Q };
(+f0.0) sel(16) m1<1>UD g15<8,8,1>UD g21<8,8,1>UD { align1 1H };
sel.ge(8) g20<1>F g19<8,8,1>F g16<8,8,1>F { align1 1Q };
sel.ge(16) g12<1>F g10<8,8,1>F g8<8,8,1>F { align1 1H };
sel.sat.l(8) m4<1>F g2<4>F 0x3f000000F /* 0.5F */ { align16 1Q };
(+f0.0.x) sel(8) g46<1>.xUD g72<4>.yUD g72<4>.xUD { align16 1Q };
sel.l(8) g13<1>.xF g1<0>.wF g1<0>.zF { align16 1Q };
sel.ge(8) g13<1>.xF g1<0>.wF g1<0>.zF { align16 1Q };
(+f0.0.any4h) sel(8) g15<1>UD g14<4>UD g4<4>UD { align16 1Q };
(-f0.0.any4h) sel(8) g67<1>.xUD g63<4>.xUD 0x00000000UD { align16 1Q };
(-f0.0) sel(8) m1<1>UD g13<8,8,1>UD 0x3f800000UD { align1 1Q };
(-f0.0) sel(16) m1<1>UD g22<8,8,1>UD 0x3f800000UD { align1 1H };
sel.l(8) g10<1>F g2.3<0,1,0>F g2.2<0,1,0>F { align1 1Q };
sel.l(16) g15<1>F g2.3<0,1,0>F g2.2<0,1,0>F { align1 1H };
sel.ge(8) g18<1>.zD g18<4>.zD 1D { align16 1Q };
(+f0.0) sel(8) g8<1>UD g4<8,8,1>UD 0x00000000UD { align1 1Q };
(+f0.0) sel(16) g11<1>UD g5<8,8,1>UD 0x00000000UD { align1 1H };
sel.ge(8) g4<1>D g3<0,1,0>D -252D { align1 1Q };
sel.l(8) g5<1>D g4<8,8,1>D 254D { align1 1Q };
sel.ge(16) g4<1>D g3<0,1,0>D -252D { align1 1H };
sel.l(16) g6<1>D g4<8,8,1>D 254D { align1 1H };
sel.sat.l(8) m4<1>F g1<0>F g3<4>F { align16 1Q };
sel.l(8) g6<1>F g3<8,8,1>F 0x40400000F /* 3F */ { align1 1Q };
sel.l(16) g20<1>F g14<8,8,1>F 0x40400000F /* 3F */ { align1 1H };
(+f0.0) sel(8) g8<1>F (abs)g40<8,8,1>F g6<8,8,1>F { align1 1Q };
(-f0.0) sel(8) g15<1>F (abs)g14<8,8,1>F 0x3f800000F /* 1F */ { align1 1Q };
(+f0.0) sel(16) g13<1>F (abs)g52<8,8,1>F g9<8,8,1>F { align1 1H };
(-f0.0) sel(16) g27<1>F (abs)g25<8,8,1>F 0x3f800000F /* 1F */ { align1 1H };
(+f0.0) sel(8) g21<1>.xyzUD g19<4>.xyzzUD 0x00000000UD { align16 1Q };
sel.l(8) m2<1>F g3<8,8,1>F g4<8,8,1>F { align1 1Q };
sel.l(16) m3<1>F g3<8,8,1>F g5<8,8,1>F { align1 1H };
(-f0.0.y) sel(8) g3<1>.yUD g10<4>.xUD 0x00000000UD { align16 1Q };
(+f0.0.y) sel(8) g3<1>.yUD g1<0>.wUD g1<0>.zUD { align16 1Q };
(-f0.0) sel(8) g28<1>UD g26<4>UD 0x00000000UD { align16 1Q };
sel.ge(8) g22<1>.xD g3.4<0>.xD g5.4<0>.xD { align16 1Q };
sel.l(8) m1<1>F g36<8,8,1>F 0x3f800000F /* 1F */ { align1 1Q };
sel.l(16) m1<1>F g14<8,8,1>F 0x3f800000F /* 1F */ { align1 1H };
sel.sat.ge(8) m4<1>F g25<4>F 0xbf800000F /* -1F */ { align16 1Q };
sel.ge(8) m2<1>F g5<8,8,1>F 0x0F /* 0F */ { align1 1Q };
sel.ge(16) m3<1>F g7<8,8,1>F 0x0F /* 0F */ { align1 1H };
sel.l(8) g13<1>D g11<4>D 254D { align16 1Q };
sel.sat.l(8) g47<1>F g46<8,8,1>F 0x3f000000F /* 0.5F */ { align1 1Q };
sel.sat.l(16) g54<1>F g3<8,8,1>F 0x3f000000F /* 0.5F */ { align1 1H };
|
programs/oeis/313/A313476.asm | karttu/loda | 0 | 101405 | <reponame>karttu/loda<gh_stars>0
; A313476: Coordination sequence Gal.5.53.5 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,10,14,18,22,26,30,34,39,44,49,54,58,62,66,70,74,78,83,88,93,98,102,106,110,114,118,122,127,132,137,142,146,150,154,158,162,166,171,176,181,186,190,194,198,202,206,210,215
mov $3,$0
add $0,1
mov $1,$0
add $0,2
lpb $0,1
mov $2,$0
sub $0,1
mov $4,5
trn $4,$2
trn $1,$4
add $1,4
mov $2,$0
add $4,2
sub $2,$4
sub $2,4
mov $0,$2
trn $0,3
lpe
lpb $3,1
add $1,3
sub $3,1
lpe
sub $1,3
|
features/misc.asm | SuriyaaKudoIsc/alos | 3 | 97255 | <reponame>SuriyaaKudoIsc/alos
; ==================================================================
; alOS -- The alOS kernel
; Copyright (C) 2016-present alOS Developers -- see LICENSE.md
;
; MISCELLANEOUS ROUTINES
; ==================================================================
; ------------------------------------------------------------------
; os_get_api_version -- Return current version of MikeOS API
; IN: Nothing; OUT: AL = API version number
os_get_api_version:
mov al, MIKEOS_API_VER
ret
; ------------------------------------------------------------------
; os_pause -- Delay execution for specified microseconds
; IN: AX = number of tenths of a second to wait (so 10 = 1 second)
os_pause:
pusha
mov bx, ax
mov cx, 1h
mov dx, 86A0h
mov ax, 0
mov ah, 86h
.loop:
int 15h
dec bx
jne .loop
popa
ret
; ------------------------------------------------------------------
; os_fatal_error -- Display error message and halt execution
; IN: AX = error message string location
os_fatal_error:
mov bx, ax ; Store string location for now
mov dh, 0
mov dl, 0
call os_move_cursor
pusha
mov ah, 09h ; Draw red bar at top
mov bh, 0
mov cx, 240
mov bl, 01001111b
mov al, ' '
int 10h
popa
mov dh, 0
mov dl, 0
call os_move_cursor
mov si, .msg_inform ; Inform of fatal error
call os_print_string
mov si, bx ; Program-supplied error message
call os_print_string
jmp $ ; Halt execution
.msg_inform db '>>> FATAL OPERATING SYSTEM ERROR', 13, 10, 0
; ==================================================================
|
alloy4fun_models/trashltl/models/10/Szc8pTYbHakTX9n6c.als | Kaixi26/org.alloytools.alloy | 0 | 4360 | open main
pred idSzc8pTYbHakTX9n6c_prop11 {
all f:File | f not in Protected implies after f in Protected
}
pred __repair { idSzc8pTYbHakTX9n6c_prop11 }
check __repair { idSzc8pTYbHakTX9n6c_prop11 <=> prop11o } |
programs/oeis/066/A066141.asm | neoneye/loda | 22 | 241762 | ; A066141: a(n) = n^(n-1) + n + 1.
; 3,5,13,69,631,7783,117657,2097161,43046731,1000000011,25937424613,743008370701,23298085122495,793714773254159,29192926025390641,1152921504606846993,48661191875666868499,2185911559738696531987,104127350297911241532861,5242880000000000000000021,278218429446951548637196423,15519448971100888972574851095,907846434775996175406740561353,55572324035428505185378394701849,3552713678800500929355621337890651,236773830007967588876795164938469403
mov $2,1
add $2,$0
pow $2,$0
add $0,$2
add $0,2
|
src/orig/dds-request_reply-untypedcommon.adb | alexcamposruiz/dds-requestreply | 0 | 26685 | <reponame>alexcamposruiz/dds-requestreply
with DDS.DomainParticipantFactory;
with DDS.TopicListener;
with GNAT.Source_Info;
package body DDS.Request_Reply.Untypedcommon is
-- void DebugDataWriterListener_on_publication_matched(DDS_DataWriter* writer,
-- const struct DDS_PublicationMatchedStatus* status) {
-- printf("on_publication_matched\n");
-- }
-- struct DDS_DataWriterQos* RTI_Connext_get_default_request_reply_writer_qos(DDS_DomainParticipant * participant)
-- {
-- static struct DDS_DataWriterQos qos = DDS_DataWriterQos_INITIALIZER;
-- DDS_DomainParticipant_get_default_datawriter_qos(participant, &qos);
-- return &qos;
-- }
procedure RTI_Connext_Get_Default_Request_Reply_Writer_Qos
(Participant : DDS.DomainParticipant.Ref_Access;
Ret : in out DDS.DataWriterQos) is
begin
Participant.Get_Default_DataWriter_Qos (Ret);
end;
procedure RTI_Connext_Get_Default_Request_Reply_Reader_Qos
(Participant : DDS.DomainParticipant.Ref_Access;
Ret : in out DDS.DataReaderQos) is
begin
Participant.Get_Default_DataReader_Qos (Ret);
end;
function RTI_Connext_EntityUntypedImpl_Get_Datawriter_Qos
(Self : not null access RTI_Connext_EntityUntypedImpl;
Qos : in out DDS.DataWriterQos;
Params : RTI_Connext_EntityParams;
Role_Name : DDS.String := DDS.NULL_STRING) return DDS.ReturnCode_T is
RetCode : DDS.ReturnCode_T := DDS.RETCODE_OK;
begin
if Params.Datawriter_Qos = null and Params.Qos_Library_Name /= NULL_STRING then
DDS.DomainParticipantFactory.Get_Instance.Get_Datawriter_Qos_From_Profile_W_Topic_Name
(QoS => QoS,
Library_Name => Params.Qos_Library_Name,
Profile_Name => Params.Qos_Profile_Name,
Topic_Name => Self.Writer_Topic.As_TopicDescription.Get_Name);
elsif Params.Datawriter_Qos /= null then
Copy (Qos, Params.Datawriter_Qos.all);
else
Self.Participant.Get_Default_Datawriter_Qos (QoS);
Qos.Reliability.Kind := DDS.RELIABLE_RELIABILITY_QOS;
Qos.History.Kind := DDS.KEEP_ALL_HISTORY_QOS;
Qos.Resource_Limits.Max_Samples := DDS.LENGTH_UNLIMITED;
Qos.Reliability.Max_Blocking_Time:= To_Duration_T(10.0);
-- Heartbeats
Qos.Protocol.Rtps_Reliable_Writer.Max_Heartbeat_Retries := DDS.LENGTH_UNLIMITED;
Qos.Protocol.Rtps_Reliable_Writer.Heartbeat_Period:= To_Duration_T(0.100);
Qos.Protocol.Rtps_Reliable_Writer.Fast_Heartbeat_Period := To_Duration_T (0.010);
Qos.Protocol.Rtps_Reliable_Writer.Late_Joiner_Heartbeat_Period := To_Duration_T (0.010);
Qos.Protocol.Rtps_Reliable_Writer.Heartbeats_Per_Max_Samples := 2;
-- Nack response delay
Qos.Protocol.Rtps_Reliable_Writer.Max_Nack_Response_Delay := To_Duration_T(0.0);
Qos.Protocol.Rtps_Reliable_Writer.Min_Nack_Response_Delay := To_Duration_T (0.0);
-- Send window
Qos.Protocol.Rtps_Reliable_Writer.Max_Send_Window_Size := 32;
Qos.Protocol.Rtps_Reliable_Writer.Min_Send_Window_Size := 32;
-- max_remote_reader_filters unlimited
-- This allows a Replier to do writer-side filtering
-- for any number of Requester
Qos.Writer_Resource_Limits.Max_Remote_Reader_Filters := DDS.LENGTH_UNLIMITED;
end if;
if Qos.Publication_Name.Role_Name = NULL_STRING then
Copy (Qos.Publication_Name.Role_Name, Role_Name);
end if;
return RetCode;
end;
function RTI_Connext_EntityUntypedImpl_Get_Datareader_Qos
(Self : not null access RTI_Connext_EntityUntypedImpl;
Qos : in out DDS.DataReaderQoS;
Params : RTI_Connext_EntityParams;
Role_Name : DDS.String := DDS.NULL_STRING) return DDS.ReturnCode_T is
RetCode : DDS.ReturnCode_T := DDS.RETCODE_OK;
begin
if Params.Datareader_Qos = null and Params.Qos_Library_Name /= NULL_STRING then
DDS.DomainParticipantFactory.Get_Instance.get_datareader_qos_from_profile_w_topic_name
(QoS => QoS,
Library_Name => Params.Qos_Library_Name,
Profile_Name => Params.Qos_Profile_Name,
Topic_Name => Self.Writer_Topic.As_TopicDescription.Get_Name);
elsif Params.Datareader_Qos /= null then
Copy (Qos, Params.Datareader_Qos.all);
else
Self.Participant.Get_Default_Datareader_Qos (QoS);
Qos.Reliability.Kind := DDS.RELIABLE_RELIABILITY_QOS;
Qos.History.Kind := DDS.KEEP_ALL_HISTORY_QOS;
Qos.Resource_Limits.Max_Samples := DDS.LENGTH_UNLIMITED;
Qos.Reliability.Max_Blocking_Time:= To_Duration_T(10.0);
Qos.Protocol.Rtps_Reliable_Reader.Max_Heartbeat_Response_Delay := To_Duration_T (0.0);
Qos.Protocol.Rtps_Reliable_Reader.Min_Heartbeat_Response_Delay := To_Duration_T (0.0);
end if;
if Qos.Subscription_Name.Role_Name = DDS.NULL_STRING then
Copy (Qos.Subscription_Name.Role_Name, Role_Name);
end if;
return RetCode;
end;
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_delete(
-- struct RTI_Connext_EntityUntypedImpl * self)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
-- DDS_ReturnCode_t realReturn = DDS_RETCODE_OK;
--
-- if (self == NULL) {
-- return DDS_RETCODE_OK;
-- }
--
-- if (self->participant != NULL) {
-- /* We do not delete topics even if we create them as they
-- * may be used else where in the participant.
-- * Therefore the end user is responsible for cleaning these
-- * topics up prior to deleting the participant.
-- */
-- if (self->_reader != NULL) {
--
-- if (self->_not_read_sample_cond != NULL) {
-- retCode = DDS_DataReader_delete_readcondition(
-- self->_reader, self->_not_read_sample_cond);
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error deleting reader read condition");
-- realReturn = DDS_RETCODE_ERROR;
-- }
-- }
--
-- if (self->_any_sample_cond != NULL) {
-- retCode = DDS_DataReader_delete_readcondition(
-- self->_reader, self->_any_sample_cond);
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error deleting reader read condition");
-- realReturn = DDS_RETCODE_ERROR;
-- }
-- self->_any_sample_cond = NULL;
-- }
--
-- retCode = DDS_Subscriber_delete_datareader(
-- self->_subscriber, self->_reader);
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error deleting datareader");
-- realReturn = DDS_RETCODE_ERROR;
-- }
--
-- self->_reader = NULL;
-- }
--
-- if (self->_writer != NULL) {
-- retCode = DDS_Publisher_delete_datawriter(
-- self->_publisher, self->_writer);
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error deleting datawriter");
-- realReturn = DDS_RETCODE_ERROR;
-- }
-- self->_writer = NULL;
-- }
--
-- self->participant = NULL;
-- }
--
-- if(self->_waitset != NULL) {
-- DDS_WaitSet_delete(self->_waitset);
-- self->_waitset = NULL;
-- }
--
-- if (self->_waitset_pool != NULL) {
-- REDAFastBufferPool_delete(self->_waitset_pool);
-- self->_waitset_pool = NULL;
-- }
--
-- RTIOsapiHeap_freeStructure(self);
-- return realReturn;
-- }
-- =========================================================================
-- =========================================================================
-- Package
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_initialize(
-- struct RTI_Connext_EntityUntypedImpl * self,
-- const RTI_Connext_EntityParams* params,
-- RegisterTypeFunc register_writer_type_fnc,
-- const char * writer_type_name,
-- RegisterTypeFunc register_reader_type_fnc,
-- const char * reader_type_name,
-- int sample_size,
-- struct RTI_Connext_TopicBuilder * topic_builder,
-- struct DDS_DataReaderListener * reader_listener,
-- const char * role_name)
-- {
-- DDS_ReturnCode_t retcode = DDS_RETCODE_ERROR;
-- struct DDS_DataWriterQos writerQos = DDS_DataWriterQos_INITIALIZER;
-- struct DDS_DataReaderQos readerQos = DDS_DataReaderQos_INITIALIZER;
--
-- if(!RTI_Connext_EntityParams_validate(params)) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "invalid params");
-- return DDS_RETCODE_BAD_PARAMETER;
-- }
--
-- self->_waitset_pool = NULL; /* Initialized by RequesterUntypedImpl only */
-- self->_sample_size = sample_size;
--
-- self->participant = params->participant;
-- self->_publisher = params->publisher;
-- self->_subscriber = params->subscriber;
-- if(self->_publisher == NULL) {
-- self->_publisher = DDS_DomainParticipant_get_implicit_publisher(
-- self->participant);
-- if(self->_publisher == NULL) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "unable to get implicit publisher");
-- goto done;
-- }
-- }
--
-- if(self->_subscriber == NULL) {
-- self->_subscriber = DDS_DomainParticipant_get_implicit_subscriber(
-- self->participant);
-- if(self->_subscriber == NULL) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "unable to get implicit subscriber");
-- goto done;
-- }
-- }
--
-- self->_waitset = DDS_WaitSet_new();
-- if(self->_waitset == NULL)
-- {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "unable to create waitset.");
-- goto done;
-- }
--
-- if (register_writer_type_fnc(self->participant, writer_type_name) !=
-- DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error registering DataWriter type");
-- goto done;
-- }
--
-- self->_writer_topic =
-- topic_builder->create_writer_topic(self, params, writer_type_name);
--
-- if (self->_writer_topic == NULL) {
-- DDSLog_exception(&RTI_LOG_CREATION_FAILURE_s,
-- "writer topic");
-- goto done;
-- }
--
-- retcode = RTI_Connext_EntityUntypedImpl_get_datawriter_qos(
-- self, &writerQos, params, role_name);
-- if(retcode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Failure to get datawriter qos");
-- goto done;
-- }
--
-- self->_writer = DDS_Publisher_create_datawriter(
-- self->_publisher,
-- self->_writer_topic,
-- &writerQos,
-- NULL, DDS_STATUS_MASK_NONE);
--
-- if (self->_writer == NULL) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "EntityUntypedImpl: Error creating DDS DataWriter");
-- goto done;
-- }
--
-- if (register_reader_type_fnc(self->participant, reader_type_name) !=
-- DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error registering DataReader type");
-- goto done;
-- }
--
-- self->_reader_topic =
-- topic_builder->create_reader_topic(self, params, reader_type_name);
--
-- if (self->_reader_topic == NULL) {
-- DDSLog_exception(&RTI_LOG_CREATION_FAILURE_s,
-- "reader topic");
-- goto done;
-- }
--
-- retcode = RTI_Connext_EntityUntypedImpl_get_datareader_qos(
-- self, &readerQos, params, role_name);
-- if(retcode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error getting datareader qos");
-- goto done;
-- }
--
-- /* Remember this value to check for inconsistent calls later */
-- self->_max_samples_per_read =
-- readerQos.reader_resource_limits.max_samples_per_read;
--
-- self->_reader = DDS_Subscriber_create_datareader(
-- self->_subscriber,
-- self->_reader_topic,
-- &readerQos,
-- reader_listener,
-- reader_listener != NULL ?
-- DDS_DATA_AVAILABLE_STATUS :
-- DDS_STATUS_MASK_NONE);
--
-- if (self->_reader == NULL) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "EntityUntypedImpl: Error creating DDS DataReader");
-- goto done;
-- }
--
--
-- self->_any_sample_cond = DDS_DataReader_create_readcondition(
-- self->_reader,
-- DDS_ANY_SAMPLE_STATE,
-- DDS_ANY_VIEW_STATE,
-- DDS_ANY_INSTANCE_STATE);
--
-- if (self->_any_sample_cond == NULL) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "EntityUntypedImpl: Error creating DDS ReadCondition");
-- goto done;
-- }
--
-- self->_not_read_sample_cond = DDS_DataReader_create_readcondition(
-- self->_reader,
-- DDS_NOT_READ_SAMPLE_STATE,
-- DDS_ANY_VIEW_STATE,
-- DDS_ANY_INSTANCE_STATE);
--
-- if (self->_not_read_sample_cond == NULL) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "EntityUntypedImpl: Error creating DDS ReadCondition");
-- goto done;
-- }
--
-- retcode = DDS_WaitSet_attach_condition(
-- self->_waitset,
-- DDS_ReadCondition_as_condition(self->_not_read_sample_cond));
-- if(retcode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Error attaching waitset");
-- goto done;
-- }
--
-- retcode = DDS_RETCODE_OK;
-- done:
-- DDS_DataWriterQos_finalize(&writerQos);
-- DDS_DataReaderQos_finalize(&readerQos);
--
-- return retcode;
-- }
function RTI_Connext_EntityUntypedImpl_Initialize (Self : in out RTI_Connext_EntityUntypedImpl;
Params : RTI_Connext_EntityParams;
Writer_Type_Name : DDS.String;
Reader_Type_Name : DDS.String;
Sample_Size : DDS.long;
-- Topic_Builder : RTI_Connext_TopicBuilder;
Reader_Listener : DDS.DataReaderListener.Ref_Access;
Role_Name : DDS.String) return DDS.ReturnCode_T is
begin
return raise Program_Error with "unimplemented RTI_Connext_EntityUntypedImpl_Touch_Samples";
end;
-- int RTI_Connext_EntityUntypedImpl_touch_samples(
-- struct RTI_Connext_EntityUntypedImpl * self,
-- int max_count,
-- DDS_ReadCondition * read_condition)
-- {
-- void ** received_data = NULL;
-- struct DDS_SampleInfoSeq info_seq = DDS_SEQUENCE_INITIALIZER;
-- int data_count = -1;
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
-- DDS_Boolean isLoan = DDS_BOOLEAN_TRUE;
--
-- retCode = RTI_Connext_EntityUntypedImpl_get_sample_loaned_w_len(
-- self,
-- &received_data,
-- &data_count,
-- &isLoan,
-- NULL, /* dont need buffer */
-- &info_seq,
-- (DDS_Long)0, /* data_seq_len */
-- (DDS_Long)0, /* data_seq_max_len */
-- DDS_BOOLEAN_TRUE, /* ownership */
-- (DDS_Long)max_count, /* We don't care if we have more */
-- read_condition,
-- RTI_FALSE /* read instead of taking */);
--
-- if (retCode == DDS_RETCODE_OK) {
-- retCode = RTI_Connext_EntityUntypedImpl_return_loan(self, received_data, &info_seq);
-- if(retCode != DDS_RETCODE_OK)
-- {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "error with returning loan");
-- return -1;
-- }
-- } else if (retCode != DDS_RETCODE_NO_DATA) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "error with getting sample loan");
-- return -1;
-- }
--
-- return data_count;
-- }
function RTI_Connext_EntityUntypedImpl_Touch_Samples
(Self : not null access RTI_Connext_EntityUntypedImpl;
Max_Count : DDS.Integer;
Read_Condition : Dds.ReadCondition.Ref_Access) return DDS.Integer is
RetCode : DDS.ReturnCode_T := DDS.RETCODE_OK;
begin
return raise Program_Error with "unimplemented RTI_Connext_EntityUntypedImpl_Touch_Samples";
end;
-- =========================================================================
-- =========================================================================
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_wait_for_samples(
-- struct RTI_Connext_EntityUntypedImpl * self,
-- const struct DDS_Duration_t* max_wait,
-- int min_sample_count,
-- DDS_WaitSet* waitset,
-- DDS_ReadCondition * initial_condition,
-- DDS_ReadCondition * condition)
-- {
-- struct DDS_Duration_t remainingWait;
-- struct DDS_ConditionSeq activeConditions = DDS_SEQUENCE_INITIALIZER;
-- DDS_ReturnCode_t retCode = DDS_RETCODE_ERROR;
-- int sample_count = 0;
-- struct DDS_Duration_t durationBefore, durationAfter;
-- struct DDS_Time_t timeBefore, timeAfter;
-- RTINtpTime timeBeforeNtp, timeAfterNtp, remainingWaitNtp;
--
--
-- DDSLog_testPrecondition(
-- initial_condition == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(
-- condition == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
--
-- remainingWait = *max_wait;
-- DDS_Duration_to_ntp_time(max_wait, &remainingWaitNtp);
--
-- /* The conditions can be QueryConditions or ReadConditions but we
-- need the following SampleStateKinds always
-- */
-- DDSLog_testPrecondition(
-- DDS_ReadCondition_get_sample_state_mask(condition)
-- != DDS_NOT_READ_SAMPLE_STATE,
-- return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(
-- DDS_ReadCondition_get_sample_state_mask(initial_condition)
-- != DDS_ANY_SAMPLE_STATE,
-- return DDS_RETCODE_PRECONDITION_NOT_MET);
--
--
-- if (min_sample_count == DDS_LENGTH_UNLIMITED) {
-- min_sample_count = INT_MAX;
-- }
--
-- sample_count = RTI_Connext_EntityUntypedImpl_touch_samples(
-- self, min_sample_count, initial_condition);
-- if(sample_count == -1){
-- DDSLog_exception(&RTI_LOG_GET_FAILURE_s,
-- "initial sample count");
-- goto finish;
-- }
--
-- min_sample_count -= sample_count;
--
-- while (min_sample_count > 0) {
-- if (min_sample_count == 1) {
-- retCode = DDS_WaitSet_wait(
-- waitset, &activeConditions, &remainingWait);
-- } else {
-- DDS_DomainParticipant_get_current_time(
-- self->participant, &timeBefore);
--
-- retCode = DDS_WaitSet_wait(
-- waitset, &activeConditions, &remainingWait);
--
-- DDS_DomainParticipant_get_current_time(
-- self->participant, &timeAfter);
--
-- /* Calculate remainingWait -= timeAfter - timeBefore */
-- durationAfter.sec = timeAfter.sec;
-- durationAfter.nanosec = timeAfter.nanosec;
-- durationBefore.sec = timeBefore.sec;
-- durationBefore.nanosec = durationAfter.nanosec;
-- DDS_Duration_to_ntp_time(&durationBefore, &timeBeforeNtp);
-- DDS_Duration_to_ntp_time(&durationAfter, &timeAfterNtp);
-- RTINtpTime_decrement(timeAfterNtp, timeBeforeNtp);
-- RTINtpTime_decrement(remainingWaitNtp, timeAfterNtp);
-- DDS_Duration_from_ntp_time(&remainingWait, &remainingWaitNtp);
-- }
--
-- if (retCode == DDS_RETCODE_TIMEOUT) {
-- DDSLog_local(&RTI_LOG_ANY_s,
-- "timed out waiting for data");
-- goto finish;
-- } else if (retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "wait");
-- goto finish;
-- }
--
-- DDSLog_testPrecondition(
-- DDS_ConditionSeq_get_length(&activeConditions) != 1,
-- goto finish);
--
-- DDSLog_testPrecondition(
-- DDS_ConditionSeq_get(&activeConditions, 0) !=
-- DDS_ReadCondition_as_condition(condition),
-- goto finish);
--
-- if (min_sample_count > 1) {
-- sample_count = RTI_Connext_EntityUntypedImpl_touch_samples(self, min_sample_count, condition);
-- if(sample_count == -1) {
-- DDSLog_exception(&RTI_LOG_GET_FAILURE_s,
-- "sample count");
-- retCode = DDS_RETCODE_ERROR;
-- goto finish;
-- }
-- min_sample_count -= sample_count;
-- } else {
-- /* If we woke up from the waitset, we have at least
-- * one sample to read; we can skip the read operation
-- */
-- min_sample_count--;
-- }
-- }
--
-- retCode = DDS_RETCODE_OK;
-- finish:
-- DDS_ConditionSeq_finalize(&activeConditions);
-- return retCode;
-- }
function RTI_Connext_EntityUntypedImpl_Wait_For_Samples
(Self : not null access RTI_Connext_EntityUntypedImpl;
Max_Wait : DDS.Duration_T;
Min_Sample_Count : DDS.Integer;
Waitset : DDS.WaitSet.Ref_Access;
Initial_Condition : DDS.ReadCondition.Ref_Access;
Condition : DDS.ReadCondition.Ref_Access ) return DDS.ReturnCode_T is
begin
return raise Program_Error with "unimplemented RTI_Connext_EntityUntypedImpl_Wait_For_Samples";
end;
-- =========================================================================
-- =========================================================================
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_wait_for_any_sample(
-- struct RTI_Connext_EntityUntypedImpl * self,
-- const struct DDS_Duration_t* max_wait,
-- int min_sample_count)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- retCode = RTI_Connext_EntityUntypedImpl_wait_for_samples(
-- self, max_wait, min_sample_count,
-- self->_waitset, self->_any_sample_cond, self->_not_read_sample_cond);
--
-- if(retCode != DDS_RETCODE_OK && retCode != DDS_RETCODE_TIMEOUT)
-- {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "wait error");
-- }
-- return retCode;
-- }
function RTI_Connext_EntityUntypedImpl_Wait_For_Any_Sample
(Self : not null access RTI_Connext_EntityUntypedImpl;
Max_Wait : DDS.Duration_T;
Min_Sample_Count : DDS.Integer) return DDS.ReturnCode_T is
RetCode : DDS.ReturnCode_T := DDS.RETCODE_OK;
begin
RetCode := RTI_Connext_EntityUntypedImpl_Wait_For_Samples
(Self, Max_Wait => Max_Wait,
Min_Sample_Count => Min_Sample_Count ,
Waitset => Self.Waitset,
Initial_Condition => Self.Any_Sample_Cond,
Condition => Self.Not_Read_Sample_Cond);
-- if RetCode not in (DDS.RETCODE_OK , DDS.RETCODE_TIMEOUT) then
-- null; -- log error
-- end if;
return RetCode;
end;
-- =========================================================================
-- =========================================================================
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_get_sample_loaned_w_len(
-- struct RTI_Connext_EntityUntypedImpl * self,
-- void *** received_data,
-- int * data_count,
-- DDS_Boolean* is_loan,
-- void* dataSeqContiguousBuffer,
-- struct DDS_SampleInfoSeq* info_seq,
-- DDS_Long data_seq_len,
-- DDS_Long data_seq_max_len,
-- DDS_Boolean data_seq_has_ownership,
-- DDS_Long max_samples,
-- DDS_ReadCondition * read_condition,
-- RTIBool take)
-- {
--
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- DDSLog_testPrecondition(received_data == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(data_count == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(read_condition == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
--
-- retCode = DDS_DataReader_read_or_take_w_condition_untypedI(
-- self->_reader,
-- is_loan,
-- received_data,
-- data_count,
-- info_seq,
-- data_seq_len,
-- data_seq_max_len,
-- data_seq_has_ownership,
-- dataSeqContiguousBuffer,
-- self->_sample_size,
-- max_samples,
-- (DDS_ReadCondition *) read_condition,
-- take);
--
-- DDSLog_testPrecondition(!is_loan, return DDS_RETCODE_ERROR);
--
-- if(retCode != DDS_RETCODE_OK && retCode != DDS_RETCODE_NO_DATA)
-- {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "read or take error");
-- }
-- return retCode;
-- }
--
function RTI_Connext_EntityUntypedImpl_Get_Sample_Loaned_W_Len
(Self : not null access RTI_Connext_EntityUntypedImpl;
Received_Data : System.Address;
Data_Count : in out DDS.Natural;
Is_Loan : in out Boolean;
DataSeqContiguousBuffer : System.Address;
Info_Seq : not null access DDS.SampleInfo_Seq.Sequence;
Data_Seq_Len : DDS.long;
Data_Seq_Max_Len : DDS.long;
Data_Seq_Has_Ownership : DDS.Boolean;
Max_Samples : DDS.long;
Read_Condition : DDS.ReadCondition.Ref_Access;
Take : Boolean) return Dds.ReturnCode_T is
pragma Unreferenced (Data_Count, Is_Loan);
begin
return DDS.ReturnCode_T'Val (Self.Reader.Read_W_Condition
(Received_Data => Received_Data,
Info_Seq => Info_Seq,
Max_Samples => Max_Samples,
Condition => Read_Condition));
end;
-- =========================================================================
-- =========================================================================
-- RTIBool RTI_Connext_EntityUntypedImpl_validate(struct RTI_Connext_EntityUntypedImpl * self,
-- int min_count,
-- int max_count,
-- const struct DDS_Duration_t* max_wait)
-- {
--
-- if(max_count == 0) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "max_request_count must be greater than zero.");
-- return RTI_FALSE;
-- }
-- if((min_count < 0) && (min_count != DDS_LENGTH_UNLIMITED)) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Negative min_request_count not allowed except DDS_LENGTH_UNLIMITED.");
-- return RTI_FALSE;
-- }
-- if((max_count < 0) && (max_count != DDS_LENGTH_UNLIMITED)) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "Negative max_request_count not allowed except DDS_LENGTH_UNLIMITED.");
-- return RTI_FALSE;
-- }
-- if((min_count == DDS_LENGTH_UNLIMITED) && (max_count != DDS_LENGTH_UNLIMITED)) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "max_request_count must be at least min_request_count.");
-- return RTI_FALSE;
-- }
-- if((max_count < min_count) && (max_count != DDS_LENGTH_UNLIMITED)) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "max_request_count must be at least min_request_count.");
-- return RTI_FALSE;
-- }
--
-- if(DDS_Time_is_zero(max_wait)) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "max_wait must be greater than zero.");
-- return RTI_FALSE;
-- }
--
-- if((max_count == DDS_LENGTH_UNLIMITED) &&
-- (DDS_Duration_is_infinite(max_wait))) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "The call will block foreever.");
-- return RTI_FALSE;
-- }
--
-- return RTI_TRUE;
-- }
--
-- =========================================================================
-- =========================================================================
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_get_sample_loaned(
-- struct RTI_Connext_EntityUntypedImpl * self,
-- void *** received_data,
-- int * data_count,
-- DDS_Boolean* is_loan,
-- void* dataSeqContiguousBuffer,
-- struct DDS_SampleInfoSeq* info_seq,
-- DDS_Long data_seq_len,
-- DDS_Long data_seq_max_len,
-- DDS_Boolean ownership,
-- DDS_Long max_samples,
-- DDS_ReadCondition * read_condition,
-- RTIBool take)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- DDSLog_testPrecondition(received_data == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(data_count == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(max_samples < 0 &&
-- max_samples != DDS_LENGTH_UNLIMITED, return DDS_RETCODE_PRECONDITION_NOT_MET);
--
-- if (read_condition == NULL) {
-- read_condition = self->_any_sample_cond;
-- }
--
-- retCode = RTI_Connext_EntityUntypedImpl_get_sample_loaned_w_len(
-- self,
-- received_data,
-- data_count,
-- is_loan,
-- dataSeqContiguousBuffer,
-- info_seq,
-- data_seq_len,
-- data_seq_max_len,
-- ownership,
-- max_samples,
-- read_condition,
-- take);
--
-- if (retCode == DDS_RETCODE_NO_DATA) {
-- *data_count = 0;
-- return retCode;
-- }
-- if(retCode != DDS_RETCODE_OK)
-- {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "get sample loan error");
-- }
-- return retCode;
-- }
function RTI_Connext_EntityUntypedImpl_Get_Sample_Loaned
(Self : not null access RTI_Connext_EntityUntypedImpl;
Received_Data : System.Address;
Data_Count : in out DDS.Natural;
Is_Loan : in out Boolean;
DataSeqContiguousBuffer : System.Address;
Info_Seq : not null access DDS.SampleInfo_Seq.Sequence;
Data_Seq_Len : DDS.long;
Data_Seq_Max_Len : DDS.long;
Ownership : DDS.Boolean;
Max_Samples : DDS.long;
Read_Condition : DDS.ReadCondition.Ref_Access;
Take : Boolean) return Dds.ReturnCode_T is
Retcode : DDS.ReturnCode_T;
use type DDS.ReadCondition.Ref_Access;
begin
Retcode := RTI_Connext_EntityUntypedImpl_Get_Sample_Loaned_W_Len
(Self,
Received_Data,
Data_Count,
Is_Loan,
DataSeqContiguousBuffer,
Info_Seq,
Data_Seq_Len,
Data_Seq_Max_Len,
Ownership,
Max_Samples,
(if Read_Condition = null
then Self.Any_Sample_Cond
else Read_Condition),
Take);
if Retcode = DDS.RETCODE_NO_DATA then
Data_Count := 0;
return RetCode;
elsif RetCode /= DDS.RETCODE_OK then
null;
-- DDSLog_Exception (RTI_LOG_ANY_FAILURE_S, "get sample loan error");
end if;
return RetCode;
end;
-- =========================================================================
-- =========================================================================
--
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_return_loan(
-- struct RTI_Connext_EntityUntypedImpl * self, void ** dataArray, struct DDS_SampleInfoSeq* info_seq)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- DDSLog_testPrecondition(dataArray == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
--
-- retCode = DDS_DataReader_return_loan_untypedI(
-- self->_reader,
-- dataArray,
-- DDS_SampleInfoSeq_get_length(info_seq),
-- info_seq);
--
-- if (retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "return DataReader loan");
-- }
-- return retCode;
-- }
--
-- DDS_ReturnCode_t RTI_Connext_EntityUntypedImpl_send_sample(
-- struct RTI_Connext_EntityUntypedImpl * self,
-- const void * data,
-- struct DDS_WriteParams_t* info)
-- {
-- DDS_ReturnCode_t retCode = DDS_RETCODE_OK;
--
-- DDSLog_testPrecondition(self == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(data == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(info == NULL, return DDS_RETCODE_PRECONDITION_NOT_MET);
-- DDSLog_testPrecondition(self->_writer == NULL,
-- return DDS_RETCODE_PRECONDITION_NOT_MET);
--
-- DDS_SampleIdentity_t_copy(&info->identity, &DDS_AUTO_SAMPLE_IDENTITY);
--
-- retCode = DDS_DataWriter_write_w_params_untypedI(
-- self->_writer, data, info);
--
-- if(retCode != DDS_RETCODE_OK) {
-- DDSLog_exception(&RTI_LOG_ANY_FAILURE_s,
-- "send sample write error");
-- }
--
-- return retCode;
-- }
-- =========================================================================
-- =========================================================================
function RTI_Connext_EntityUntypedImpl_Send_Sample
(Self : not null access RTI_Connext_EntityUntypedImpl;
Data : System.Address;
Info : in out WriteParams_T ) return ReturnCode_T is
RetCode : ReturnCode_T := RETCODE_OK;
begin
Info.Identity := DDS.AUTO_SAMPLE_IDENTITY;
RetCode := Self.Writer.Write_W_Params (Data, Info);
if RetCode /= RETCODE_OK then
DDSLog_Exception ("send sample write error");
end if;
return RetCode;
end;
function RTI_Connext_EntityUntypedImpl_Validate_Receive_Params
(Self : not null access RTI_Connext_EntityUntypedImpl;
FUNCTION_NAME : Standard.String := GNAT.Source_Info.Enclosing_Entity;
Min_Count : DDS.long;
Max_Count : DDS.long;
Max_Wait : DDS.Duration_T) return Boolean is
L_Min_Count : DDS.long := (if Min_Count = LENGTH_UNLIMITED
then Self.Max_Samples_Per_Read
else Max_Count);
L_Max_Count : DDS.long := (if Max_Count = LENGTH_UNLIMITED
then Self.Max_Samples_Per_Read
else Max_Count);
Ok : Boolean := True;
begin
if L_Max_Count < 1 and L_Max_Count /= LENGTH_UNLIMITED
then
DDSLog_Exception ("max_count must be greater than zero");
OK := False;
end if;
if ((L_Max_Count < L_Min_Count) and (L_Max_Count /= LENGTH_UNLIMITED)) or
((L_Min_Count = LENGTH_UNLIMITED) and (L_Min_Count /= LENGTH_UNLIMITED))
then
DDSLog_Exception ("max_count must be greater or equal than min_count");
OK := False;
end if;
if (L_Max_Count = LENGTH_UNLIMITED) and then Duration_Is_Infinite (Max_Wait) then
DDSLog_Exception ("max_count and max_wait cannot be both unbounded");
OK := False;
end if;
return OK;
end;
function RTI_Connext_SimpleReplierParams_To_Entityparams
(Self : RTI_Connext_EntityParams'Class;
ToParams : out RTI_Connext_EntityParams) return ReturnCode_T is
begin
ToParams.Participant := Self.Participant;
ToParams.Datareader_Qos := Self.Datareader_Qos;
ToParams.Datawriter_Qos := Self.Datawriter_Qos;
ToParams.Publisher := Self.Publisher;
Copy (ToParams.Qos_Library_Name, Self.Qos_Library_Name);
Copy (ToParams.Qos_Profile_Name, Self.Qos_Profile_Name);
Copy (ToParams.Reply_Topic_Name, Self.Reply_Topic_Name);
Copy (ToParams.Request_Topic_Name, Self.Request_Topic_Name);
Copy (ToParams.Service_Name, Self.Service_Name);
ToParams.Subscriber := Self.Subscriber;
return DDS.RETCODE_OK;
end;
end DDS.Request_Reply.Untypedcommon;
|
Cubical/Data/InfNat.agda | dan-iel-lee/cubical | 0 | 4912 | {-# OPTIONS --cubical --no-import-sorts --no-exact-split --safe #-}
module Cubical.Data.InfNat where
open import Cubical.Data.InfNat.Base public
open import Cubical.Data.InfNat.Properties public
|
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver0/sfc/ys_w61.asm | prismotizm/gigaleak | 0 | 86173 | Name: ys_w61.asm
Type: file
Size: 18310
Last-Modified: '2016-05-13T04:50:38Z'
SHA-1: 8E94AA948F32F5699EF118EADF493C91D086DD4E
Description: null
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_671.asm | ljhsiun2/medusa | 9 | 19747 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r8
push %rdi
push %rsi
lea addresses_A_ht+0x10ca5, %rdi
nop
nop
nop
add %rsi, %rsi
and $0xffffffffffffffc0, %rdi
vmovaps (%rdi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %r8
nop
nop
nop
nop
cmp $40500, %r13
pop %rsi
pop %rdi
pop %r8
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
// REPMOV
lea addresses_PSE+0xb3a5, %rsi
mov $0xa25, %rdi
sub %r12, %r12
mov $62, %rcx
rep movsw
and $48368, %rdx
// Faulty Load
lea addresses_normal+0x1c9a5, %rsi
nop
nop
inc %rbp
vmovups (%rsi), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rdi
lea oracles, %r14
and $0xff, %rdi
shlq $12, %rdi
mov (%r14,%rdi,1), %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_PSE'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_P'}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
roms/giko019.asm | bokuweb/rustynes | 423 | 16760 | <reponame>bokuweb/rustynes
; マッパー3サンプル
; INESヘッダー
.inesprg 1 ; - プログラム1バンク
.ineschr 2 ; - グラフィック2バンク
.inesmir 1 ; - 垂直ミラーリング
.inesmap 3 ; - マッパー3番(CNROM)
; ゼロページ
ViewAdr_L = $00 ; ネームテーブルアドレス(下位)
ViewAdr_H = $01 ; ネームテーブルアドレス(上位)
MapAdr_L = $02 ; マップアドレス(下位)
MapAdr_H = $03 ; マップアドレス(下位)
MapAdrW_L = $04 ; マップアドレス(下位)更新用
MapAdrW_H = $05 ; マップアドレス(上位)更新用
MapAdr_ofs = $06 ; マップアクセス用オフセット
View_X = $07 ; 汎用
View_Y = $08 ; 汎用
Work_X = $09 ; 汎用
Work_Y = $0A ; 汎用
Walk_Cnt = $10
GameMode = $11 ; モード(0=フィールド,1=バンク切り替え予約,2=切り替え後)
KumaAdr_L = $20 ; クマ下位アドレス
KumaAdr_H = $21 ; クマ上位アドレス
.bank 1 ; バンク1
.org $FFFA ; $FFFAから開始
.dw mainLoop ; VBlank割り込みハンドラ(1/60秒毎にmainLoopがコールされる)
.dw Start ; リセット割り込み。起動時とリセットでStartに飛ぶ
.dw IRQ ; ハードウェア割り込みとソフトウェア割り込みによって発生
.bank 0 ; バンク0
.org $0300 ; $0300から開始、スプライトDMAデータ配置
Sprite1_Y: .db 0 ; スプライト#1 Y座標
Sprite1_T: .db 0 ; スプライト#1 ナンバー
Sprite1_S: .db 0 ; スプライト#1 属性
Sprite1_X: .db 0 ; スプライト#1 X座標
Sprite2_Y: .db 0 ; スプライト#1 Y座標
Sprite2_T: .db 0 ; スプライト#1 ナンバー
Sprite2_S: .db 0 ; スプライト#1 属性
Sprite2_X: .db 0 ; スプライト#1 X座標
.org $8000 ; $8000から開始
Start:
sei ; 割り込み不許可
cld ; デシマルモードフラグクリア
ldx #$ff
txs ; スタックポインタ初期化
; PPUコントロールレジスタ1初期化
lda #%00110000 ; ここではVBlank割り込み禁止
sta $2000
; VROMバンク切り替え
lda #2 ; バンク2
sta $8000
waitVSync:
lda $2002 ; VBlankが発生すると、$2002の7ビット目が1になる
bpl waitVSync ; bit7が0の間は、waitVSyncラベルの位置に飛んでループして待ち続ける
; PPUコントロールレジスタ2初期化
lda #%00000110 ; 初期化中はスプライトとBGを表示OFFにする
sta $2001
; パレットをロード
ldx #$00 ; Xレジスタクリア
; VRAMアドレスレジスタの$2006に、パレットのロード先のアドレス$3F00を指定する。
lda #$3F
sta $2006
lda #$00
sta $2006
loadPal: ; ラベルは、「ラベル名+:」の形式で記述
lda tilepal, x ; Aに(ourpal + x)番地のパレットをロードする
sta $2007 ; $2007にパレットの値を読み込む
inx ; Xレジスタに値を1加算している
cpx #32 ; Xを32(10進数。BGとスプライトのパレットの総数)と比較して同じかどうか比較している
bne loadPal ; 上が等しくない場合は、loadpalラベルの位置にジャンプする
; Xが32ならパレットロード終了
; スプライトDMA領域初期化(すべて0にする)
lda #0
ldx #$00
initSpriteDMA:
sta $0300, x
inx
bne initSpriteDMA
; ゼロページ初期化
lda #$00
ldx #$00
initZeroPage:
sta <$00, x
inx
bne initZeroPage
; 初期地形描画
; ViewAdr初期化($2000)
lda #$20
sta <ViewAdr_H
sta $2006
lda #$00
sta <ViewAdr_L
sta $2006
; マップの先頭アドレス設定
lda #high(Map_Tbl_Init)
sta <MapAdr_H
lda #low(Map_Tbl_Init)
sta <MapAdr_L
lda #32 ; ネームテーブル1ライン16*2セット
sta <View_Y ; とりあえずView_Yを使う
initField:
ldy <MapAdr_ofs ; オフセット
lda [MapAdr_L],y ; マップロード
pha ; Aを保存
lda <View_Y
and #1
bne initFieldSub ; View_Yが偶数ならネームテーブル上位、奇数なら下位
pla ; Aに復帰
; 上位を取得するので4回右シフトにする
lsr a
lsr a
lsr a
lsr a
jmp initFieldSub2
initFieldSub
; 下位取得
pla ; Aに復帰
and #$F
; 下位取得後にMapAdrオフセット加算
inc <MapAdr_ofs
initFieldSub2
; キャラ出力
; 2x2キャラなので4倍にする
asl a
asl a
clc
ldy <View_Y
cpy #17
bcs initFieldSub3
clc
adc #2 ; 2x2のうちの下の部分のキャラなので2加算する
initFieldSub3
; 2キャラ出力する
sta $2007
clc
adc #1 ; 1加算
sta $2007
dec <View_Y
lda <View_Y
beq initFieldEnter2 ; 2行描き終えた
cmp #16
bne initField
; ネームテーブル改行処理(1行描き終えた)
; MapAdrオフセットクリア
lda #0
sta <MapAdr_ofs
jmp initField
initFieldEnter2
; ネームテーブル改行処理(2行描き終えた)
inc <View_X
lda <View_X
cmp #15
beq initFieldEnd ; 15行出力したら終了
lda #32 ; ネームテーブル1ライン16*2セット
sta <View_Y
; MapAdr加算
lda <MapAdr_L
clc
adc <MapAdr_ofs ; オフセットを加算
adc #8 ; さらに画面外の分の8をスキップ
sta <MapAdr_L
bcc initFieldSub4
inc <MapAdr_H ; 桁上がり
initFieldSub4
lda #0
sta <MapAdr_ofs
jmp initField
initFieldEnd
; マップの先頭アドレスを再度設定して初期化
lda #high(Map_Tbl_Init)
sta <MapAdr_H
sta <MapAdrW_H
lda #low(Map_Tbl_Init)
sta <MapAdr_L
sta <MapAdrW_L
; 属性を初期化する
; $23C0から
lda #$23
sta $2006
lda #$C0
sta $2006
sta <Work_X
lda #8 ; 8回毎に改行
sta <Work_Y
initAttr
jsr setAttrib
sta $2007
inc <MapAdrW_L
lda <MapAdrW_L
bne initAttrSub
inc <MapAdrW_H ; 桁上がり
initAttrSub
dec <Work_Y
lda <Work_Y
bne initAttrSub2
lda #8 ; 8回毎に改行
sta <Work_Y
lda <MapAdrW_L
clc
adc #24 ; 8+16
sta <MapAdrW_L
bcc initAttrSub2
inc <MapAdrW_H ; 桁上がり
initAttrSub2
inc <Work_X
lda <Work_X
bne initAttr ; Xが$00になるまでループ
; スクロールクリア
lda $2002
lda #$00
sta $2005
sta $2005
; VBlank待ち
waitVSync2:
lda $2002
bpl waitVSync2
; PPUコントロールレジスタ2初期化
lda #%00011110 ; BGの表示をONにする
sta $2001
; PPUコントロールレジスタ1の割り込み許可フラグを立てる
lda #%10110000
sta $2000
infinityLoop: ; VBlank割り込み発生を待つだけの無限ループ
lda <GameMode
cmp #1
bne infinityLoop
lda #%00110000 ; VBlank割り込み禁止
; VROMバンク切り替え
lda #3 ; バンク3
sta $8000
; ネームテーブルクリア
jsr clearNameTbl
; クマ表示
jsr putKuma
waitVSync3:
lda $2002 ; VBlank待ち
bpl waitVSync3
lda #%00011110 ; BGの表示をONにする
sta $2001
; スクロールクリア
lda $2002
lda #$00
sta $2005
sta $2005
; ゲームモードを2に
inc <GameMode
lda #%10110000 ; VBlank割込み禁止解除
jmp infinityLoop
mainLoop: ; メインループ
pha ; Aレジスタをスタックに保存
; ゲームモード0のとき以外は何もしない
lda <GameMode
beq mainLoopSub
pla ; 割り込み前の内容をAレジスタに復帰
rti
mainLoopSub
jsr putSprite
inc <Walk_Cnt ; 歩きカウンター加算
; パッドI/Oレジスタの準備
lda #$01
sta $4016
lda #$00
sta $4016
; パッド入力チェック
lda $4016 ; Aボタン
and #1 ; AND #1
beq NOTHINGdown
; バンク切り替え予約
inc <GameMode
lda #%00000110 ; スプライトとBGを表示OFFにする
sta $2001
jmp NOTHINGdown
NOTHINGdown:
pla ; 割り込み前の内容をAレジスタに復帰
rti ; 割り込みから復帰
putSprite:
lda #$3 ; スプライトデータは$0300番地からなので、3をロードする。
sta $4014 ; スプライトDMAレジスタにAをストアして、スプライトデータをDMA転送する
; プレイヤーキャラスプライト描画(座標固定)
; 歩きアニメパターン取得
lda <Walk_Cnt
and #$20
asl a
tax
; 左側
lda #112 ; Y座標
sta Sprite1_Y
cpx #$40
beq spritePut
lda #02 ; 2番
jmp spritePut2
spritePut
lda #04 ; 4番
spritePut2
sta Sprite1_T
stx Sprite1_S
lda #112 ; X座標
sta Sprite1_X
; 右側
lda #112 ; Y座標
sta Sprite2_Y
cpx #$40
beq spritePut3
lda #04 ; 4番
jmp spritePut4
spritePut3
lda #02 ; 2番
spritePut4
sta Sprite2_T
stx Sprite2_S
lda #120 ; X座標
sta Sprite2_X
rts
setAttrib:
; MapAdrW_H,Lを左上として、属性1マス分をAレジスタに設定する
; (Mapのキャラ番号とパレット番号は同一というシンプルな前提)
ldy #0 ; オフセット
; 左上(000000xx)
lda [MapAdrW_L],y ; マップロード
; 上位を取得するので4回右シフトにする
ldx #4
jsr shiftR
sta <View_X ; View_Xに保存
; 右上(0000xx00)
lda [MapAdrW_L],y ; マップロード
; 下位を取得するので$FとANDする
and #$F
; 左シフト2回してView_XにORする
ldx #2
jsr shiftL
ora <View_X
sta <View_X
; 左下(00xx0000)
ldy #16 ; マップは横16バイトなので16加算
lda [MapAdrW_L],y ; マップロード
; 上位を取得するので4回右シフトにする
ldx #4
jsr shiftR
; 左シフト4回してView_XにORする
ldx #4
jsr shiftL
ora <View_X
sta <View_X
; 右下(xx000000)
lda [MapAdrW_L],y ; マップロード
; 下位を取得するので$FとANDする
and #$F
; 左シフト6回してView_XにORする
ldx #6
jsr shiftL
ora <View_X
rts
shiftL:
; Xレジスタの回数だけAを左シフトする
asl a
dex
bne shiftL
rts
shiftR:
; Xレジスタの回数だけAを右シフトする
lsr a
dex
bne shiftR
rts
putKuma:
; プレイヤーキャラスプライトクリア
lda #$00 ; アドレス0
sta $2003
sta $2004 ; マッパー3サンプル
; INESヘッダー
.inesprg 1 ; - プログラム1バンク
.ineschr 2 ; - グラフィック2バンク
.inesmir 1 ; - 垂直ミラーリング
.inesmap 3 ; - マッパー3番(CNROM)
; ゼロページ
ViewAdr_L = $00 ; ネームテーブルアドレス(下位)
ViewAdr_H = $01 ; ネームテーブルアドレス(上位)
MapAdr_L = $02 ; マップアドレス(下位)
MapAdr_H = $03 ; マップアドレス(下位)
MapAdrW_L = $04 ; マップアドレス(下位)更新用
MapAdrW_H = $05 ; マップアドレス(上位)更新用
MapAdr_ofs = $06 ; マップアクセス用オフセット
View_X = $07 ; 汎用
View_Y = $08 ; 汎用
Work_X = $09 ; 汎用
Work_Y = $0A ; 汎用
Walk_Cnt = $10
GameMode = $11 ; モード(0=フィールド,1=バンク切り替え予約,2=切り替え後)
KumaAdr_L = $20 ; クマ下位アドレス
KumaAdr_H = $21 ; クマ上位アドレス
.bank 1 ; バンク1
.org $FFFA ; $FFFAから開始
.dw mainLoop ; VBlank割り込みハンドラ(1/60秒毎にmainLoopがコールされる)
.dw Start ; リセット割り込み。起動時とリセットでStartに飛ぶ
.dw IRQ ; ハードウェア割り込みとソフトウェア割り込みによって発生
.bank 0 ; バンク0
.org $0300 ; $0300から開始、スプライトDMAデータ配置
Sprite1_Y: .db 0 ; スプライト#1 Y座標
Sprite1_T: .db 0 ; スプライト#1 ナンバー
Sprite1_S: .db 0 ; スプライト#1 属性
Sprite1_X: .db 0 ; スプライト#1 X座標
Sprite2_Y: .db 0 ; スプライト#1 Y座標
Sprite2_T: .db 0 ; スプライト#1 ナンバー
Sprite2_S: .db 0 ; スプライト#1 属性
Sprite2_X: .db 0 ; スプライト#1 X座標
.org $8000 ; $8000から開始
Start:
sei ; 割り込み不許可
cld ; デシマルモードフラグクリア
ldx #$ff
txs ; スタックポインタ初期化
; PPUコントロールレジスタ1初期化
lda #%00110000 ; ここではVBlank割り込み禁止
sta $2000
; VROMバンク切り替え
lda #2 ; バンク2
sta $8000
waitVSync:
lda $2002 ; VBlankが発生すると、$2002の7ビット目が1になる
bpl waitVSync ; bit7が0の間は、waitVSyncラベルの位置に飛んでループして待ち続ける
; PPUコントロールレジスタ2初期化
lda #%00000110 ; 初期化中はスプライトとBGを表示OFFにする
sta $2001
; パレットをロード
ldx #$00 ; Xレジスタクリア
; VRAMアドレスレジスタの$2006に、パレットのロード先のアドレス$3F00を指定する。
lda #$3F
sta $2006
lda #$00
sta $2006
loadPal: ; ラベルは、「ラベル名+:」の形式で記述
lda tilepal, x ; Aに(ourpal + x)番地のパレットをロードする
sta $2007 ; $2007にパレットの値を読み込む
inx ; Xレジスタに値を1加算している
cpx #32 ; Xを32(10進数。BGとスプライトのパレットの総数)と比較して同じかどうか比較している
bne loadPal ; 上が等しくない場合は、loadpalラベルの位置にジャンプする
; Xが32ならパレットロード終了
; スプライトDMA領域初期化(すべて0にする)
lda #0
ldx #$00
initSpriteDMA:
sta $0300, x
inx
bne initSpriteDMA
; ゼロページ初期化
lda #$00
ldx #$00
initZeroPage:
sta <$00, x
inx
bne initZeroPage
; 初期地形描画
; ViewAdr初期化($2000)
lda #$20
sta <ViewAdr_H
sta $2006
lda #$00
sta <ViewAdr_L
sta $2006
; マップの先頭アドレス設定
lda #high(Map_Tbl_Init)
sta <MapAdr_H
lda #low(Map_Tbl_Init)
sta <MapAdr_L
lda #32 ; ネームテーブル1ライン16*2セット
sta <View_Y ; とりあえずView_Yを使う
initField:
ldy <MapAdr_ofs ; オフセット
lda [MapAdr_L],y ; マップロード
pha ; Aを保存
lda <View_Y
and #1
bne initFieldSub ; View_Yが偶数ならネームテーブル上位、奇数なら下位
pla ; Aに復帰
; 上位を取得するので4回右シフトにする
lsr a
lsr a
lsr a
lsr a
jmp initFieldSub2
initFieldSub
; 下位取得
pla ; Aに復帰
and #$F
; 下位取得後にMapAdrオフセット加算
inc <MapAdr_ofs
initFieldSub2
; キャラ出力
; 2x2キャラなので4倍にする
asl a
asl a
clc
ldy <View_Y
cpy #17
bcs initFieldSub3
clc
adc #2 ; 2x2のうちの下の部分のキャラなので2加算する
initFieldSub3
; 2キャラ出力する
sta $2007
clc
adc #1 ; 1加算
sta $2007
dec <View_Y
lda <View_Y
beq initFieldEnter2 ; 2行描き終えた
cmp #16
bne initField
; ネームテーブル改行処理(1行描き終えた)
; MapAdrオフセットクリア
lda #0
sta <MapAdr_ofs
jmp initField
initFieldEnter2
; ネームテーブル改行処理(2行描き終えた)
inc <View_X
lda <View_X
cmp #15
beq initFieldEnd ; 15行出力したら終了
lda #32 ; ネームテーブル1ライン16*2セット
sta <View_Y
; MapAdr加算
lda <MapAdr_L
clc
adc <MapAdr_ofs ; オフセットを加算
adc #8 ; さらに画面外の分の8をスキップ
sta <MapAdr_L
bcc initFieldSub4
inc <MapAdr_H ; 桁上がり
initFieldSub4
lda #0
sta <MapAdr_ofs
jmp initField
initFieldEnd
; マップの先頭アドレスを再度設定して初期化
lda #high(Map_Tbl_Init)
sta <MapAdr_H
sta <MapAdrW_H
lda #low(Map_Tbl_Init)
sta <MapAdr_L
sta <MapAdrW_L
; 属性を初期化する
; $23C0から
lda #$23
sta $2006
lda #$C0
sta $2006
sta <Work_X
lda #8 ; 8回毎に改行
sta <Work_Y
initAttr
jsr setAttrib
sta $2007
inc <MapAdrW_L
lda <MapAdrW_L
bne initAttrSub
inc <MapAdrW_H ; 桁上がり
initAttrSub
dec <Work_Y
lda <Work_Y
sta $2004
sta $2004
sta $2004
lda #$04 ; アドレス4
sta $2003
lda #$00
sta $2004
sta $2004
sta $2004
sta $2004
; BGパレットとスプライトパレット書き換え
lda #$3F
sta $2006
lda #$01
sta $2006
lda #$30 ; 白
sta $2007
sta $2007
lda #$0F ; 黒
sta $2007
lda #$3F
sta $2006
lda #$10
sta $2006
lda #$0F ; 黒
sta $2007
; 属性初期化
jsr clearAttrib
; クマ表示
lda #$20
sta <KumaAdr_H
lda #$6B
sta <KumaAdr_L
ldx #0
putKumaSub:
lda <KumaAdr_H
sta $2006
lda <KumaAdr_L
sta $2006
putKumaSub2
stx $2007
inx
txa
and #$F
cmp #$9
bne putKumaSub2
lda <KumaAdr_L
clc
adc #$20 ; ネームテーブルを改行する
sta <KumaAdr_L
bcc putKumaSub3
inc <KumaAdr_H ; 桁上がり
putKumaSub3
txa
clc
adc #$7 ; キャラを改行する
tax
cpx #$E0 ; キャラを$D0まで出力する
bne putKumaSub
; 枠表示
lda #$22
sta $2006
lda #$28
sta $2006
ldx #$E
ldy #$FC ; 横線
putYokoWaku1
sty $2007
dex
bne putYokoWaku1
lda #$23
sta $2006
lda #$08
sta $2006
ldx #$E
putYokoWaku2
sty $2007
dex
bne putYokoWaku2
ldx #$47
ldy #$FD ; 縦線
putTateWaku1
lda #$22
sta $2006
stx $2006
sty $2007
txa
clc
adc #$20
tax
bcc putTateWaku1 ; 面倒なんで桁上がりするまで
ldx #$56
putTateWaku2
lda #$22
sta $2006
stx $2006
sty $2007
txa
clc
adc #$20
tax
bcc putTateWaku2 ; 面倒なんで桁上がりするまで
; 左上
lda #$22
sta $2006
lda #$27
sta $2006
lda #$EE
sta $2007
; 右上
lda #$22
sta $2006
lda #$36
sta $2006
lda #$EF
sta $2007
; 左下
lda #$23
sta $2006
lda #$07
sta $2006
lda #$FE
sta $2007
; 右下
lda #$23
sta $2006
lda #$16
sta $2006
lda #$FF
sta $2007
; 「くまが あらわれた!」
lda #$22
sta $2006
lda #$48
sta $2006
ldx #$E0
putKumaAppeared
stx $2007
inx
cpx #$E9
bne putKumaAppeared
rts
clearNameTbl:
; ネームテーブル0クリア
; ネームテーブルの$2000から
lda #$20
sta $2006
lda #$00
sta $2006
lda #$00 ; 0番(透明)
ldx #240 ; 240回繰り返す
ldy #4 ; それを4回、計960回繰り返す
clearNameTblSub
sta $2007
dex
bne clearNameTblSub
ldx #240
dey
bne clearNameTblSub
rts
clearAttrib:
; 属性初期化
lda #$23
sta $2006
lda #$C0
sta $2006
ldx #$00 ; Xレジスタクリア
lda #0 ; 4つともパレット0番
clearAttribSub
sta $2007 ; $2007に属性の値を読み込む
; 64回(全キャラクター分)ループする
inx
cpx #64
bne clearAttribSub
rts
IRQ:
rti
; 初期データ
.org $9000 ; $9000から開始
tilepal: .incbin "giko6.pal" ; パレットをincludeする
; マップデータ(32x32)
Map_Tbl: .include "giko019map.txt"
.bank 2 ; バンク2
.org $0000 ; $0000から開始
.incbin "giko4.spr" ; スプライトデータ
.incbin "giko7.bkg" ; 地形BGデータ
.bank 3 ; バンク3
.org $0000 ; $0000から開始
.incbin "giko4.spr" ; スプライトデータ
.incbin "giko8.bkg" ; 敵&メッセージBGデータ |
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_ix/fmod.asm | jpoikela/z88dk | 640 | 3726 |
SECTION code_clib
SECTION code_fp_math48
PUBLIC _fmod
EXTERN cm48_sdccix_fmod
defc _fmod = cm48_sdccix_fmod
|
workshop/tests/src/workshop_suite.ads | TNO/Rejuvenation-Ada | 0 | 24453 | <reponame>TNO/Rejuvenation-Ada
with AUnit.Test_Suites; use AUnit.Test_Suites;
package Workshop_Suite is
function Suite return Access_Test_Suite;
end Workshop_Suite;
|
data/wildPokemon/waterpokemon.asm | AmateurPanda92/pokemon-rby-dx | 9 | 84593 | WaterMons:
db $00
db $05
db 5,TENTACOOL
db 10,TENTACOOL
db 15,TENTACOOL
db 5,TENTACOOL
db 10,TENTACOOL
db 15,TENTACOOL
db 20,TENTACOOL
db 30,TENTACOOL
db 35,TENTACOOL
db 40,TENTACOOL
|
programs/oeis/192/A192762.asm | neoneye/loda | 0 | 10135 | ; A192762: Coefficient of x in the reduction by x^2->x+1 of the polynomial p(n,x) defined below in Comments.
; 0,1,6,13,26,47,82,139,232,383,628,1025,1668,2709,4394,7121,11534,18675,30230,48927,79180,128131,207336,335493,542856,878377,1421262,2299669,3720962,6020663,9741658,15762355,25504048,41266439,66770524
seq $0,179991 ; Nonhomogeneous three-term sequence a(n) = a(n-1) + a(n-2) + n.
sub $0,2
|
src/kernel/interrupts/irqs_handler.asm | thpertic/LostOS | 8 | 11123 | <filename>src/kernel/interrupts/irqs_handler.asm
; define a macro, taking one parameter
; %1 accesses the first parameter, %2 the second.
%macro IRQ 2
global irq%1
irq%1:
cli
push byte 0 ; Note that these don't push an error code on the stack:
; We need to push a dummy error code
push byte %2
jmp irq_common_stub
%endmacro
IRQ 0, 32
IRQ 1, 33
IRQ 2, 34
IRQ 3, 35
IRQ 4, 36
IRQ 5, 37
IRQ 6, 38
IRQ 7, 39
IRQ 8, 40
IRQ 9, 41
IRQ 10, 42
IRQ 11, 43
IRQ 12, 44
IRQ 13, 45
IRQ 14, 46
IRQ 15, 47
extern irq_faultHandler
; This is a stub that has been created for IRQ.
; This calls 'irq_faultHandler()' in the C code.
irq_common_stub:
; Push the registers and the segments on the stack
pusha
push ds
push es
push fs
push gs
; Load the segments with the kernel's segments
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
push esp
call irq_faultHandler
; Restore the stack
pop eax ; Not using esp because there's no guarantee the passed value was preserved by the call
pop gs
pop fs
pop es
pop ds
popa
add esp, 8
iret |
src/third_party/nasm/test/br3385573.asm | Mr-Sheep/naiveproxy | 2,219 | 99294 | ;Testname=unoptimized; Arguments=-O0 -fbin -obr3385573.bin; Files=stdout stderr br3385573.bin
;Testname=optimized; Arguments=-Ox -fbin -obr3385573.bin; Files=stdout stderr br3385573.bin
[bits 64]
vpmovsxbw ymm1, xmm2
vpsllw ymm1, ymm2, 3
vpslld ymm1, ymm2, 3
vpsllq ymm1, ymm2, 3
vpsrld ymm1, ymm2, 3
vpsrad ymm1, ymm2, 3
vpermq ymm1, [rsi], 9
|
libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_insert_callee.asm | meesokim/z88dk | 0 | 94101 | <reponame>meesokim/z88dk
; size_t b_array_insert(b_array_t *a, size_t idx, int c)
SECTION code_adt_b_array
PUBLIC b_array_insert_callee
b_array_insert_callee:
pop hl
pop de
pop bc
ex (sp),hl
INCLUDE "adt/b_array/z80/asm_b_array_insert.asm"
|
externalhooks.asm | Catobat/z3randomizer | 26 | 96718 | <filename>externalhooks.asm
org $298000 ; 0x148000
Ext_OnFileCreate: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnFileLoad: ;x immediately after load
RTL : RTL : RTL : RTL : RTL
Ext_OnFileSave: ;x immediately before save
RTL : RTL : RTL : RTL : RTL
Ext_OnPlayerDeath: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnMapUse: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnFairyRevive: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnYItemUse: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnIemMenuOpen: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnItemMenuClose: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnItemChange: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnPlayerDamaged: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnPlayerAttack: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnBossDeath: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnDungeonEnter: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnDungeonExit: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnDungeonCompleted: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnZeldaRescued: ;x
RTL : RTL : RTL : RTL : RTL
|
HW4-Ramtin/Q2/MiniJava.g4 | ramtin-ehsani/IUSTCompiler | 0 | 3641 | grammar MiniJava;
program:
mainClass (classDeclaration)* EOF;
// parser rules
mainClass:
'class' ID '{' PUBLIC STATIC VOID MAIN '(' STRING '[' ']' ID ')' '{' statement '}' '}';
classDeclaration:
'class' ID (EXTENDS ID)? '{' (varDeclaration)* (methodDeclaration)* '}';
varDeclaration:
type_t ID ';';
methodDeclaration:
PUBLIC type_t ID '(' (type_t ID (',' type_t ID)*)? ')' '{' (varDeclaration)* (statement)* RETURN expression ';' '}';
type_t:
INT '[' ']'
| BOOLEAN
| INT
| ID
;
statement: '{' (statement)* '}'
| IF '(' expression ')' statement ELSE statement
| WHILE '(' expression ')' statement
| 'System.out.println' '(' expression ')' ';'
| ID '=' expression ';'
| ID '[' expression ']' '=' expression ';'
;
expression : expression '&&' expression
| expression '<' expression
| expression ('+' | '-') expression
| expression '*' expression
| expression '[' expression ']'
| expression '.' LENGTH
| expression '.' ID '(' (expression (',' expression)*)? ')'
| INT_VAL
| TRUE
| FALSE
| ID
| THIS
| NEW INT '[' expression ']'
| NEW ID '(' ')'
| '!' expression
| '(' expression ')'
;
// Keywords
BOOLEAN : 'boolean';
CLASS : 'class';
ELSE : 'else';
EXTENDS : 'extends';
FALSE : 'false';
IF : 'if';
INT : 'int';
LENGTH : 'length';
MAIN : 'main';
NEW : 'new';
PUBLIC : 'public';
RETURN : 'return';
STATIC : 'static';
STRING : 'String';
THIS : 'this';
TRUE : 'true';
VOID : 'void';
WHILE : 'while';
// Operators
ASSIGN : '=';
GT : '>';
LT : '<';
GE : '>=';
LE : '<=';
PLUS : '+';
MINUS : '-';
TIMES : '*';
BANG : '!';
AND : '&&';
OR : '||';
// Separators
L_PAREN : '(';
R_PAREN : ')';
L_BRACK : '[';
R_BRACK : ']';
L_BRACE : '{';
R_BRACE : '}';
COMMA : ',';
DOT : '.';
SEMI : ';';
// Identifier
ID : LETTER (LETTER | DIGIT)*;
INT_VAL : ('0' | [1-9] DIGIT*);
fragment
LETTER : [a-zA-Z_];
fragment
DIGIT : [0-9];
// whitespaces and comments
WS : [ \t\r\n]+ -> skip ;
COMMENT : '/*' .*? '*/' -> skip;
LINE_COMMENT: '//' ~[\r\n]* -> skip; |
ASS4/sqrt (q3).asm | rahulkumawat1/NASM | 0 | 4338 | <filename>ASS4/sqrt (q3).asm
section .text
global main
extern scanf
extern printf
print:
push ebp
mov ebp, esp
sub esp, 8
fst qword[ebp-8]
push format2
call printf
mov esp, ebp
pop ebp
ret
read:
push ebp
mov ebp, esp
sub esp, 8
lea eax, [esp]
push eax
push format1
call scanf
fld qword[ebp-8]
mov esp, ebp
pop ebp
ret
readnat:
push ebp
mov ebp, esp
sub esp , 2
lea eax , [ebp-2]
push eax
push format3
call scanf
mov ax, word[ebp-2]
mov word[num], ax
mov esp, ebp
pop ebp
ret
read_float:
push ebp
mov ebp, esp
sub esp, 8
lea eax, [esp]
push eax
push format1
call scanf
fld qword[ebp - 8]
mov esp, ebp
pop ebp
ret
print_float:
push ebp
mov ebp, esp
sub esp, 8
fst qword[ebp - 8]
push format2
call printf
mov esp, ebp
pop ebp
ret
main:
mov eax,4
mov ebx,1
mov ecx,msg1
mov edx,len1
int 80h
call read_float
fstp qword[float1]
fld qword[i]
for:
fst qword[temp]
fmul qword[temp]
fcom qword[float1]
fstsw ax
sahf
ja end
fstp qword[float2]
fld qword[temp]
fadd qword[x]
jmp for
end:
fstp qword[float2]
fld qword[temp]
fsub qword[x]
call print_float
ffree st0
ffree st1
fld qword[float1]
fsqrt
call print_float
exit:
mov eax, 1
mov ebx, 0
int 80h
section .data
format1: db "%lf",0
format2: db "The square root is %lf",10
format3: db "%d", 0
msg1: db "Enter the no : "
len1: equ $-msg1
x: dq 0.001
i: dq 0.001
section .bss
float1: resq 1
float2: resq 1
m: resq 1
num: resw 1
num2: resw 1
temp: resq 1
|
src/Shopify.g4 | k----n/ShopifyWintership2017 | 0 | 6209 | <gh_stars>0
grammar Shopify;
/**
Generator grammar for shopify's specific json structure
Copyright 2016 <NAME>, <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Taken from "The Definitive ANTLR 4 Reference" by <NAME>
Modified to support Shopify's specific json structure
*/
// Derived from http://json.org
init
:'{"products":' ('[' item (',' item)* ']' | '[' ']')
;
item
: '{' pair (',' pair)* '}'
| '{' '}'
;
object
: '{' pair (',' pair)* '}'
| '{' '}'
;
pair:
'"product_type":' value #Producttype_
|'"price":' value # Price_
|'"available":' value # Availability_
| STRING ':' value # Normal_
;
array
: '[' value (',' value)* ']'
| '[' ']'
;
value
: STRING
| NUMBER
| object
| array
| 'true'
| 'false'
| 'null'
;
STRING
: '"' (ESC | ~ ["\\])* '"'
;
fragment ESC
: '\\' (["\\/bfnrt] | UNICODE)
;
fragment UNICODE
: 'u' HEX HEX HEX HEX
;
fragment HEX
: [0-9a-fA-F]
;
NUMBER
: '-'? INT '.' [0-9] + EXP? | '-'? INT EXP | '-'? INT
;
fragment INT
: '0' | [1-9] [0-9]*
;
// no leading zeros
fragment EXP
: [Ee] [+\-]? INT
;
// \- since - means "range" inside [...]
WS
: [ \t\n\r] + -> skip
; |
programs/oeis/011/A011001.asm | karttu/loda | 1 | 80860 | ; A011001: Binomial coefficient C(n,48).
; 1,49,1225,20825,270725,2869685,25827165,202927725,1420494075,8996462475,52179482355,279871768995,1399358844975,6566222272575,29078984349975,122131734269895,488526937079580,1867897112363100,6848956078664700,24151581961607100
add $0,48
mov $1,$0
bin $1,48
|
src/asf-responses-mockup.ads | Letractively/ada-asf | 0 | 14832 | -----------------------------------------------------------------------
-- asf.responses.mockup -- ASF Response mockup
-- Copyright (C) 2010, 2011 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
private with Util.Streams.Texts;
private with Util.Strings.Maps;
-- The <b>ASF.Responses.Mockup</b> provides a fake response object to simulate
-- an HTTP response.
package ASF.Responses.Mockup is
-- ------------------------------
-- Response Mockup
-- ------------------------------
-- The response mockup implements a fake HTTP response object
type Response is new ASF.Responses.Response with private;
-- Returns a boolean indicating whether the named response header has already
-- been set.
function Contains_Header (Resp : in Response;
Name : in String) return Boolean;
-- Iterate over the response headers and executes the <b>Process</b> procedure.
procedure Iterate_Headers (Resp : in Response;
Process : not null access
procedure (Name : in String;
Value : in String));
-- Sets a response header with the given name and value. If the header had already
-- been set, the new value overwrites the previous one. The containsHeader
-- method can be used to test for the presence of a header before setting its value.
procedure Set_Header (Resp : in out Response;
Name : in String;
Value : in String);
-- Adds a response header with the given name and value.
-- This method allows response headers to have multiple values.
procedure Add_Header (Resp : in out Response;
Name : in String;
Value : in String);
-- Returns the value of the specified response header as a String. If the response
-- did not include a header of the specified name, this method returns null.
-- If there are multiple headers with the same name, this method returns the
-- first head in the response. The header name is case insensitive. You can use
-- this method with any response header.
function Get_Header (Resp : in Response;
Name : in String) return String;
-- Get the content written to the mockup output stream.
procedure Read_Content (Resp : in out Response;
Into : out Ada.Strings.Unbounded.Unbounded_String);
-- Clear the response content.
-- This operation removes any content held in the output stream, clears the status,
-- removes any header in the response.
procedure Clear (Resp : in out Response);
private
-- Initialize the response mockup output stream.
overriding
procedure Initialize (Resp : in out Response);
type Response is new ASF.Responses.Response with record
Content : aliased Util.Streams.Texts.Print_Stream;
Headers : Util.Strings.Maps.Map;
end record;
end ASF.Responses.Mockup;
|
programs/oeis/022/A022841.asm | karttu/loda | 0 | 14260 | ; A022841: Beatty sequence for sqrt(7).
; 2,5,7,10,13,15,18,21,23,26,29,31,34,37,39,42,44,47,50,52,55,58,60,63,66,68,71,74,76,79,82,84,87,89,92,95,97,100,103,105,108,111,113,116,119,121,124,126,129,132,134,137,140,142,145,148,150,153,156,158,161,164,166,169,171,174,177,179,182,185,187,190,193,195,198,201,203,206,209,211,214,216,219,222,224,227,230,232,235,238,240,243,246,248,251,253,256,259,261,264,267,269,272,275,277,280,283,285,288,291,293,296,298,301,304,306,309,312,314,317,320,322,325,328,330,333,336,338,341,343,346,349,351,354,357,359,362,365,367,370,373,375,378,380,383,386,388,391,394,396,399,402,404,407,410,412,415,418,420,423,425,428,431,433,436,439,441,444,447,449,452,455,457,460,463,465,468,470,473,476,478,481,484,486,489,492,494,497,500,502,505,507,510,513,515,518,521,523,526,529,531,534,537,539,542,545,547,550,552,555,558,560,563,566,568,571,574,576,579,582,584,587,590,592,595,597,600,603,605,608,611,613,616,619,621,624,627,629,632,634,637,640,642,645,648,650,653,656,658,661
add $0,1
pow $0,2
mul $0,7
mov $1,3
lpb $0,1
trn $0,$1
add $1,2
lpe
sub $1,7
div $1,2
add $1,2
|
src/Projects/eu_projects-node_tables.adb | fintatarta/eugen | 0 | 10648 | <reponame>fintatarta/eugen<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
package body EU_Projects.Node_Tables is
procedure Dump (T : Node_Table) is
use Node_Maps;
begin
for Pos in T.Table.Iterate loop
Put_Line (EU_Projects.Nodes.To_String(Key (Pos)) & ":");
end loop;
end Dump;
------------
-- Insert --
------------
procedure Insert
(T : in out Node_Table;
ID : Nodes.Node_Label;
Item : Nodes.Node_Access)
is
begin
T.Table.Insert (Key => ID,
New_Item => Item);
exception
when Constraint_Error =>
raise Duplicated_Label;
end Insert;
---------------
-- Labels_Of --
---------------
function Labels_Of (T : Node_Table;
Class : Nodes.Node_Class)
return Nodes.Node_Label_Lists.Vector
is
use Node_Maps;
use type Nodes.Node_Class;
Result : Nodes.Node_Label_Lists.Vector;
begin
for Pos in T.Table.Iterate loop
if Nodes.Class (Element (Pos).all) = Class then
Result.Append (Key (Pos));
end if;
end loop;
return Result;
end Labels_Of;
end EU_Projects.Node_Tables;
|
KEK/Source/Macosx-amd64/Window.asm | MarcasRealAccount/VulkanInAssemblyWHYYYYY | 3 | 4378 | %include "Common.asminc"
%if BUILD_IS_SYSTEM_MACOSX && BUILD_IS_PLATFORM_AMD64
%include "Macosx-amd64/LibC.asminc"
%include "Macosx-amd64/GLFW.asminc"
%include "Macosx-amd64/Logger.asminc"
%include "Macosx-amd64/Window.asminc"
extern _AppLogger
section .rodata
GLFWErrorFormat: db "GLFW (%d) => %s", 0
section .data
GlobalLabel _WindowCount, { dq 0 }
section .text
StaticLabel GLFWErrorCallback ; edi => errorCode, rsi => message
mov rdx, rdi
mov rcx, rsi
lea rdi, [GLFWErrorFormat]
lea rsi, [_AppLogger]
jmp _LoggerLogError
GlobalLabel _WindowAlloc
mov rdi, Window_size
jmp _malloc
GlobalLabel _WindowFree ; rdi => window
jmp _free
GlobalLabel _WindowCtor ; rdi => window, esi => width, edx => height, rcx => title
mov dword[rdi + Window.width], esi
mov dword[rdi + Window.height], edx
mov qword[rdi + Window.title], rcx
mov qword[rdi + Window.windowPtr], 0
ret
GlobalLabel _WindowDtor ; rdi => window
cmp qword[rdi + Window.windowPtr], 0
je .exit
jmp _WindowDestroy
.exit:
ret
GlobalLabel _WindowCreate ; rdi => window
cmp qword[rdi + Window.windowPtr], 0
je .continue
ret
.continue:
push rbp
mov rbp, rsp
sub rsp, 10h
mov [rsp], rdi
cmp qword[_WindowCount], 0
jne .skipInit
lea rdi, [GLFWErrorCallback]
call _glfwSetErrorCallback
call _glfwInit
cmp rax, 0
je .exit
.skipInit:
call _glfwDefaultWindowHints
mov edi, 22001h
mov esi, 0
call _glfwWindowHint
mov edi, 20003h
mov esi, 1
call _glfwWindowHint
mov rax, [rsp]
mov edi, [rax + Window.width]
mov esi, [rax + Window.height]
mov rdx, [rax + Window.title]
mov rcx, 0
mov r8, 0
call _glfwCreateWindow
cmp eax, 0
je .exit
mov rcx, [rsp]
mov [rcx + Window.windowPtr], rax
add qword[_WindowCount], 1
.exit:
mov rsp, rbp
pop rbp
ret
GlobalLabel _WindowDestroy ; rdi => window
cmp qword[rdi + Window.windowPtr], 0
jne .continue
ret
.continue:
push rbp
mov rbp, rsp
sub rsp, 10h
mov [rsp], rdi
mov rdi, [rdi + Window.windowPtr]
call _glfwDestroyWindow
mov rcx, [rsp]
mov qword[rcx + Window.windowPtr], 0
sub qword[_WindowCount], 1
cmp qword[_WindowCount], 0
jne .exit
call _glfwTerminate
.exit:
mov rsp, rbp
pop rbp
ret
GlobalLabel _WindowGetNative ; rdi => window
mov rax, [rdi + Window.windowPtr]
ret
GlobalLabel _WindowShouldClose ; rdi => window
mov rdi, [rdi + Window.windowPtr]
jmp _glfwWindowShouldClose
GlobalLabel _WindowsUpdate
jmp _glfwPollEvents
%endif |
libsrc/video/tms9918/gen_set_mode.asm | ahjelm/z88dk | 4 | 178110 | <reponame>ahjelm/z88dk
;
; z88dk library: Generic VDP support code
;
; extern void __FASTCALL__ msx_set_mode(unsigned char id);
;
; set screen mode
;
; $Id: gen_set_mode.asm $
;
SECTION code_clib
PUBLIC msx_set_mode
PUBLIC _msx_set_mode
INCLUDE "video/tms9918/vdp.inc"
EXTERN SETWRT
EXTERN FILVRM
EXTERN RG0SAV
EXTERN CONSOLE_COLUMNS
EXTERN l_tms9918_disable_interrupts
EXTERN l_tms9918_enable_interrupts
EXTERN __tms9918_screen_mode
EXTERN __tms9918_attribute
EXTERN __tms9918_border
EXTERN __tms9918_set_font
EXTERN __tms9918_pattern_name
EXTERN __tms9918_pattern_generator
EXTERN __console_w
EXTERN generic_console_caps
EXTERN __tms9918_CAPS_MODE0
EXTERN __tms9918_CAPS_MODE1
EXTERN __tms9918_CAPS_MODE2
msx_set_mode:
_msx_set_mode:
ld a,l
ld hl,__tms9918_screen_mode
and a
jr z,init_mode1
cp 1
jr z,init_mode0
cp 2
jp z,init_mode2
ret
; VDP Mode 0: 32x24
init_mode0:
ld (hl),a
; MSX: $00,$F0,$00,$00,$01,$00,$00,$F4
; SVI: $00,$F0,$00,$FF,$01,$36,$07,$F4
; SC3: $00,$F0,$0F,$FF,$03,$76,$03,$13
; MTX: $00,$D0,$07,$00,$03,$7E,$07
call clear_sprites
; reg0 - TEXT MODE
ld e,$00
IF FORm5___2
ld a,1 ; external video flag bit must be set on M5
ELSE
xor a ; .. and reset on the other targets
ENDIF
call VDPreg_Write
ld e,$01
ld a,$E0
call VDPreg_Write ; reg1 - text MODE
ld a,$06 ; $1800 (character map, 768 bytes)
call VDPreg_Write ; reg2 - NAME TABLE
ld a,$80 ; $2000 - Colour table is 32 bytes long
call VDPreg_Write ; reg3 - COLOUR TABLE
ld a,$00 ; $0000 - Where the font will go
call VDPreg_Write ; reg4 - PT./TXT/MCOL-GEN.TAB.
ld a,$36 ; $1b00
call VDPreg_Write ; reg5 - SPRITE ATTR. TAB.
ld a,$07 ; $3800
call VDPreg_Write ; reg6 - SPRITE PATTERN GEN. TAB.
ld a,(__tms9918_border)
and 15
call VDPreg_Write ; reg7 - INK & PAPER-/BACKDROPCOL.
ld a,__tms9918_CAPS_MODE0
ld (generic_console_caps),a
ld a,CONSOLE_COLUMNS ;Needs to be overridden by ANSI
ld (__console_w),a
ld hl,$1800
ld (__tms9918_pattern_name),hl
ld hl,$0000
ld (__tms9918_pattern_generator),hl
ld hl,$1800 ;Clear the name table
ld bc,768
ld a,32
call FILVRM
; Set the colour for all characters
ld a,(__tms9918_attribute)
ld hl,$2000
ld bc,32
call FILVRM
call __tms9918_set_font
ret
clear_sprites:
ld hl,$3800
ld bc,2048
xor a
call FILVRM
ret
; Switch 2 VDP Mode 1
; 40x24
init_mode1:
ld (hl),a
call clear_sprites
; reg0 - TEXT MODE
ld e,$00
IF FORm5___2
ld a,1 ; external video flag bit must be set on M5
ELSE
xor a ; .. and reset on the other targets
ENDIF
call VDPreg_Write
ld e,$01
ld a,$F0
call VDPreg_Write ; reg1 - text MODE
xor a ; $0000 (960 bytes long)
call VDPreg_Write ; reg2 - NAME TABLE
ld a,$80 ; Unused (no colour)
call VDPreg_Write ; reg3 - COLOUR TABLE
ld a,$01 ; $800 - Where the font will go
call VDPreg_Write ; reg4 - PT./TXT/MCOL-GEN.TAB.
ld a,$36 ; Unused (sprites inactive)
call VDPreg_Write ; reg5 - SPRITE ATTR. TAB.
ld a,$07 ; Unused (sprites inactive)
call VDPreg_Write ; reg6 - SPRITE PATTERN GEN. TAB.
ld a,(__tms9918_attribute)
call VDPreg_Write ; reg7 - INK & PAPER-/BACKDROPCOL.
ld a,__tms9918_CAPS_MODE1
ld (generic_console_caps),a
ld a,40
ld (__console_w),a
ld hl,$800
ld (__tms9918_pattern_generator),hl
ld hl,$0000
ld (__tms9918_pattern_name),hl
ld bc,1024
ld a,32
call FILVRM
call __tms9918_set_font
ret
;
; -- Thanks to <NAME> his initial hints --
;
; Switch 2 Video Mode n. 2
;»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
init_mode2:
ld (hl),a
call clear_sprites
;»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
; SVI: $02,$E0,$06,$FF,$03,$36,$07,$07
; MSX: $02,$E0,$06,$FF,$03,$36,$07,$04
; SC3: $02,$E0,$0E,$FF,$03,$76,$03,$05
; SC3B: $02,$E2,$0E,$FF,$03,$76,$03,$00
; EINS: $02,$C0,$0E,$FF,$03,$76,$03,$F4 $0F for backdrop color = WHITE
; MTX: $02,$C0,$0F,$FF,$03,$7E,$07
; MTXb: $02,$C2,$0F,$FF,$03,$73,$07,$F3
; MTXc: $02,$E2,$06,$FF,$03,$38,$07,$01 ; astropac
; MTXd: $02,$C2,$06,$FF,$03,$38,$07,$01 ; kilopede
; M5: $02,$E2,$06,$FF,$03,$36,$07,$61
; M5: $03,$A2,$0E,$FF,$03,$76,$03,$11 ; name table at 3800 in place of 1800
; PV2: $02,$82,$07,$ff,$03,$3e,$03,$f0 ; and then r1 = e2
; Compare example from MSX emulator for M5,
; on reg#0 of the SORD M5, external video flag bit must be set
; msx: 02 62 11 23 21 33 11 E0
; M5: 03 E2 11 23 21 33 11 E1
; Final state: 02 e0 06 ff 03 76 03 00
;
;0000 - 17ff = PG Pattern Generator
;1800 - 1b00 = PN Pattern Name
;2000 - 3800 = CT Colour
;3800 = Sprite
;1b00 = Sprite attribute
; reg1 - GRAPH MODE, first reset bit #6 to blank the screen
ld e,$01
xor a ; bit 7 must be reset on sc3000
call VDPreg_Write
; reg2 - NAME TABLE
ld a,$06 ; $1800
call VDPreg_Write
; reg3 - COLOUR TABLE
ld a,$FF ; bit 7 set -> $2000
call VDPreg_Write
; reg4 - PT./TXT/MCOL-GEN.TAB.
ld a,$03 ; bit 2 reset -> $0000
call VDPreg_Write
; reg5 - SPRITE ATTR. TAB.
ld a,$36 ;$1b00
call VDPreg_Write
; reg6 - SPRITE PATTERN GEN. TAB.
ld a,$07 ; $3800
call VDPreg_Write
; reg7 - INK & PAPER-/BACKDROPCOL.
ld a,(__tms9918_border)
and 15
call VDPreg_Write
; reg0 - GRAPH MODE
ld e,$00
IF FORm5
ld a,$03 ; set bit 0 on m5___2 (to be confirmed)
ELSE
ld a,$02 ; .. and reset on the other targets
ENDIF
call VDPreg_Write
; reg1 - GRAPH MODE
; (it was first set to $80)
;ld a,$E2 ; MTX, M5
IF FORadam
ld a,$D0 ;Disable interrupt on Adam
ELSE
ld a,$E0 ; MTX, M5
ENDIF
call VDPreg_Write
; Pattern table should probably be initialized on other targets as well,
; Memotech MTX does not seem to require the initialization (discovered experimentally)
; SETWRT on the M5 sets C correctly on exit, it may be differente elsewhere
ld hl,$1800
call SETWRT
IF VDP_DATA >= 0
ld bc,VDP_DATA
ENDIF
xor a
ld e,3
pattern:
IF VDP_DATA < 0
ld (-VDP_DATA),a
ELSE
out (c),a
ENDIF
inc a
jr nz,pattern
dec e
jr nz,pattern
ld a,__tms9918_CAPS_MODE2
ld (generic_console_caps),a
ld a,CONSOLE_COLUMNS
ld (__console_w),a
ld bc,6144 ; set VRAM attribute area
ld a,(__tms9918_attribute) ; white on black
ld hl,8192
push bc
call FILVRM
pop bc
xor a ; clear graphics page
ld h,a
ld l,a
jp FILVRM
; Switch 2 Video Mode n. 3
inimlt:
; On MTX, a game sets the 16 colours mode as follows:
; -- graph mode (reg0=2)
; reg1 - c2
; reg2 - 06 -- bit 0 and 3 are toggled ??
; reg3 - ff
; reg4 - 03
; reg5 - 38
; reg6 - 07
; reg7 - 01
ret
; *** WRTVDP ***
; Copy a value into VDP reg
; IN: E = reg, A = val
;»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
VDPreg_Write:
;»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
ld d,a
call l_tms9918_disable_interrupts
ld a,d
IF VDP_CMD < 0
ld (-VDP_CMD),a
ELSE
ld bc,VDP_CMD
out (c),a
ENDIF
ld a,e
and $07
or $80 ; enable bit for "set register" command
IF VDP_CMD < 0
ld (-VDP_CMD),a
ELSE
out (c),a
ENDIF
push hl
ld a,d
ld hl,RG0SAV
ld d,0
add hl,de
ld (hl),a
pop hl
inc e
call l_tms9918_enable_interrupts
ret
;Reg/Bit 7 6 5 4 3 2 1 0
;0 - - - - - - M2 EXTVID
;1 4/16K BL GINT M1 M3 - SI MAG
;2 - - - - PN13 PN12 PN11 PN10 * $400
;3 CT13 CT12 CT11 CT10 CT9 CT8 CT7 CT6 * $40
;4 - - - - - - PG13 PG12 PG11 * $800
;5 - SA13 SA12 SA11 SA10 SA9 SA8 SA7 * $80
;6 - - - - - SG13 SG12 SG11 * $800
;7 TC3 TC2 TC1 TC0 BD3 BD2 BD1 BD0
;
;STATUS INT 5S C FS4 FS3 FS2 FS1 FS0
;
;M1,M2,M3 Select screen mode
;EXTVID Enables external video input.
;4/16K Selects 16kB RAM if set. No effect in MSX1 system.
;BL Blank screen if reset; just backdrop. Sprite system inactive
;SI 16x16 sprites if set; 8x8 if reset
;MAG Sprites enlarged if set (sprite pixels are 2x2)
;GINT Generate interrupts if set
;PN* Address for pattern name table
;CT* Address for colour table (special meaning in M2)
;PG* Address for pattern generator table (special meaning in M2)
;SA* Address for sprite attribute table
;SG* Address for sprite generator table
;TC* Text colour (foreground)
;BD* Back drop (background). Sets the colour of the border around
; the drawable area. If it is 0, it is black (like colour 1).
;FS* Fifth sprite (first sprite that's not displayed). Only valid
; if 5S is set.
;C Sprite collision detected
;5S Fifth sprite (not displayed) detected. Value in FS* is valid.
;INT Set at each screen update, used for interrupts.
|
src/test/resources/antlr_tests/LangParser.g4 | filip1097/LineCounter | 0 | 7412 | parser grammar LangParser;
@header{
import ast.ASTNode;
import ast.Opt;
import astbuilder.ASTBuilder;
}
@parser::members {
private ASTBuilder ast = new ASTBuilder(this);
/**
* This method returns the AST built by the parser.
* @return the ast.
*/
public ASTNode getAST() {
return ast.peek();
}
}
options { tokenVocab=LangScanner; }
/* Other */
attrList : ( 'xmlns' EQ ignoreString
| 'xmlns:i' EQ ignoreString
| 'i:nil' EQ ignoreString )*;
ignoreString : String;
/*--------CODE--------*/
codeBlock : stmtList;
/* stmt */
// add more stmts
|
programs/oeis/014/A014796.asm | karttu/loda | 1 | 83105 | ; A014796: Squares of even tetrahedral numbers (A015220).
; 16,100,400,3136,7056,14400,48400,81796,132496,313600,462400,665856,1299600,1768900,2371600,4096576,5290000,6760000,10732176,13351716,16483600,24601600,29767936,35808256,50979600,60372900,71166096
mov $1,4
mov $2,$0
add $2,3
mul $1,$2
div $1,3
bin $1,3
pow $1,2
mul $1,2
sub $1,32
div $1,8
mul $1,4
add $1,16
|
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48.log_21829_2025.asm | ljhsiun2/medusa | 9 | 164978 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r9
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x615d, %r9
nop
nop
cmp %r14, %r14
movb $0x61, (%r9)
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_UC_ht+0x154a1, %rsi
lea addresses_A_ht+0xe5c1, %rdi
cmp $47740, %rbp
mov $28, %rcx
rep movsw
nop
nop
cmp %rbx, %rbx
lea addresses_normal_ht+0xa165, %r9
clflush (%r9)
and %rbx, %rbx
movb (%r9), %cl
nop
nop
nop
sub %rbx, %rbx
lea addresses_D_ht+0xd4f9, %r14
nop
nop
nop
nop
and $28864, %rsi
mov (%r14), %bx
nop
nop
nop
nop
add $61721, %rdi
lea addresses_normal_ht+0x18999, %rcx
nop
nop
nop
and %rbp, %rbp
mov (%rcx), %bx
nop
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_WT_ht+0x1d7e8, %r14
clflush (%r14)
nop
nop
nop
nop
nop
add $54129, %rbp
movups (%r14), %xmm2
vpextrq $1, %xmm2, %rbx
nop
nop
dec %rsi
lea addresses_D_ht+0x59a1, %rsi
lea addresses_D_ht+0x5321, %rdi
nop
nop
add $25469, %rbx
mov $102, %rcx
rep movsw
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x18721, %rsi
nop
nop
nop
sub %r9, %r9
movl $0x61626364, (%rsi)
sub $52736, %rbx
lea addresses_UC_ht+0xd8a1, %rcx
nop
sub %r14, %r14
mov $0x6162636465666768, %rbp
movq %rbp, (%rcx)
nop
nop
and %rbp, %rbp
lea addresses_WT_ht+0xcd81, %rsi
lea addresses_WC_ht+0xf2a1, %rdi
nop
nop
nop
nop
nop
cmp %r13, %r13
mov $108, %rcx
rep movsw
nop
nop
nop
nop
nop
xor %rbp, %rbp
lea addresses_UC_ht+0x164a7, %r14
nop
nop
dec %r9
movl $0x61626364, (%r14)
nop
nop
add $29576, %r13
lea addresses_WC_ht+0x18e1, %rsi
lea addresses_A_ht+0x17881, %rdi
clflush (%rdi)
nop
nop
nop
nop
and $42184, %r14
mov $32, %rcx
rep movsq
nop
dec %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %r9
push %rax
push %rbx
push %rsi
// Store
mov $0x361, %rbx
nop
nop
nop
nop
nop
xor %rsi, %rsi
movb $0x51, (%rbx)
nop
nop
nop
add %rax, %rax
// Load
lea addresses_A+0x114a1, %rax
nop
nop
nop
nop
nop
sub %r12, %r12
movb (%rax), %r11b
nop
nop
xor %rbx, %rbx
// Store
lea addresses_RW+0x1a2a1, %rsi
nop
add $43496, %r15
mov $0x5152535455565758, %rbx
movq %rbx, (%rsi)
nop
add $54619, %r12
// Store
lea addresses_RW+0x7621, %rsi
nop
nop
nop
xor $57557, %r12
mov $0x5152535455565758, %r9
movq %r9, (%rsi)
nop
nop
cmp $34581, %rbx
// Store
lea addresses_normal+0x128a1, %r9
nop
nop
nop
and $38652, %rsi
movb $0x51, (%r9)
nop
nop
nop
nop
xor $47444, %r12
// Store
lea addresses_WT+0xb479, %rsi
nop
nop
and $5271, %r11
mov $0x5152535455565758, %r15
movq %r15, %xmm7
vmovups %ymm7, (%rsi)
nop
nop
nop
nop
nop
sub %r9, %r9
// Store
lea addresses_A+0x1b601, %r11
clflush (%r11)
nop
nop
nop
nop
xor $58835, %rsi
movw $0x5152, (%r11)
nop
nop
nop
nop
xor $35950, %r15
// Faulty Load
mov $0x8781100000004a1, %r9
nop
nop
nop
cmp $24341, %r11
mov (%r9), %rsi
lea oracles, %r12
and $0xff, %rsi
shlq $12, %rsi
mov (%r12,%rsi,1), %rsi
pop %rsi
pop %rbx
pop %rax
pop %r9
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'AVXalign': False, 'congruent': 6, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 6, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 3, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 4, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 1, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 5, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/081/A081857.asm | neoneye/loda-programs | 11 | 23164 | ; A081857: Jacobsthal sequence (A001045) as represented in base 4.
; Submitted by <NAME>
; 0,1,1,3,11,23,111,223,1111,2223,11111,22223,111111,222223,1111111,2222223,11111111,22222223,111111111,222222223,1111111111,2222222223,11111111111,22222222223,111111111111,222222222223,1111111111111
lpb $0
sub $0,2
mul $1,10
add $1,2
lpe
add $1,$0
mul $0,$1
add $1,15
add $1,$0
mov $0,$1
sub $0,15
div $0,2
|
experiments/test-suite/mutation-based/10/4/arr.als | kaiyuanw/AlloyFLCore | 1 | 4578 | <filename>experiments/test-suite/mutation-based/10/4/arr.als
pred test38 {
some disj Element0, Element1: Element {some disj Array0: Array {
Element = Element0 + Element1
Array = Array0
i2e = Array0->0->Element1 + Array0->1->Element0
length = Array0->2
NoConflict[]
}}
}
run test38 for 3 expect 1
pred test7 {
some disj Element0, Element1: Element {some disj Array0: Array {
Element = Element0 + Element1
Array = Array0
i2e = Array0->0->Element1 + Array0->1->Element0
length = Array0->-3 + Array0->0 + Array0->6
}}
}
run test7 for 3 expect 0
pred test16 {
some disj Array0: Array {
no Element
Array = Array0
no i2e
length = Array0->-4
}
}
run test16 for 3 expect 0
|
newitems/jump/hole.asm | fcard/z3randomizer | 0 | 97460 | <gh_stars>0
; Skip changing Link's state to "near a hole" if he
; is jumping, so his jump isn't cancelled.
FallIntoHole:
LDA !IsJumping : BNE +
LDA #$01 : STA $5B : STA $5D
+
RTL
|
programs/oeis/028/A028235.asm | neoneye/loda | 22 | 10119 | <reponame>neoneye/loda
; A028235: If n = Product (p_j^k_j), a(n) = numerator of Sum 1/p_j (the denominator of this sum is A007947).
; 0,1,1,1,1,5,1,1,1,7,1,5,1,9,8,1,1,5,1,7,10,13,1,5,1,15,1,9,1,31,1,1,14,19,12,5,1,21,16,7,1,41,1,13,8,25,1,5,1,7,20,15,1,5,16,9,22,31,1,31,1,33,10,1,18,61,1,19,26,59,1,5,1,39,8,21,18,71,1,7,1,43,1,41,22,45,32,13,1,31,20,25,34,49,24,5,1,9,14,7
seq $0,7947 ; Largest squarefree number dividing n: the squarefree kernel of n, rad(n), radical of n.
seq $0,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m).
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/modular4_pkg.ads | best08618/asylo | 7 | 22214 | package Modular4_Pkg is
type Word is mod 2**48;
Zero : constant Word := 0;
function F return Word;
end Modular4_Pkg;
|
oeis/247/A247847.asm | neoneye/loda-programs | 11 | 91801 | ; A247847: Decimal expansion of m = (1-1/e^2)/2, one of Renyi's parking constants.
; Submitted by <NAME>
; 4,3,2,3,3,2,3,5,8,3,8,1,6,9,3,6,5,4,0,5,3,0,0,0,2,5,2,5,1,3,7,5,7,7,9,8,2,9,6,1,8,4,2,2,7,0,4,5,2,1,2,0,5,9,2,6,5,9,2,0,5,6,3,6,7,2,9,6,3,3,1,2,9,4,9,2,5,6,1,5,5,0,3,1,4,5,0,9,3,8,7,5,4,6,7,1,4,7,5,6
add $0,1
mov $2,1
mov $3,$0
mul $3,4
lpb $3
add $1,$2
add $5,$2
add $1,$5
mul $2,$3
add $2,$1
mul $1,2
sub $3,1
lpe
mul $1,2
add $2,$5
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
|
programs/oeis/001/A001316.asm | jmorken/loda | 1 | 242589 | <gh_stars>1-10
; A001316: Gould's sequence: a(n) = Sum_{k=0..n} (binomial(n,k) mod 2); number of odd entries in row n of Pascal's triangle (A007318); 2^A000120(n).
; 1,2,2,4,2,4,4,8,2,4,4,8,4,8,8,16,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,8,16,16,32,16,32,32,64,16,32,32,64,32,64,64,128,2,4,4,8,4,8,8,16,4,8,8,16,8,16,16,32,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,8,16,16,32,16,32,32,64,16,32,32,64,32,64,64,128,4,8,8,16,8,16,16,32,8,16,16,32,16,32,32,64,8,16,16,32,16,32,32,64,16,32,32,64,32,64,64,128,8,16,16,32,16,32,32,64,16,32,32,64,32,64,64,128,16,32,32,64,32,64,64,128,32,64
mov $1,$0
lpb $0
div $1,2
sub $0,$1
lpe
mul $1,2
pow $1,$0
add $1,1
mul $1,2
sub $1,4
div $1,2
add $1,1
|
pipe-core/src/main/antlr4/uk/ac/imperial/pipe/parsers/RateGrammar.g4 | dodo0101/PIPE | 0 | 825 | <reponame>dodo0101/PIPE<gh_stars>0
grammar RateGrammar;
// PARSER
program : expression;
expression
: '(' expression ')' # parenExpression
| expression op=('*'|'/') expression # multOrDiv
| expression op=('+'|'-') expression # addOrSubtract
| 'ceil(' expression ')' # ceil
| 'floor(' expression ')' # floor
| capacity # placeCapacity
| token_number # placeTokens
| token_color_number # placeColorTokens
| INT # integer
| DOUBLE # double;
// Probably dont need this
capacity: 'cap(' ID ')';
token_number: '#(' ID ')';
token_color_number: '#(' ID ',' ID ')';
// LEXER
ID : ('a'..'z'|'A'..'Z') ('a'..'z'|'A'..'Z'|'0'..'9')*;
INT : '0'..'9'+;
DOUBLE : '0'..'9'+ '.' '0'..'9'+;
WS : [ \t\n\r]+ -> skip ;
MUL : '*';
DIV : '/';
ADD : '+';
SUB : '-'; |
alloy4fun_models/trashltl/models/5/pCTDcsoLkMawAfNnS.als | Kaixi26/org.alloytools.alloy | 0 | 807 | open main
pred idpCTDcsoLkMawAfNnS_prop6 {
always (after File in Trash)
}
pred __repair { idpCTDcsoLkMawAfNnS_prop6 }
check __repair { idpCTDcsoLkMawAfNnS_prop6 <=> prop6o } |
02_asm/fibonacci_fast.asm | Kris030/lowlew-basics | 0 | 97429 | <gh_stars>0
; declare constants
%assign WORD_SIZE 2
; N in ebx
fibonacci_fast:
; variable b in eax
; argument N / variable i
push ebx
; variable a
push ecx
; variable c
push edx
; don't bother with loop if N < 2
cmp ebx, 2
mov eax, ebx
jl .end
; set up a = fib(0), b = fib(1)
mov ecx, 0
mov eax, 1
.loop:
; c = a + b
mov edx, ecx
add edx, eax
; a = b
mov ecx, eax
; b = c
mov eax, edx
; while (--n > 1)
dec ebx
cmp ebx, 1
jg .loop
.end:
; clean up variables
pop edx
pop ecx
pop ebx
ret
|
programs/oeis/269/A269412.asm | karttu/loda | 0 | 100982 | <gh_stars>0
; A269412: Number of length-6 0..n arrays with no repeated value greater than or equal to the previous repeated value.
; 16,394,2872,12380,39560,104006,238224,492312,939360,1681570,2857096,4647604,7286552,11068190,16357280,23599536,33332784,46198842,62956120,84492940,111841576,146193014,188912432,241555400,305884800,383888466,477797544,590105572,723588280,881324110,1066715456,1283510624,1535826512,1828172010,2165472120,2553092796,2996866504,3503118502,4078693840,4730985080,5467960736,6298194434,7230894792,8275936020,9443889240,10746054526,12194493664,13802063632,15582450800,17550205850,19720779416,22110558444,24736903272,27618185430,30773826160,34224335656,37991353024,42097686962,46567357160,51425636420,56699093496,62415636654,68604557952,75296578240,82523892880,90320218186,98720838584,107762654492,117484230920,127925846790,139129544976,151139183064,164000484832,177761092450,192470619400,208180704116,224945064344,242819552222,261862210080,282133326960,303695495856,326613671674,350955229912,376790026060,404190455720,433231515446,463990864304,496548886152,530988752640,567396486930,605861028136,646474296484,689331259192,734529997070,782171771840,832361094176,885205792464,940817082282,999309636600,1060801656700,1125414943816,1193274971494,1264510958672,1339255943480,1417646857760,1499824602306,1585934122824,1676124486612,1770548959960,1869365086270,1972734764896,2080824330704,2193804634352,2311851123290,2435143923480,2563867921836,2698212849384,2838373365142,2984549140720,3136944945640,3295770733376,3461241728114,3633578512232,3813007114500,3999759099000,4194071654766,4396187686144,4606355903872,4824830916880,5051873324810,5287749811256,5532733237724,5787102738312,6051143815110,6325148434320,6609415123096,6904249067104,7209962208802,7526873346440,7855308233780,8195599680536,8548087653534,8913119378592,9291049443120,9682239899440,10087060368826,10505888146264,10939108305932,11387113807400,11850305602550,12329092743216,12823892489544,13335130419072,13863240536530,14408665384360,14971856153956,15553272797624,16153384141262,16772667997760,17411611281120,18070710121296,18750469979754,19451405765752,20174041953340,20918912699080,21686561960486,22477543615184,23292421580792,24131769935520,24996173039490,25886225656776,26802533078164,27745711244632,28716386871550,29715197573600,30742791990416,31799829912944,32886982410522,34004931958680,35154372567660,36336009911656,37550561458774,38798756601712,40081336789160,41399055657920,42752679165746,44142985724904,45570766336452,47036824725240,48541977475630,50087054167936,51672897515584,53300363502992,54970321524170,56683654522040,58441259128476,60244045805064,62092938984582,63988877213200,65932813293400,67925714427616,69968562362594,72062353534472,74208099214580,76406825655960,78659574240606,80967401627424,83331379900912,85752596720560,88232155470970
mov $2,$0
mov $4,$0
add $4,10
mov $5,$0
mov $6,3
mov $7,$0
lpb $0,1
trn $1,$0
add $2,$4
add $1,$2
mov $3,$0
sub $0,1
sub $3,1
sub $2,$3
mul $3,2
add $4,4
add $6,$3
add $6,3
add $6,$4
lpe
trn $2,$1
add $1,$5
add $2,5
mov $3,$6
sub $4,$2
add $1,$4
add $1,$4
sub $1,$4
add $1,4
sub $5,$5
add $5,1
sub $3,$5
add $3,$1
mov $1,$3
mul $1,2
sub $1,6
mov $8,$7
mov $11,22
lpb $11,1
add $1,$8
sub $11,1
lpe
mov $10,$7
lpb $10,1
add $9,$8
sub $10,1
lpe
mov $8,$9
mov $11,106
lpb $11,1
add $1,$8
sub $11,1
lpe
mov $9,0
mov $10,$7
lpb $10,1
add $9,$8
sub $10,1
lpe
mov $8,$9
mov $11,112
lpb $11,1
add $1,$8
sub $11,1
lpe
mov $9,0
mov $10,$7
lpb $10,1
add $9,$8
sub $10,1
lpe
mov $8,$9
mov $11,53
lpb $11,1
add $1,$8
sub $11,1
lpe
mov $9,0
mov $10,$7
lpb $10,1
add $9,$8
sub $10,1
lpe
mov $8,$9
mov $11,12
lpb $11,1
add $1,$8
sub $11,1
lpe
mov $9,0
mov $10,$7
lpb $10,1
add $9,$8
sub $10,1
lpe
mov $8,$9
mov $11,1
lpb $11,1
add $1,$8
sub $11,1
lpe
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.