Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amd64 runtime looses exception ptr, young ptr+ FIX #2644

Closed
vicuna opened this issue Jun 5, 2004 · 1 comment
Closed

amd64 runtime looses exception ptr, young ptr+ FIX #2644

vicuna opened this issue Jun 5, 2004 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 5, 2004

Original bug ID: 2644
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Mike Zuhl
Version: 3.07
OS: Linux SLES 8/AMD64, SP3
Submission from: fw.pdx.polyserve.com (216.64.170.67)

In porting some ocaml code from i386 to amd64, I ran across a couple of bugs
that
cause wild memory accesses. I traced it back to the conversion of ocaml
runtime
from i386, where the exception and young pointers live in memory, to the amd64
where they spend most of their time in registers. Here's the fix:

--- amd64.S.ORIG 2004-04-26 15:30:16.000000000 -0700 +++ amd64.S 2004-05-05 17:30:20.000000000 -0700 @@ -34,11 +34,11 @@ movq %rax, caml_last_return_address(%rip) leaq 8(%rsp), %rax movq %rax, caml_bottom_of_stack(%rip) +.L105: /* Save young_ptr, caml_exception_pointer */ movq %r15, young_ptr(%rip) movq %r14, caml_exception_pointer(%rip) /* Build array of registers, save it into caml_gc_regs */ -.L105: pushq %r13 pushq %r12 pushq %rbp @@ -184,6 +184,7 @@ call *%rax /* Reload alloc ptr */ movq young_ptr(%rip), %r15 + movq caml_exception_pointer(%rip), %r14 /* Return to caller */ pushq %r12 ret @@ -252,7 +253,9 @@ FUNCTION(raise_caml_exception) movq %rdi, %rax movq caml_exception_pointer(%rip), %rsp - popq caml_exception_pointer(%rip) + /*popq caml_exception_pointer(%rip)*/ + popq %r14 + movq %r14, caml_exception_pointer(%rip) ret

/* Callback from C to Caml */

@vicuna
Copy link
Author

vicuna commented Jun 12, 2004

Comment author: administrator

Already fixed in CVS (2004/05/18 and 2003/12/20)

@vicuna vicuna closed this as completed Jun 12, 2004
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant