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


Python AccessStruct.w_s方法代码示例

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


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

示例1: StackSwap

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_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: put_msg

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_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

示例3: AddLibrary

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_s [as 别名]
 def AddLibrary(self, ctx):
   lib_ptr = ctx.cpu.r_reg(REG_A1)
   lib = AccessStruct(ctx.mem, LibraryDef, lib_ptr)
   # Set up lib_Node
   lib.w_s("lib_Node.ln_Succ", lib_ptr)
   lib.w_s("lib_Node.ln_Pred", lib_ptr)
   lib.w_s("lib_Node.ln_Type", NT_LIBRARY)
   return lib_ptr
开发者ID:ezrec,项目名称:amitools,代码行数:10,代码来源:ExecLibrary.py

示例4: CloseDevice

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_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

示例5: GetDeviceProc

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_s [as 别名]
  def GetDeviceProc(self, ctx):
    name_ptr = ctx.cpu.r_reg(REG_D1)
    last_devproc = ctx.cpu.r_reg(REG_D2)
    name = ctx.mem.access.r_cstr(name_ptr)

    # get volume of path 
    abs_name = self.path_mgr.ami_abs_path(name)
    volume = self.path_mgr.ami_volume_of_path(abs_name)
    vol_lock = self.lock_mgr.create_lock(volume+":", False)
    fs_port = self.file_mgr.get_fs_handler_port()
    addr = self._alloc_mem("DevProc:%s" % name, DevProcDef.get_size())
    log_dos.info("GetDeviceProc: name='%s' devproc=%06x -> volume=%s devproc=%06x", name, last_devproc, volume, addr)
    devproc = AccessStruct(self.ctx.mem,DevProcDef,struct_addr=addr)
    devproc.w_s('dvp_Port', fs_port)
    devproc.w_s('dvp_Lock', vol_lock.b_addr)
    self.io_err = NO_ERROR
    return addr
开发者ID:ezrec,项目名称:amitools,代码行数:19,代码来源:DosLibrary.py

示例6: DateStamp

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_s [as 别名]
 def DateStamp(self, ctx):
   ds_ptr = ctx.cpu.r_reg(REG_D1)
   ds = AccessStruct(ctx.mem,DateStampDef,struct_addr=ds_ptr)
   t = time.time()
   at = sys_to_ami_time(t)
   log_dos.info("DateStamp: ptr=%06x sys_time=%d time=%s", ds_ptr, t, at)
   ds.w_s("ds_Days",at.tday)
   ds.w_s("ds_Minute",at.tmin)
   ds.w_s("ds_Tick",at.tick)
   return ds_ptr
开发者ID:ezrec,项目名称:amitools,代码行数:12,代码来源:DosLibrary.py

示例7: examine_file

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_s [as 别名]
 def examine_file(self, fib_mem, name, sys_path):
   # name
   name_addr = fib_mem.s_get_addr('fib_FileName')
   # clear 32 name bytes
   fib_mem.clear_data(name_addr, 32, 0)
   fib_mem.w_cstr(name_addr, name)
   # comment
   comment_addr = fib_mem.s_get_addr('fib_Comment')
   fib_mem.w_cstr(comment_addr, "")
   # create the "inode" information
   key = self.keygen(sys_path)
   fib_mem.w_s('fib_DiskKey',key)
   log_lock.debug("examine key: %08x", key)
   # type
   if os.path.isdir(sys_path):
     dirEntryType = 2
   else:
     dirEntryType = (-3) & 0xffffffff
   fib_mem.w_s('fib_DirEntryType', dirEntryType )
   fib_mem.w_s('fib_EntryType',    dirEntryType )
   # protection
   prot = DosProtection(0)
   try:
     os_stat = os.stat(sys_path)
     mode = os_stat.st_mode
     if mode & stat.S_IXUSR == 0:
       prot.clr(DosProtection.FIBF_EXECUTE)
     if mode & stat.S_IRUSR == 0:
       prot.clr(DosProtection.FIBF_READ)
     if mode & stat.S_IWUSR == 0:
       prot.clr(DosProtection.FIBF_WRITE)
     log_lock.debug("examine lock: '%s' mode=%03o: prot=%s", name, mode, prot)
   except OSError:
     return ERROR_OBJECT_IN_USE
   fib_mem.w_s('fib_Protection', prot.mask)
   # size
   if os.path.isfile(sys_path):
     size = os.path.getsize(sys_path)
     fib_mem.w_s('fib_Size', size)
     blocks = int((size + 511) / 512)
     fib_mem.w_s('fib_NumBlocks', blocks)
   else:
     fib_mem.w_s('fib_NumBlocks', 1)
   # date (use mtime here)
   date_addr = fib_mem.s_get_addr('fib_Date')
   date = AccessStruct(fib_mem.mem, DateStampDef, date_addr)
   t = os.path.getmtime(sys_path)
   at = sys_to_ami_time(t)
   date.w_s('ds_Days', at.tday)
   date.w_s('ds_Minute', at.tmin)
   date.w_s('ds_Tick', at.tick)
   # fill in UID/GID
   fib_mem.w_s('fib_OwnerUID', 0)
   fib_mem.w_s('fib_OwnerGID', 0)
   return NO_ERROR
开发者ID:cmsj,项目名称:amitools,代码行数:57,代码来源:Lock.py

示例8: AddTail

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_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: examine_file

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_s [as 别名]
 def examine_file(self, fib_mem, name, sys_path):
   # name
   name_addr = fib_mem.s_get_addr('fib_FileName')
   fib_mem.w_cstr(name_addr, name)
   # dummy key
   fib_mem.w_s('fib_DiskKey',0xcafebabe)
   # type
   if os.path.isdir(sys_path):
     dirEntryType = 0x2 # dir
   else:
     dirEntryType = 0xfffffffd # file
   fib_mem.w_s('fib_DirEntryType', dirEntryType )
   # protection
   prot = DosProtection(0)
   try:
     os_stat = os.stat(sys_path)
     mode = os_stat.st_mode
     if mode & stat.S_IXUSR == 0:
       prot.clr(DosProtection.FIBF_EXECUTE)
     if mode & stat.S_IRUSR == 0:
       prot.clr(DosProtection.FIBF_READ)
     if mode & stat.S_IWUSR == 0:
       prot.clr(DosProtection.FIBF_WRITE)
     log_lock.debug("examine lock: '%s' mode=%03o: prot=%s", name, mode, prot)
   except OSError:
     return ERROR_OBJECT_IN_USE
   fib_mem.w_s('fib_Protection', prot.mask)
   # size
   if os.path.isfile(sys_path):
     size = os.path.getsize(sys_path)
     fib_mem.w_s('fib_Size', size)
   # date (use mtime here)
   date_addr = fib_mem.s_get_addr('fib_Date')
   date = AccessStruct(fib_mem.mem, DateStampDef, date_addr)
   t = os.path.getmtime(sys_path)
   at = sys_to_ami_time(t)
   date.w_s('ds_Days', at.tday)
   date.w_s('ds_Minute', at.tmin)
   date.w_s('ds_Tick', at.tick)
   return NO_ERROR
开发者ID:gbraad,项目名称:amitools,代码行数:42,代码来源:Lock.py

示例10: Info

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_s [as 别名]
 def Info(self, ctx):
     lock_b_addr = ctx.cpu.r_reg(REG_D1)
     info_ptr = ctx.cpu.r_reg(REG_D2)
     lock = self.lock_mgr.get_by_b_addr(lock_b_addr)
     info = AccessStruct(ctx.mem, InfoDataDef, struct_addr=info_ptr)
     vol = lock.find_volume_node(self.dos_list)
     if vol != None:
         info.w_s("id_NumSoftErrors", 0)
         info.w_s("id_UnitNumber", 0)  # not that we really care...
         info.w_s("id_DiskState", 0)  # disk is not write protected
         info.w_s("id_NumBlocks", 0x7FFFFFFF)  # a really really big disk....
         info.w_s("id_NumBlocksUsed", 0x0FFFFFFF)  # some...
         info.w_s("id_BytesPerBlock", 512)  # let's take regular FFS blocks
         info.w_s("id_DiskType", 0x444F5303)  # international FFS
         info.w_s("id_VolumeNode", vol)
         info.w_s("id_InUse", 0)
         log_dos.info("Info: %s info=%06x -> true" % (lock, info_ptr))
         return self.DOSTRUE
     else:
         log_dos.info("Info: %s info=%06x -> false" % (lock, info_ptr))
         return self.DOSFALSE
开发者ID:lab313ru,项目名称:amitools,代码行数:23,代码来源:DosLibrary.py

示例11: InitSemaphore

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_s [as 别名]
 def InitSemaphore(self,addr):
   semaphore = AccessStruct(self.mem,SignalSemaphoreDef,struct_addr=addr)
   semaphore.w_s("ss_Owner",0)
   semaphore.w_s("ss_NestCount",0)
   semaphore.w_s("ss_QueueCount",0xffff)
   semaphore.w_s("ss_Link.ln_Type",self.NT_SIGNALSEM)
   semaphore.w_s("ss_WaitQueue.mlh_Head",semaphore.s_get_addr("ss_WaitQueue.mlh_Tail"))
   semaphore.w_s("ss_WaitQueue.mlh_Tail",0)
   semaphore.w_s("ss_WaitQueue.mlh_TailPred",semaphore.s_get_addr("ss_WaitQueue.mlh_Head"))
   return self.register_semaphore(addr)
开发者ID:cmsj,项目名称:amitools,代码行数:12,代码来源:SemaphoreManager.py

示例12: InitSemaphore

# 需要导入模块: from amitools.vamos.AccessStruct import AccessStruct [as 别名]
# 或者: from amitools.vamos.AccessStruct.AccessStruct import w_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.w_s方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。