diff options
author | Roland McGrath <roland@gnu.org> | 1996-07-17 22:09:01 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1996-07-17 22:09:01 +0000 |
commit | b3657b27182f2c707cb940795cb982e4bb0f5660 (patch) | |
tree | baf7feb90706981ba3c790dceeff115052b54cf1 /libdiskfs | |
parent | a184f3a4f1a4ffd3191ad34579af9bf4d39abb20 (diff) |
(struct disk_image_user): New type.
(diskfs_catch_exception, diskfs_end_catch_exception): Use it to maintain a
linked list of catchers instead of just one.
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/diskfs-pager.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libdiskfs/diskfs-pager.h b/libdiskfs/diskfs-pager.h index cde9d811..a7d20c9d 100644 --- a/libdiskfs/diskfs-pager.h +++ b/libdiskfs/diskfs-pager.h @@ -36,17 +36,23 @@ extern struct port_bucket *pager_bucket; /* Ports bucket used by pagers. */ extern struct pager *disk_pager; /* Pager backing to the disk. */ extern void *disk_image; /* Region mapping entire disk from it. */ +struct disk_image_user + { + jmp_buf env; + struct disk_image_user *next; + }; + /* Return zero now. Return a second time with a nonzero error_t if this thread faults accessing `disk_image' before calling `diskfs_end_catch_exception' (below). */ #define diskfs_catch_exception() \ ({ \ - jmp_buf *env = alloca (sizeof (jmp_buf)); \ + struct disk_image_user *diu = alloca (sizeof *diu); \ error_t err; \ - assert (cthread_data (cthread_self ()) == 0); \ - err = setjmp (*env); \ + diu->next = (void *) cthread_data (cthread_self ()); \ + err = setjmp (diu->env); \ if (err == 0) \ - cthread_set_data (cthread_self (), env); \ + cthread_set_data (cthread_self (), diu); \ err; \ }) @@ -54,8 +60,8 @@ extern void *disk_image; /* Region mapping entire disk from it. */ Any unexpected fault hereafter will crash the program. */ #define diskfs_end_catch_exception() \ ({ \ - assert (cthread_data (cthread_self ()) != 0); \ - cthread_set_data (cthread_self (), 0); \ + struct disk_image_user *diu = (void *) cthread_data (cthread_self ()); \ + cthread_set_data (cthread_self (), diu->next); \ }) |