diff options
author | Neal H. Walfield <neal@gnu.org> | 2009-02-19 20:45:51 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2009-02-19 20:45:51 +0100 |
commit | 9a2505aa673e3b001d18985eee0793c4647b3237 (patch) | |
tree | 9672672a3e8f510659f8e02a1d54d8a6692180c0 /ruth | |
parent | e20960f8cc10cb563133007f0e16ce23a644d620 (diff) |
Enable hurd_activation_frame_longjmp on x86-64.
Diffstat (limited to 'ruth')
-rw-r--r-- | ruth/ruth.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/ruth/ruth.c b/ruth/ruth.c index 039a24f..af3ac39 100644 --- a/ruth/ruth.c +++ b/ruth/ruth.c @@ -94,16 +94,18 @@ main (int argc, char *argv[]) { if (! vg_cap.shadow) as_dump_path (addr); - assertx (vg_cap.shadow, - VG_ADDR_FMT ", %s", + if (! vg_cap.shadow) + panic (VG_ADDR_FMT ", %s", VG_ADDR_PRINTF (addr), vg_cap_type_string (type)); } else { if (vg_cap.shadow) as_dump_path (addr); - assertx (! vg_cap.shadow, VG_ADDR_FMT ": " VG_CAP_FMT " (%p)", - VG_ADDR_PRINTF (addr), VG_CAP_PRINTF (&vg_cap), vg_cap.shadow); + if (vg_cap.shadow) + panic (VG_ADDR_FMT ": " VG_CAP_FMT " (%p)", + VG_ADDR_PRINTF (addr), VG_CAP_PRINTF (&vg_cap), + vg_cap.shadow); } if (type == vg_cap_folio) @@ -121,38 +123,46 @@ main (int argc, char *argv[]) vg_addr_t folio = capalloc (); - assert (! VG_ADDR_IS_VOID (folio)); + if (VG_ADDR_IS_VOID (folio)) + panic (""); error_t err = vg_folio_alloc (activity, activity, VG_FOLIO_POLICY_DEFAULT, &folio); - assert (! err); - assert (! VG_ADDR_IS_VOID (folio)); + if (err) + panic ("folio_alloc: %d", err); + if (VG_ADDR_IS_VOID (folio)) + panic ("folio is VOID"); int i; for (i = -10; i < 129; i ++) { vg_addr_t addr = capalloc (); if (VG_ADDR_IS_VOID (addr)) - panic ("capalloc"); + panic ("capalloc returned NULL"); err = vg_folio_object_alloc (activity, folio, i, vg_cap_page, VG_OBJECT_POLICY_DEFAULT, 0, &addr, NULL); - assert ((err == 0) == (0 <= i && i < VG_FOLIO_OBJECTS)); - assert (! VG_ADDR_IS_VOID (addr)); + if (! ((err == 0) == (0 <= i && i < VG_FOLIO_OBJECTS))) + panic (""); + if (VG_ADDR_IS_VOID (addr)) + panic (""); if (0 <= i && i < VG_FOLIO_OBJECTS) { uintptr_t type; struct vg_cap_properties properties; err = vg_cap_read (activity, VG_ADDR_VOID, addr, &type, &properties); - assert (! err); - assert (type == vg_cap_page); + if (err) + panic ("cap_read: %d", err); + if (type != vg_cap_page) + panic ("Unexpected type."); } capfree (addr); } err = vg_folio_free (activity, folio); - assert (! err); + if (err) + panic ("folio_free: %d", err); capfree (folio); printf ("ok.\n"); @@ -1049,9 +1059,11 @@ main (int argc, char *argv[]) { printf ("Checking deallocation... "); + int d = 0; vg_addr_t addr = as_alloc (PAGESIZE_LOG2, 1, true); - assert (! VG_ADDR_IS_VOID (addr)); + if (VG_ADDR_IS_VOID (addr)) + panic ("as_alloc failed"); as_ensure (addr); @@ -1059,16 +1071,17 @@ main (int argc, char *argv[]) STORAGE_MEDIUM_LIVED, VG_OBJECT_POLICY_DEFAULT, addr).addr; - assert (! VG_ADDR_IS_VOID (storage)); + if (VG_ADDR_IS_VOID (storage)) + panic ("storage_alloc failed"); int *buffer = VG_ADDR_TO_PTR (vg_addr_extend (addr, 0, PAGESIZE_LOG2)); - debug (5, "Writing before dealloc..."); + debug (d, "Writing before dealloc..."); *buffer = 0; storage_free (storage, true); - debug (5, "Writing after dealloc..."); + debug (d, "Writing after dealloc..."); jmp_buf jmpbuf; struct hurd_fault_catcher catcher; @@ -1077,6 +1090,8 @@ main (int argc, char *argv[]) bool callback (struct activation_frame *activation_frame, uintptr_t fault) { + debug (d, "Caught fault: " AF_REGS_FMT, + AF_REGS_PRINTF (activation_frame)); faulted = true; hurd_fault_catcher_unregister (&catcher); @@ -1092,9 +1107,10 @@ main (int argc, char *argv[]) if (setjmp (jmpbuf) == 0) { *buffer = 0; - assert (! "Didn't fault!?"); + panic ("Didn't fault!?"); } - assert (faulted); + if (! faulted) + panic ("fault handler not called!?"); printf ("ok.\n"); } |