当前位置: 首页>>代码示例>>Python>>正文


Python AccessStruct.r_s方法代码示例

本文整理汇总了Python中amitools.vamos.AccessStruct.AccessStruct.r_s方法的典型用法代码示例。如果您正苦于以下问题:Python AccessStruct.r_s方法的具体用法?Python AccessStruct.r_s怎么用?Python AccessStruct.r_s使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在amitools.vamos.AccessStruct.AccessStruct的用法示例。


在下文中一共展示了AccessStruct.r_s方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: StackSwap

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def StackSwap(self, ctx):
   stsw_ptr = ctx.cpu.r_reg(REG_A0)
   stsw = AccessStruct(ctx.mem,StackSwapDef,struct_addr=stsw_ptr)
   # get new stack values
   new_lower = stsw.r_s('stk_Lower')
   new_upper = stsw.r_s('stk_Upper')
   new_pointer = stsw.r_s('stk_Pointer')
   # retrieve current (old) stack
   old_lower = self.stk_lower
   old_upper = self.stk_upper
   old_pointer = ctx.cpu.r_reg(REG_A7) # addr of sys call return
   # get adress of callee
   callee = ctx.mem.access.r32(old_pointer)
   # we report the old stack befor callee
   old_pointer += 4
   log_exec.info("StackSwap: old(lower=%06x,upper=%06x,ptr=%06x) new(lower=%06x,upper=%06x,ptr=%06x)" % (old_lower,old_upper,old_pointer,new_lower,new_upper,new_pointer))
   stsw.w_s('stk_Lower', old_lower)
   stsw.w_s('stk_Upper', old_upper)
   stsw.w_s('stk_Pointer', old_pointer)
   self.stk_lower = new_lower
   self.stk_upper = new_upper
   # put callee's address on new stack
   new_pointer -= 4
   ctx.mem.access.w32(new_pointer,callee)
   # activate new stack
   ctx.cpu.w_reg(REG_A7, new_pointer)
开发者ID:rmtew,项目名称:amitools,代码行数:28,代码来源:ExecLibrary.py

示例2: RemTail

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def RemTail(self, ctx):
   list_addr = ctx.cpu.r_reg(REG_A0)
   l = AccessStruct(ctx.mem, ListDef, list_addr)
   node_addr = l.r_s("lh_TailPred")
   n = AccessStruct(ctx.mem, NodeDef, node_addr)
   succ = n.r_s("ln_Succ")
   pred = n.r_s("ln_Pred")
   if pred == 0:
     log_exec.info("RemTail(%06x): null" % list_addr)
     return 0
   AccessStruct(ctx.mem, NodeDef, pred).w_s("ln_Succ", succ)
   AccessStruct(ctx.mem, NodeDef, succ).w_s("ln_Pred", pred)
   log_exec.info("RemTail(%06x): %06x" % (list_addr, node_addr))
   return node_addr
开发者ID:apiraino,项目名称:amitools,代码行数:16,代码来源:ExecLibrary.py

示例3: AddSemaphore

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def AddSemaphore(self,ctx):
   addr     = ctx.cpu.r_reg(REG_A1)
   sstruct  = AccessStruct(ctx.mem,SignalSemaphoreDef,addr)
   name_ptr = sstruct.r_s("ss_Link.ln_Name")
   name     = ctx.mem.access.r_cstr(name_ptr)
   self.semaphore_mgr.AddSemaphore(addr,name)
   log_exec.info("AddSemaphore(%06x,%s)" % (addr,name))
开发者ID:cmsj,项目名称:amitools,代码行数:9,代码来源:ExecLibrary.py

示例4: put_msg

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def put_msg(self, port_mgr, msg_addr):
   msg = AccessStruct(self.ctx.mem,MessageDef,struct_addr=msg_addr)
   dos_pkt_addr = msg.r_s("mn_Node.ln_Name")
   dos_pkt = AccessStruct(self.ctx.mem,DosPacketDef,struct_addr=dos_pkt_addr)
   reply_port_addr = dos_pkt.r_s("dp_Port")
   pkt_type = dos_pkt.r_s("dp_Type")
   log_dos.info("DosPacket: msg=%06x -> pkt=%06x: reply_port=%06x type=%06x", msg_addr, dos_pkt_addr, reply_port_addr, pkt_type)
   # handle packet
   if pkt_type == ord('R'): # read
     fh_b_addr = dos_pkt.r_s("dp_Arg1")
     buf_ptr   = dos_pkt.r_s("dp_Arg2")
     size      = dos_pkt.r_s("dp_Arg3")
     # get fh and read
     fh = self.file_mgr.get_by_b_addr(fh_b_addr)
     data = self.file_mgr.read(fh, size)
     self.ctx.mem.access.w_data(buf_ptr, data)
     got = len(data)
     log_dos.info("DosPacket: Read fh_b_addr=%06x buf=%06x len=%06x -> got=%06x fh=%s", fh_b_addr, buf_ptr, size, got, fh)
     dos_pkt.w_s("dp_Res1", got)
   elif pkt_type == ord('W'): # write
     fh_b_addr = dos_pkt.r_s("dp_Arg1")
     buf_ptr   = dos_pkt.r_s("dp_Arg2")
     size      = dos_pkt.r_s("dp_Arg3")
     fh = self.file_mgr.get_by_b_addr(fh_b_addr)
     data = self.ctx.mem.access.r_data(buf_ptr, size)
     self.file_mgr.write(fh, data)
     put = len(data)
     log_dos.info("DosPacket: Write fh=%06x buf=%06x len=%06x -> put=%06x fh=%s", fh_b_addr, buf_ptr, size, put, fh)
     dos_pkt.w_s("dp_Res1", put)
   else:
     raise UnsupportedFeatureError("Unsupported DosPacket: type=%d" % pkt_type)
   # do reply
   if not self.port_mgr.has_port(reply_port_addr):
     self.port_mgr.add_port(reply_port_addr)
   self.port_mgr.put_msg(reply_port_addr, msg_addr)
开发者ID:ezrec,项目名称:amitools,代码行数:37,代码来源:DosLibrary.py

示例5: DateToStr

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def DateToStr(self, ctx):
   dt_ptr = ctx.cpu.r_reg(REG_D1)
   dt = AccessStruct(ctx.mem,DateTimeDef,struct_addr=dt_ptr)
   ds_day = dt.r_s("dat_Stamp.ds_Days")
   ds_min = dt.r_s("dat_Stamp.ds_Minute")
   ds_tick = dt.r_s("dat_Stamp.ds_Tick")
   format = dt.r_s("dat_Format")
   flags = dt.r_s("dat_Flags")
   str_day_ptr = dt.r_s("dat_StrDay")
   str_date_ptr = dt.r_s("dat_StrDate")
   str_time_ptr = dt.r_s("dat_StrTime")
   at = AmiTime(ds_day, ds_min, ds_tick)
   st = at.to_sys_time()
   log_dos.info("DateToStr: ptr=%06x format=%x flags=%x day_ptr=%06x date_ptr=%06x time_ptr=%06x %s => sys_time=%d", \
     dt_ptr, format, flags, str_day_ptr, str_date_ptr, str_time_ptr, at, st)
   t = time.gmtime(st)
   day_str = time.strftime("%A", t)
   date_str = time.strftime("%d-%m-%y", t)
   time_str = time.strftime("%H:%M:%S", t)
   log_dos.info("DateToStr: result day='%s' date='%s' time='%s'", day_str, date_str, time_str)
   if str_day_ptr != 0:
     ctx.mem.access.w_cstr(str_day_ptr, day_str)
   if str_date_ptr != 0:
     ctx.mem.access.w_cstr(str_date_ptr, date_str)
   if str_time_ptr != 0:
     ctx.mem.access.w_cstr(str_time_ptr, time_str)
   return self.DOSTRUE
开发者ID:ezrec,项目名称:amitools,代码行数:29,代码来源:DosLibrary.py

示例6: volume_name_of_lock

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def volume_name_of_lock(self, lock):
   if lock == None:
     return "SYS:"
   else:
     vol_addr  = lock.mem.access.r_s("fl_Volume")
     volnode   = AccessStruct(self.mem,DosListVolumeDef,vol_addr)
     name_addr = volnode.r_s("dol_Name")
     name = self.mem.access.r_bstr(name_addr) + ":"
     return name
开发者ID:apiraino,项目名称:amitools,代码行数:11,代码来源:LockManager.py

