view test/device.d @ 585:a5b902b20300 ia32-no-rname

ia32 reconfigure end (correct?)
author kono
date Wed, 18 Jan 2006 12:26:48 +0900
parents d35df41eac69
children
line wrap: on
line source

struct env_segment1 {
   void *fp;
   void *sp;
}

struct cont_segment1 {
   int value;
   *return();
}

segment1(env_segment1 e, 
       cont_segment1 c) {
    cont_segment1 c1 = 
      new_continuation(c,e);
    c.return = segment2;
    call_segment(e,c1);
}

call_segment(env_segment1 e, 
       cont_segment1 c) {
    c.value = 1;
    c.return();
}

segment2(env_segment2 e,
      cont_segment1 c) {
    cont_segment1 c1 = 
      old_continuation(e);
    halt(e,c);
}

inline type new_continuation(c,e) {
    e.fp -= sizeof(type);
    return (type)e.fp;
}

inline type old_continuation(c,e) {
    e.fp += sizeof(c);
    return (type)e.fp;
}