Author Topic: DryOS task and context structures  (Read 1129 times)

Offline hudson

  • Rookie
  • *
  • Posts: 43
DryOS task and context structures
« on: 17 / May / 2009, 04:44:11 »
Are there any CHDK headers that have the layout of the task and context structures used by DryOS?  The chdk code that I see that overloads the dispatch hook just uses hard-coded offsets based on the pointer passed in.

Based on my work in reversing the 5D Mark 2 firmware, they look like this:
Code: C
  1. struct context
  2. {
  3.         uint32_t                cpsr;
  4.         uint32_t                r[13];
  5.         uint32_t                lr;
  6.         uint32_t                pc;
  7. };

Code: C
  1. struct task
  2. {
  3.         uint32_t                off_0x00;       // always 0?
  4.         uint32_t                off_0x04;       // stack maybe?
  5.         uint32_t                off_0x08;       // flags?
  6.         void *                  entry;          // off 0x0c
  7.         uint32_t                off_0x10;
  8.         uint32_t                off_0x14;
  9.         uint32_t                off_0x18;
  10.         uint32_t                off_0x1c;
  11.         uint32_t                off_0x20;
  12.         char *                  name;           // off_0x24;
  13.         uint32_t                off_0x28;
  14.         uint32_t                off_0x2c;
  15.         uint32_t                off_0x30;
  16.         uint32_t                off_0x34;
  17.         uint32_t                off_0x38;
  18.         uint32_t                off_0x3c;
  19.         uint32_t                off_0x40;
  20.         uint32_t                off_0x44;
  21.         uint32_t                off_0x48;
  22.         struct context *        context;        // off 0x4C
  23.         uint32_t                pad_1[12];
  24. };
  25.  

My dispatch hook looks like this:
Code: C
  1. void
  2. task_dispatch_hook(
  3.         struct context **       context
  4. )
  5. {
  6.         if( !context )
  7.                 return;
  8.  
  9.         // Determine the task address
  10.         struct task * task =
  11.                 ((uint32_t)context) - offsetof(struct task, context);
  12.  
  13.         // Do nothing unless a new task is starting via the trampoile
  14.         if( task->context->pc != (uint32_t) task_trampoline )
  15.                 return;
  16.  
  17.         // Try to replace the sound device task
  18.         // The trampoline will run our entry point instead
  19.         if( task->entry == (uint32_t) sound_dev_task )
  20.                 task->entry = (uint32_t) my_sound_dev_task;
  21. }
  22.  

Offline lorenzo353

  • Rookie
  • *
  • Posts: 36
Re: DryOS task and context structures
« Reply #1 on: 07 / November / 2009, 19:21:56 »
hello,

on page 55 of this Canon document
http://www.canon.com/technology/pageview/pageview.html?page_num=
it is said that Dryos is based on/compliant with micro itron 4.0 RTOS

which specifications are here
http://www.ertl.jp/ITRON/SPEC/mitron4-e.html

and a compatible implementation (TOPPER/JSP) is here
http://www.toppers.jp/download.cgi/jsp-1.4.3.tar.gz

with source code and documentation

Lorenzo

Offline Chucker

  • Newbie
  • *
  • Posts: 2
Re: DryOS task and context structures
« Reply #2 on: 30 / November / 2009, 08:32:12 »
I am the newest of the newbies. I have just followed the step-by-step progress from Beta to now in creating CHDK for the Canon SD880. Wow! and Thanks! to all who made this possible.
A month ago I loaded the appropriate CHDK for my Canon SD850. Should I expect similar happy results?

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal