Title: Problem on RPI5 with Python13 · Issue #510 · lmbelo/python4delphi · GitHub
Open Graph Title: Problem on RPI5 with Python13 · Issue #510 · lmbelo/python4delphi
X Title: Problem on RPI5 with Python13 · Issue #510 · lmbelo/python4delphi
Description: Hi, using the last version of P4D on RPI 5 leads to Exception External SIGSEGV. Problem is in method function GetCallBack(Self: TObject; Method: Pointer; ArgNum: Integer; CallType: TCallType): Pointer; nmap didn't allocate the memory. I ...
Open Graph Description: Hi, using the last version of P4D on RPI 5 leads to Exception External SIGSEGV. Problem is in method function GetCallBack(Self: TObject; Method: Pointer; ArgNum: Integer; CallType: TCallType): Poin...
X Description: Hi, using the last version of P4D on RPI 5 leads to Exception External SIGSEGV. Problem is in method function GetCallBack(Self: TObject; Method: Pointer; ArgNum: Integer; CallType: TCallType): Poin...
Opengraph URL: https://github.com/lmbelo/python4delphi/issues/510
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Problem on RPI5 with Python13","articleBody":"Hi,\nusing the last version of P4D on RPI 5 leads to Exception External SIGSEGV. \nProblem is in method function GetCallBack(Self: TObject; Method: Pointer; ArgNum: Integer;\n CallType: TCallType): Pointer; \n\nnmap didn't allocate the memory.\n\n\nI have solved this problem changing the method code in way\n```pascal\n{$IFDEF CPUARM64}\nfunction GetCallBack(Self: TObject; Method: Pointer; ArgNum: Integer;\n CallType: TCallType): Pointer;\nconst\n S1: array[0..79] of byte = (\n//big-endian\n//offset \u003c_start\u003e:\n $fd, $7b, $bf, $a9, //\tstp\tx29, x30, [sp, #-16]!\n $fd, $03, $00, $91, //\tmov\tx29, sp\n $e0, $07, $bf, $a9, //\tstp\tx0, x1, [sp, #-16]!\n $e2, $0f, $bf, $a9, //\tstp\tx2, x3, [sp, #-16]!\n $e4, $17, $bf, $a9, //\tstp\tx4, x5, [sp, #-16]!\n $e6, $1f, $bf, $a9, //\tstp\tx6, x7, [sp, #-16]!\n $0a, $00, $00, $10, //\tadr\tx10, #0 \u003c_start+0x18\u003e\n $40, $15, $40, $f9, //\tldr\tx0, [x10, #40]\n $49, $19, $40, $f9, //\tldr\tx9, [x10, #48]\n $e7, $2f, $c1, $a8, //\tldp\tx7, x11, [sp], #16\n $e5, $1b, $c1, $a8, //\tldp\tx5, x6, [sp], #16\n $e3, $13, $c1, $a8, //\tldp\tx3, x4, [sp], #16\n $e1, $0b, $c1, $a8, //\tldp\tx1, x2, [sp], #16\n $20, $01, $3f, $d6, //\tblr\tx9\n $fd, $7b, $c1, $a8, //\tldp\tx29, x30, [sp], #16\n $c0, $03, $5f, $d6, //\tret\n $00, $00, $00, $00, //\t.word\t0x00000000 //Self\n $00, $00, $00, $00, //\t.word\t0x00000000\n $00, $00, $00, $00, //\t.word\t0x00000000 //Method\n $00, $00, $00, $00 //\t.word\t0x00000000\n);\nconst\n PageSize = 4096;\nvar\n P, Q: PByte;\n LLiteralPool: TArray\u003cpointer\u003e;\n I: Integer;\n addr: Pointer;\nbegin\n GetCodeMem(Q, SizeOf(S1));\n if Q = nil then\n begin\n addr := fpMmap(nil, PageSize, PROT_READ or PROT_WRITE or PROT_EXEC, MAP_PRIVATE or MAP_ANONYMOUS, -1, 0);\n if addr = Pointer(-1) then\n \t{$IFDEF UNIX}\n raise Exception.Create('mmap failed: ' + SysErrorMessage(GetLastOSError));\n \t{$ENDIF}\n Q := PByte(addr);\n end;\n\n P := Q;\n Move(S1, P^, SizeOf(S1));\n\n LLiteralPool := TArray\u003cpointer\u003e.Create(Self, Method);\n\n Inc(P, Length(S1) - (Length(LLiteralPool) * SizeOf(pointer)));\n for I := Low(LLiteralPool) to High(LLiteralPool) do begin\n Move(LLiteralPool[I], P^, SizeOf(pointer));\n Inc(P, SizeOf(pointer));\n end;\n {$IFDEF UNIX}\n if fpMprotect(Pointer(Q), SizeOf(S1), PROT_READ or PROT_EXEC) \u003c\u003e 0 then\n raise Exception.Create('mprotect failed: ' + SysErrorMessage(GetLastOSError));\n {$ENDIF}\n\n {$IF DEFINED(OSX) AND DEFINED(CPUARM64)}\n {\n macOS for M1 has a bug (Apple Feedback FB8994773) in which mprotect\n rejects a permission change from NONE -\u003e RWX.\n Solution: give RW permission, make memory changes, then change RW to X\n }\n //X permission to the entire page for executions...\n if mprotect(CodeMemPages, PageSize, PROT_EXEC) \u003c\u003e 0 then\n raise EMProtectError.CreateFmt('MProtect error: %s', [\n SysErrorMessage({$IFDEF FPC}GetLastOSError{$ELSE}GetLastError{$ENDIF}())]);\n {$IFEND}\n\n Result := Pointer(Q); //set arm mode\nend;\n{$ENDIF CPUARM64} \n```\nMaybe that will help to someone.\n\nBest regards\nBojan\n\n","author":{"url":"https://github.com/comdora","@type":"Person","name":"comdora"},"datePublished":"2025-11-22T11:59:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/510/python4delphi/issues/510"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:86420a64-5977-689e-aed6-31b9d97f06c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D70A:3CD7D9:2271BA6:2D23796:6A5CAB29 |
| html-safe-nonce | a850149310bd39ff67e9308a7a7ec704394babde6c896040765f12ddf3ff02c9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzBBOjNDRDdEOToyMjcxQkE2OjJEMjM3OTY6NkE1Q0FCMjkiLCJ2aXNpdG9yX2lkIjoiNTIxNTgwNjEyMTM4MzM0MDg0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ced8f68833a2798d099728c824ab88e9c2d79f5307938f88b68b2ea2ee0dba84 |
| hovercard-subject-tag | issue:3654606605 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lmbelo/python4delphi/510/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdc1a13a23426c18908bed68b7fa2c207f38b9a70500cd9bcc0d41ef4dcee1ee/lmbelo/python4delphi/issues/510 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdc1a13a23426c18908bed68b7fa2c207f38b9a70500cd9bcc0d41ef4dcee1ee/lmbelo/python4delphi/issues/510 |
| og:image:alt | Hi, using the last version of P4D on RPI 5 leads to Exception External SIGSEGV. Problem is in method function GetCallBack(Self: TObject; Method: Pointer; ArgNum: Integer; CallType: TCallType): Poin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | comdora |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/lmbelo/python4delphi git https://github.com/lmbelo/python4delphi.git |
| octolytics-dimension-user_id | 8376898 |
| octolytics-dimension-user_login | lmbelo |
| octolytics-dimension-repository_id | 41310993 |
| octolytics-dimension-repository_nwo | lmbelo/python4delphi |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 41310993 |
| octolytics-dimension-repository_network_root_nwo | lmbelo/python4delphi |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width