Skip to content

Commit

Permalink
task fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cnvogelg committed Oct 13, 2024
1 parent 944df9f commit a93ed9f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion amitools/vamos/lib/dos/Process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion amitools/vamos/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 5 additions & 2 deletions amitools/vamos/schedule/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion amitools/vamos/schedule/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a93ed9f

Please sign in to comment.