[Nasm-bugs] [Bug 3392694] [Feature request] Support ELF format segment base references

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Tue Jul 7 06:07:22 PDT 2020


https://bugzilla.nasm.us/show_bug.cgi?id=3392694

C. Masloch <pushbx at ulukai.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pushbx at ulukai.org

--- Comment #1 from C. Masloch <pushbx at ulukai.org> ---
Full text of the example:

$ cat test7.c

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>

extern void __attribute__((regparmcall)) testfunction(uint32_t a, uint16_t b,
uint16_t c);

int main(int argc, char** argv) {
  testfunction(0xAA11AA11, 0xBB22, 0xCC33);
  return 0;
}
$ cat test7.asm

%include "lmacros3.mac"

        numdef FARCALL, 0
%if _FARCALL
 %define frametype far
%else
 %define frametype near
%endif

bits 16

        section .text
extern printf

global testfunction
testfunction:
        lframe frametype
        lpar word,      parameter_c
        lenter
        lvar dword,     parameter_a
         push dx
         push ax
        lvar word,      parameter_b
         push cx
        push word [bp + ?parameter_c]
        push word [bp + ?parameter_b]
        push word [bp + ?parameter_a + 2]
        push word [bp + ?parameter_a]
        mov ax, formatstring
        push ax
        call frametype printf
        add sp, 5 * 2
        lleave
        lret

        section .rodata
formatstring:
        db "Hello world from assembly!",10
        db "a=%08lX b=%04X c=%04X",10
        asciz
$ 


The example uses https://hg.ulukai.org/ecm/lmacros

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list