diff --git a/amitools/vamos/lib/dos/Process.py b/amitools/vamos/lib/dos/Process.py index fa0af7d7..f259c7cd 100644 --- a/amitools/vamos/lib/dos/Process.py +++ b/amitools/vamos/lib/dos/Process.py @@ -198,7 +198,7 @@ def _init_task(self, machine): start_regs = self._get_start_regs() return_regs = [REG_D0] self.task = NativeTask( - name, machine, init_pc, self.stack, start_regs, return_regs + name, machine, self.stack, init_pc, start_regs, return_regs ) # store back ref to process self.task.process = self diff --git a/amitools/vamos/main.py b/amitools/vamos/main.py index df260fc5..0a47fd5c 100644 --- a/amitools/vamos/main.py +++ b/amitools/vamos/main.py @@ -87,7 +87,7 @@ def main(cfg_files=None, args=None, cfg_dict=None, profile=False): def runner(*args, **kw_args): task = scheduler.get_cur_task() if task: - return task.run(*args, **kw_args) + return task.sub_run(*args, **kw_args) else: return default_runtime.run(*args, **kw_args) diff --git a/amitools/vamos/schedule/scheduler.py b/amitools/vamos/schedule/scheduler.py index 433b579d..6d751c9a 100644 --- a/amitools/vamos/schedule/scheduler.py +++ b/amitools/vamos/schedule/scheduler.py @@ -55,8 +55,11 @@ def schedule(self): # main loop while True: log_schedule.debug( - "schedule: current %s added %s ready %s waiting %s", + "schedule: current %s", self.cur_task, + ) + log_schedule.debug( + "schedule: added %s ready %s waiting %s", self.added_tasks, self.ready_tasks, self.waiting_tasks, @@ -134,7 +137,7 @@ def _find_run_task(self): # keep current task task = self.cur_task log_schedule.debug("take: current task %s", task.name) - if task.get_state() == TaskState.TS_READY: + if task.get_state() in (TaskState.TS_READY, TaskState.TS_RUN): return task def _make_current(self, task): diff --git a/amitools/vamos/schedule/task.py b/amitools/vamos/schedule/task.py index a357a8e6..9e9b09e6 100644 --- a/amitools/vamos/schedule/task.py +++ b/amitools/vamos/schedule/task.py @@ -197,7 +197,7 @@ def __repr__(self): def start(self): pc = self.init_pc - sp = self.get_init_sp() + sp = self.stack.get_initial_sp() set_regs = self.start_regs get_regs = self.return_regs log_schedule.debug("%s: start native code. pc=%06x sp=%06x", self.name, pc, sp)