Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
[SOLVED] Strange AV in asm proc
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
How to compare floating p...
by
creaothceann
[
Today
at 02:14:30 pm]
Getting name / line of ca...
by
Thaddy
[
Today
at 01:58:46 pm]
Label with multiple lines...
by
paweld
[
Today
at 12:39:49 pm]
[Solved] TStringGrid disp...
by
jcmontherock
[
Today
at 11:30:47 am]
FPC Unleashed (inline var...
by
LeP
[
Today
at 11:25:41 am]
Pascal port of Unishox2
by
AlexTP
[
Today
at 10:29:01 am]
Qt does not position form...
by
zeljko
[
Today
at 09:05:06 am]
P.I.S.S. a PlugIn-framewo...
by
cdbc
[
Today
at 07:59:58 am]
Limiting Search in TSelec...
by
dsiders
[
Today
at 05:29:01 am]
using make with a differe...
by
Thausand
[
Today
at 12:04:50 am]
RunFormula: math expressi...
by
valdir.marcos
[May 10, 2026, 10:49:20 pm]
Help with FPReport data b...
by
Dankan1890
[May 10, 2026, 10:08:22 pm]
Scripts to generate ofici...
by
marcov
[May 10, 2026, 09:28:54 pm]
How do 'with' statements ...
by
Warfley
[May 10, 2026, 09:13:18 pm]
FpDebug for Linux AARCH64
by
Martin_fr
[May 10, 2026, 08:21:58 pm]
Application.QueueAsyncCal...
by
Thaddy
[May 10, 2026, 03:17:23 pm]
Windows API Hooking/DLL I...
by
Thaddy
[May 10, 2026, 01:08:56 pm]
TComboBoxEx & TCheckCombo...
by
Paolo
[May 10, 2026, 11:28:00 am]
DataPort or Synpase stat...
by
serbod
[May 10, 2026, 09:30:51 am]
SynEdit auto End of line ...
by
Martin_fr
[May 10, 2026, 09:08:36 am]
Show Case: WritingTool
by
ginoo
[May 10, 2026, 08:47:02 am]
How to view the TODO list...
by
Thaddy
[May 10, 2026, 07:16:27 am]
International Pascal Cong...
by
Mike.Cornflake
[May 09, 2026, 06:45:37 pm]
SpreadSheet Add Chart Lin...
by
eldonfsr
[May 09, 2026, 06:19:33 pm]
How to access inherited m...
by
Thaddy
[May 09, 2026, 04:12:38 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] Strange AV in asm proc (Read 1678 times)
guest58172
Guest
[SOLVED] Strange AV in asm proc
«
on:
November 05, 2017, 02:32:23 pm »
Code: Pascal
[Select]
[+]
[-]
program
Project1
;
{$Mode objfpc}
{$AsmMode intel}
type
TProc
=
function
(
)
:
PtrInt
;
function
AllInOne
(
)
:
PtrInt
;
assembler
;
asm
mov rax
,
1
// 9 bytes
ret
// 1
nop
// + 6
nop
nop
nop
nop
nop
mov rax
,
2
// this EIP is then aligned to 8...
ret
end
;
var
proc1
,
proc2
:
TProc
;
begin
proc1
:
=
@
AllInOne
;
proc2
:
=
TProc
(
pointer
(
proc1
)
+
16
)
;
writeln
(
proc1
(
)
)
;
writeln
(
proc2
(
)
)
;
end
.
The call to proc2 is okay but not the one to proc1. The idea is to generate the code for several function in one and then to play with code offsets. There no temporaries, no stack frame... why does this AV occurs then ?
Logged
marcov
Administrator
Hero Member
Posts: 12838
FPC developer.
Re: Strange AV in asm proc
«
Reply #1 on:
November 05, 2017, 03:52:48 pm »
Check the assembler generated? I don't see a nostackframe modifier.
Logged
guest58172
Guest
Re: Strange AV in asm proc
«
Reply #2 on:
November 05, 2017, 04:18:30 pm »
Aw yeah it works with the`nostackframe;` attribute. I thought there was no stack frame because the prologue and the epilogue were not generated.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
[SOLVED] Strange AV in asm proc
TinyPortal
© 2005-2018