示例7: Remove

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def Remove(self, ctx):
   node_addr = ctx.cpu.r_reg(REG_A1)
   n = AccessStruct(ctx.mem, NodeDef, node_addr)
   succ = n.r_s("ln_Succ")
   pred = n.r_s("ln_Pred")
   log_exec.info("Remove(%06x): ln_Pred=%06x ln_Succ=%06x" % (node_addr, pred, succ))
   AccessStruct(ctx.mem, NodeDef, pred).w_s("ln_Succ", succ)
   AccessStruct(ctx.mem, NodeDef, succ).w_s("ln_Pred", pred)
   return node_addr
开发者ID:gbraad,项目名称:amitools,代码行数:11,代码来源:ExecLibrary.py

示例8: AddTail

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def AddTail(self, ctx):
   list_addr = ctx.cpu.r_reg(REG_A0)
   node_addr = ctx.cpu.r_reg(REG_A1)
   log_exec.info("AddTail(%06x, %06x)" % (list_addr, node_addr))
   l = AccessStruct(ctx.mem, ListDef, list_addr)
   n = AccessStruct(ctx.mem, NodeDef, node_addr)
   n.w_s("ln_Succ", l.s_get_addr("lh_Tail"))
   tp = l.r_s("lh_TailPred")
   n.w_s("ln_Pred", tp)
   AccessStruct(ctx.mem, NodeDef, tp).w_s("ln_Succ", node_addr)
   l.w_s("lh_TailPred", node_addr)
开发者ID:gbraad,项目名称:amitools,代码行数:13,代码来源:ExecLibrary.py

示例9: CloseDevice

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def CloseDevice(self,ctx):
   io_addr  = ctx.cpu.r_reg(REG_A1)
   if io_addr != 0:
     io       = AccessStruct(ctx.mem, IORequestDef, io_addr)
     dev_addr = io.r_s("io_Device")
     if dev_addr != 0:
       dev = self.lib_mgr.close_dev(dev_addr,ctx)
       io.w_s("io_Device",0)
       if dev != None:
         log_exec.info("CloseDevice: '%s' -> %06x" % (dev, dev.addr_base))
       else:
         raise VamosInternalError("CloseDevice: Unknown library to close: ptr=%06x" % dev_addr)
开发者ID:cmsj,项目名称:amitools,代码行数:14,代码来源:ExecLibrary.py

示例10: _release_locklist

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def _release_locklist(self, entry):
   alist_addr    = entry.access.r_s("dol_List")
   entry.access.w_s("dol_List",0)
   entry.alist   = []
   while alist_addr != 0:
     alist        = AccessStruct(self.mem,AssignListDef,alist_addr)
     oldlock_addr = alist.r_s("al_Lock")
     oldlock      = self.lock_mgr.get_by_b_addr(oldlock_addr >> 2)
     self.lock_mgr.release_lock(oldlock)
     entry.alist.remove(alist)
     nextaddr     = alist.access.r_s("al_Next")
     self.alloc.free_struct(alist.mem)
     alist_addr   = nextaddr
开发者ID:cmsj,项目名称:amitools,代码行数:15,代码来源:DosList.py

示例11: InitSemaphore

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import r_s [as 别名]
 def InitSemaphore(self, ctx):
   sem_addr = ctx.cpu.r_reg(REG_A0)
   sem = AccessStruct(ctx.mem, SignalSemaphoreDef, sem_addr)
   log_exec.info("InitSemaphore(%06x)", sem_addr)
   wq_tail_ptr = sem.r_s("ss_WaitQueue.mlh_Tail")
   wq_head_ptr = sem.r_s("ss_WaitQueue.mlh_Head")
   sem.w_s("ss_WaitQueue.mlh_Head", wq_tail_ptr)
   sem.w_s("ss_WaitQueue.mlh_Tail", 0)
   sem.w_s("ss_WaitQueue.mlh_TailPred", wq_head_ptr)
   sem.w_s("ss_Link.ln_Type", NT_SIGNALSEM)
   sem.w_s("ss_NestCount", 0)
   sem.w_s("ss_Owner", 0)
   sem.w_s("ss_QueueCount", -1)
开发者ID:ezrec,项目名称:amitools,代码行数:15,代码来源:ExecLibrary.py


注:本文中的amitools.vamos.AccessStruct.AccessStruct.r_s方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。