flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > bug in Fresh/fasm (fasm17324 on same sources - same bug) |
Author |
|
ProMiNick 29 May 2020, 00:56
context of problem
fresh example of linux GUI via Xserver: Code: proc start, .argc, .argv, .argp .fontlist dd ? .fontcount dd ? begin stdcall Xinitialize, strCaption, 10, 20, 400, 200 ;;; Main Event Loop .msg_pump: cinvoke XNextEvent, [hdisplay], event stdcall Xeventhandler jmp .msg_pump stdcall Xshutdown .do_exit: ; Non-Local for XSetErrorHandler xor eax, eax cinvoke exit, eax return endp proc Xshutdown begin cinvoke XFreeGC, [hdisplay], [hGC] cinvoke XDestroyWindow, [hwin], [hdisplay] cinvoke XSetErrorHandler, [oError] xor eax, eax return endp proc Xinitialize, .txt, .x, .y, .w, .h .hscreen rd 1 .hroot rd 1 begin cinvoke XOpenDisplay, 0 or eax, eax jnz .display_ok cinvoke puts, strErrorDisplay jmp start.do_exit .display_ok: mov [hdisplay], eax cinvoke XDefaultScreen, eax mov [.hscreen], eax cinvoke XDefaultRootWindow, [hdisplay] mov [.hroot], eax cinvoke XCreateSimpleWindow, [hdisplay], eax, [.x], [.y], [.w], [.h], 0, $000000, $d4d0c8 or eax, eax jnz .create_ok cinvoke puts, strErrorCreation jmp start.do_exit .create_ok: mov [hwin], eax cinvoke XCreateSimpleWindow, [hdisplay], eax, 10, 10, 64, 24, 0, 606060, $d4d0c8 mov [hwin2], eax cinvoke XSelectInput, [hdisplay], [hwin], KeyPressMask + KeyReleaseMask + ExposureMask cinvoke XSelectInput, [hdisplay], [hwin2], KeyPressMask + KeyReleaseMask + ExposureMask + EnterWindowMask + LeaveWindowMask cinvoke XStoreName, [hdisplay], [hwin], [.txt] cinvoke XStoreName, [hdisplay], [hwin2], cBtnCaption cinvoke XMapRaised, [hdisplay], [hwin] cinvoke XMapRaised, [hdisplay], [hwin2] or eax, eax jnz .show_ok cinvoke puts, strErrorShow jmp start.do_exit .show_ok: cinvoke XCreateGC, [hdisplay], [hwin], 0, 0 mov [hGC], eax cinvoke XSetForeground, [hdisplay], [hGC], $000000 cinvoke XSetBackground, [hdisplay], [hGC], $ffffff xor eax, eax return endp proc Xdrawscreen begin cinvoke XDrawLine, [hdisplay], [hwin], [hGC], 0, 110, 400, 110 cinvoke XDrawLine, [hdisplay], [hwin], [hGC], 0, 80, 400, 80 cinvoke XDrawString, [hdisplay], [hwin], [hGC], 10, 100, strMessage, lenMessage return endp proc StrLength, .ptrString begin push esi xor eax, eax mov esi, [.ptrString] test esi, esi jz .exit cld .loop: mov cl, [esi] inc esi test cl, cl jz .exit inc eax jmp .loop .exit: pop esi return endp proc DrawBtn, .hwin, .inside .attr XWindowAttributes .name dd ? .font dd ? .direction dd ? .ascent dd ? .descent dd ? .overall XCharStruct .Gcontext dd ? begin push ebx ecx esi edi lea ecx, [.attr] cinvoke XGetWindowAttributes, [hdisplay], [.hwin], ecx dec [.attr.width] dec [.attr.height] cinvoke XCreateGC, [hdisplay], [.hwin], 0, 0 mov ebx, eax cinvoke XGContextFromGC, ebx mov [.Gcontext], eax cmp [.inside], 0 jne .border_beveled cinvoke XSetForeground, [hdisplay], ebx, $606060 cinvoke XDrawRectangle, [hdisplay], [.hwin], ebx, 0, 0, [.attr.width], [.attr.height] sub [.attr.width], 2 sub [.attr.height], 2 cinvoke XSetForeground, [hdisplay], ebx, $d4d0c8 cinvoke XDrawRectangle, [hdisplay], [.hwin], ebx, 1, 1, [.attr.width], [.attr.height] inc [.attr.width] inc [.attr.height] jmp .border_ok .border_beveled: cinvoke XSetForeground, [hdisplay], ebx, $ffffff cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 0, 0, [.attr.width], 0 cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 0, 0, 0, [.attr.height] cinvoke XSetForeground, [hdisplay], ebx, $404040 cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 0, [.attr.height], [.attr.width], [.attr.height] cinvoke XDrawLine, [hdisplay], [.hwin], ebx, [.attr.width], 0, [.attr.width], [.attr.height] dec [.attr.width] dec [.attr.height] cinvoke XSetForeground, [hdisplay], ebx, $808080 cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 1, [.attr.height], [.attr.width], [.attr.height] cinvoke XDrawLine, [hdisplay], [.hwin], ebx, [.attr.width], 1, [.attr.width], [.attr.height] .border_ok: cinvoke XSetForeground, [hdisplay], ebx, $000000 lea ecx, [.name] cinvoke XFetchName, [hdisplay], [.hwin], ecx stdcall StrLength, [.name] mov edi, eax lea ecx, [.direction] lea edx, [.ascent] lea eax, [.descent] lea esi, [.overall] cinvoke XQueryTextExtents, [hdisplay], [.Gcontext], [.name], edi, ecx, edx, eax, esi xor eax, eax mov ax, [.overall.ascent] add ax, [.overall.descent] movsx eax, ax sub eax, [.attr.height] add eax, 1 neg eax sar eax, 1 movsx ecx, [.overall.ascent] lea eax, [eax+ecx+1] ; this is the baseline. mov [.attr.y], eax mov ax, [.overall.width] movsx eax, ax sub eax, [.attr.width] add eax, 1 neg eax sar eax, 1 add eax, 1 cmp eax, 1 jge @f mov eax, 1 @@: mov [.attr.x], eax stdcall StrLength, [.name] cinvoke XDrawString, [hdisplay], [.hwin], ebx, [.attr.x], [.attr.y], [.name], eax cinvoke XFree, [.name] cinvoke XFreeGC, [hdisplay], ebx .finish: pop edi esi ecx ebx return endp proc Xeventhandler begin mov eax, [event] cmp eax, Expose je .on_expose cmp eax, KeyPress je .on_keypress cmp eax, EnterNotify je .on_enter cmp eax, LeaveNotify je .on_leave return .on_leave: mov eax, [event+XEnterWindowEvent.window] cmp eax, [hwin2] je .button_leave return .button_leave: stdcall DrawBtn, [event+XEnterWindowEvent.window], 0 return .on_enter: mov eax, [event+XEnterWindowEvent.window] cmp eax, [hwin2] je .button_enter return .button_enter: stdcall DrawBtn, [event+XEnterWindowEvent.window], 1 return .on_expose: cmp [event+XExposeEvent.count], 0 je @f return @@: mov eax, [event+XExposeEvent.window] cmp eax, [hwin] je .mainwin cmp eax, [hwin2] je .button return .button: stdcall DrawBtn, [hwin2], 0 return .mainwin: stdcall Xdrawscreen return .on_keypress: cinvoke XLookupKeysym, event, 0 cmp eax, 'q' je .terminate return .terminate: ; keypress exits the application jmp start.do_exit endp iglobal strCaption db 'Xlib Fresh!', 0 strMessage db "This is native assembly language Linux program." lenMessage = ($-strMessage) cBtnCaption db 'Button',0 oError dd 0 strErrorDisplay db 'XOpenDisplay: could not open connection to X server.', 0 strErrorCreation db 'XCreateSimpleWindow: could not create window.', 0 strErrorShow db 'XMapRaised: could not display window.', 0 cNewLine db $0a, 0 hGC dd 0 hwin dd 0 hwin2 dd 0 hdisplay dd 0 event rd 132 endg disasm listing: Code: seg000:00000000 ; seg000:00000000 ; +-------------------------------------------------------------------------+ seg000:00000000 ; | This file has been generated by The Interactive Disassembler (IDA) | seg000:00000000 ; | Copyright (c) 2015 Hex-Rays, <support@hex-rays.com> | seg000:00000000 ; | License info: 48-3255-7514-28 | seg000:00000000 ; | Giancarlo Russo, HT Srl | seg000:00000000 seg000:00000000 .686p seg000:00000000 .mmx seg000:00000000 .model flat seg000:00000000 .intel_syntax noprefix seg000:00000000 seg000:00000000 ; =========================================================================== seg000:00000000 seg000:00000000 ; Segment type: Regular seg000:00000000 seg000 segment byte public '' use32 seg000:00000000 assume cs:seg000 seg000:00000000 assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing seg000:00000000 stru_0 db 7Fh, 45h, 4Ch, 46h, 3 dup(1), 3, 8 dup(0); e_ident seg000:00000000 dw ET_EXEC ; e_type seg000:00000000 dw EM_386 ; e_machine seg000:00000000 dd EV_CURRENT ; e_version seg000:00000000 dd offset start ; e_entry seg000:00000000 dd offset ProgramHeader ; e_phoff seg000:00000000 dd 0 ; e_shoff seg000:00000000 dd 0 ; e_flags seg000:00000000 db 34h, 0 seg000:00000000 dw size Elf32_Phdr ; e_phentsize seg000:00000000 dw 5 ; e_phnum seg000:00000000 dw size Elf32_Shdr ; e_shentsize seg000:00000000 dw 0 ; e_shnum seg000:00000000 dw 0 ; e_shstrndx seg000:00000034 ProgramHeader Elf32_Phdr <PT_LOAD, 0D4h, offset start, offset start, 605h, 605h, \ seg000:00000034 ; DATA XREF: seg000:stru_0o seg000:00000034 PF_X or PF_R, 1000h>; 0 ; "Xlib Fresh!" seg000:00000034 Elf32_Phdr <PT_LOAD, 6D9h, offset _title, offset _title, 0E1h, 2F1h, \ seg000:00000034 PF_W or PF_R, 1000h>; 1 seg000:00000034 Elf32_Phdr <PT_INTERP, 7BAh, offset aLibLdLinux_so_, \ seg000:00000034 offset aLibLdLinux_so_, 13h, 13h, PF_R, 1>; 2 seg000:00000034 Elf32_Phdr <PT_DYNAMIC, 7CDh, offset _DYNAMIC, offset _DYNAMIC, 58h, \ seg000:00000034 58h, PF_R, 1>; 3 seg000:00000034 Elf32_Phdr <PT_LOAD, 825h, offset _SYMTAB, offset _SYMTAB, 49Dh, 49Dh,\ seg000:00000034 PF_W or PF_R, 1000h>; 4 seg000:00000034 seg000 ends seg000:00000034 .text:080480D4 ; =========================================================================== .text:080480D4 .text:080480D4 ; Segment type: Pure code .text:080480D4 _text segment byte public 'CODE' use32 .text:080480D4 assume cs:_text .text:080480D4 ;org 80480D4h .text:080480D4 assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing .text:080480D4 .text:080480D4 ; =============== S U B R O U T I N E ======================================= .text:080480D4 .text:080480D4 ; Attributes: noreturn bp-based frame .text:080480D4 .text:080480D4 start proc near ; DATA XREF: seg000:ProgramHeadero .text:080480D4 enter 8, 0 .text:080480D8 push 200 .text:080480DD push 400 .text:080480E2 push 20 .text:080480E4 push 10 .text:080480E6 push offset _title ; "Xlib Fresh!" .text:080480EB call Xinitialize .text:080480F0 .text:080480F0 msg_loop: ; CODE XREF: start+35j .text:080480F0 push 80497BAh .text:080480F5 push ds:dword_80497B6 .text:080480FB call ds:dword_804AC9A .text:08048101 add esp, 8 .text:08048104 call sub_8048638 .text:08048109 jmp short msg_loop .text:08048109 start endp .text:08048109 .text:0804810B ; --------------------------------------------------------------------------- .text:0804810B call sub_8048120 .text:08048110 ; START OF FUNCTION CHUNK FOR Xinitialize .text:08048110 .text:08048110 loc_8048110: ; CODE XREF: Xinitialize+21j .text:08048110 ; Xinitialize+7Ej ... .text:08048110 xor eax, eax .text:08048112 push eax .text:08048113 call ds:dword_804ACBE .text:08048119 add esp, 4 .text:0804811C leave .text:0804811D retn 0Ch .text:0804811D ; END OF FUNCTION CHUNK FOR Xinitialize .text:08048120 .text:08048120 ; =============== S U B R O U T I N E ======================================= .text:08048120 .text:08048120 .text:08048120 sub_8048120 proc near ; CODE XREF: .text:0804810Bp .text:08048120 push ds:dword_80497AA .text:08048126 push ds:dword_80497B6 .text:0804812C call ds:dword_804AC86 .text:08048132 add esp, 8 .text:08048135 push ds:dword_80497B6 .text:0804813B push ds:dword_80497AE .text:08048141 call ds:dword_804AC6E .text:08048147 add esp, 8 .text:0804814A push ds:dword_804971B .text:08048150 call ds:dword_804ACAE .text:08048156 add esp, 4 .text:08048159 xor eax, eax .text:0804815B retn .text:0804815B sub_8048120 endp .text:0804815B .text:0804815C .text:0804815C ; =============== S U B R O U T I N E ======================================= .text:0804815C .text:0804815C ; Attributes: bp-based frame .text:0804815C .text:0804815C Xinitialize proc near ; CODE XREF: start+17p .text:0804815C .text:0804815C var_8 = dword ptr -8 .text:0804815C var_4 = dword ptr -4 .text:0804815C arg_0 = dword ptr 8 .text:0804815C arg_4 = dword ptr 0Ch .text:0804815C arg_8 = dword ptr 10h .text:0804815C arg_C = dword ptr 14h .text:0804815C arg_10 = dword ptr 18h .text:0804815C .text:0804815C ; FUNCTION CHUNK AT .text:08048110 SIZE 00000010 BYTES .text:0804815C .text:0804815C enter 8, 0 .text:08048160 push 0 .text:08048162 call ds:dword_804AC9E .text:08048168 add esp, 4 .text:0804816B or eax, eax .text:0804816D jnz short loc_804817F .text:0804816F push 804971Fh .text:08048174 call ds:dword_804ACBA .text:0804817A add esp, 4 .text:0804817D jmp short loc_8048110 .text:0804817F ; --------------------------------------------------------------------------- .text:0804817F .text:0804817F loc_804817F: ; CODE XREF: Xinitialize+11j .text:0804817F mov ds:dword_80497B6, eax .text:08048184 push eax .text:08048185 call ds:dword_804AC6A .text:0804818B add esp, 4 .text:0804818E mov [ebp+var_8], eax .text:08048191 push ds:dword_80497B6 .text:08048197 call ds:dword_804AC66 .text:0804819D add esp, 4 .text:080481A0 mov [ebp+var_4], eax .text:080481A3 push 0D4D0C8h .text:080481A8 push 0 .text:080481AA push 0 .text:080481AC push [ebp+arg_10] .text:080481AF push [ebp+arg_C] .text:080481B2 push [ebp+arg_8] .text:080481B5 push [ebp+arg_4] .text:080481B8 push eax .text:080481B9 push ds:dword_80497B6 .text:080481BF call ds:dword_804AC62 .text:080481C5 add esp, 24h .text:080481C8 or eax, eax .text:080481CA jnz short loc_80481DF .text:080481CC push 8049754h .text:080481D1 call ds:dword_804ACBA .text:080481D7 add esp, 4 .text:080481DA jmp loc_8048110 .text:080481DF ; --------------------------------------------------------------------------- .text:080481DF .text:080481DF loc_80481DF: ; CODE XREF: Xinitialize+6Ej .text:080481DF mov ds:dword_80497AE, eax .text:080481E4 push 0D4D0C8h .text:080481E9 push 93F6Ch .text:080481EE push 0 .text:080481F0 push 18h .text:080481F2 push 40h ; '@' .text:080481F4 push 0Ah .text:080481F6 push 0Ah .text:080481F8 push eax .text:080481F9 push ds:dword_80497B6 .text:080481FF call ds:dword_804AC62 .text:08048205 add esp, 24h .text:08048208 mov ds:dword_80497B2, eax .text:0804820D push 8003h .text:08048212 push ds:dword_80497AE .text:08048218 push ds:dword_80497B6 .text:0804821E call ds:dword_804ACA6 .text:08048224 add esp, 0Ch .text:08048227 push 8033h .text:0804822C push ds:dword_80497B2 .text:08048232 push ds:dword_80497B6 .text:08048238 call ds:dword_804ACA6 .text:0804823E add esp, 0Ch .text:08048241 push [ebp+arg_0] .text:08048244 push ds:dword_80497AE .text:0804824A push ds:dword_80497B6 .text:08048250 call ds:dword_804ACB6 .text:08048256 add esp, 0Ch .text:08048259 push 8049714h .text:0804825E push ds:dword_80497B2 .text:08048264 push ds:dword_80497B6 .text:0804826A call ds:dword_804ACB6 .text:08048270 add esp, 0Ch .text:08048273 push ds:dword_80497AE .text:08048279 push ds:dword_80497B6 .text:0804827F call ds:dword_804AC96 .text:08048285 add esp, 8 .text:08048288 push ds:dword_80497B2 .text:0804828E push ds:dword_80497B6 .text:08048294 call ds:dword_804AC96 .text:0804829A add esp, 8 .text:0804829D or eax, eax .text:0804829F jnz short loc_80482B4 .text:080482A1 push 8049782h .text:080482A6 call ds:dword_804ACBA .text:080482AC add esp, 4 .text:080482AF jmp loc_8048110 .text:080482B4 ; --------------------------------------------------------------------------- .text:080482B4 .text:080482B4 loc_80482B4: ; CODE XREF: Xinitialize+143j .text:080482B4 push 0 .text:080482B6 push 0 .text:080482B8 push ds:dword_80497AE .text:080482BE push ds:dword_80497B6 .text:080482C4 call ds:dword_804AC5E .text:080482CA add esp, 10h .text:080482CD mov ds:dword_80497AA, eax .text:080482D2 push 0 .text:080482D4 push ds:dword_80497AA .text:080482DA push ds:dword_80497B6 .text:080482E0 call ds:dword_804ACB2 .text:080482E6 add esp, 0Ch .text:080482E9 push 0FFFFFFh .text:080482EE push ds:dword_80497AA .text:080482F4 push ds:dword_80497B6 .text:080482FA call ds:dword_804ACAA .text:08048300 add esp, 0Ch .text:08048303 xor eax, eax .text:08048305 leave .text:08048306 retn 14h .text:08048306 Xinitialize endp .text:08048306 .text:08048309 .text:08048309 ; =============== S U B R O U T I N E ======================================= .text:08048309 .text:08048309 .text:08048309 sub_8048309 proc near ; CODE XREF: sub_8048638:loc_80486B8p .text:08048309 push 6Eh ; 'n' .text:0804830B push 190h .text:08048310 push 6Eh ; 'n' .text:08048312 push 0 .text:08048314 push ds:dword_80497AA .text:0804831A push ds:dword_80497AE .text:08048320 push ds:dword_80497B6 .text:08048326 call ds:dword_804AC72 .text:0804832C add esp, 1Ch .text:0804832F push 50h ; 'P' .text:08048331 push 190h .text:08048336 push 50h ; 'P' .text:08048338 push 0 .text:0804833A push ds:dword_80497AA .text:08048340 push ds:dword_80497AE .text:08048346 push ds:dword_80497B6 .text:0804834C call ds:dword_804AC72 .text:08048352 add esp, 1Ch .text:08048355 push 2Fh ; '/' .text:08048357 push 80496E5h .text:0804835C push 64h ; 'd' .text:0804835E push 0Ah .text:08048360 push ds:dword_80497AA .text:08048366 push ds:dword_80497AE .text:0804836C push ds:dword_80497B6 .text:08048372 call ds:dword_804AC7A .text:08048378 add esp, 1Ch .text:0804837B retn .text:0804837B sub_8048309 endp .text:0804837B .text:0804837C .text:0804837C ; =============== S U B R O U T I N E ======================================= .text:0804837C .text:0804837C ; Attributes: bp-based frame .text:0804837C .text:0804837C sub_804837C proc near ; CODE XREF: sub_8048399+1E6p .text:0804837C ; sub_8048399+259p .text:0804837C .text:0804837C arg_0 = dword ptr 8 .text:0804837C .text:0804837C push ebp .text:0804837D mov ebp, esp .text:0804837F push esi .text:08048380 xor eax, eax .text:08048382 mov esi, [ebp+arg_0] .text:08048385 test esi, esi .text:08048387 jz short loc_8048394 .text:08048389 cld .text:0804838A .text:0804838A loc_804838A: ; CODE XREF: sub_804837C+16j .text:0804838A mov cl, [esi] .text:0804838C inc esi .text:0804838D test cl, cl .text:0804838F jz short loc_8048394 .text:08048391 inc eax .text:08048392 jmp short loc_804838A .text:08048394 ; --------------------------------------------------------------------------- .text:08048394 .text:08048394 loc_8048394: ; CODE XREF: sub_804837C+Bj .text:08048394 ; sub_804837C+13j .text:08048394 pop esi .text:08048395 leave .text:08048396 retn 4 .text:08048396 sub_804837C endp .text:08048396 .text:08048399 .text:08048399 ; =============== S U B R O U T I N E ======================================= .text:08048399 .text:08048399 ; Attributes: bp-based frame .text:08048399 .text:08048399 sub_8048399 proc near ; CODE XREF: sub_8048638+30p .text:08048399 ; sub_8048638+4Cp ... .text:08048399 .text:08048399 var_80 = dword ptr -80h .text:08048399 var_7C = dword ptr -7Ch .text:08048399 var_78 = dword ptr -78h .text:08048399 var_74 = dword ptr -74h .text:08048399 var_24 = dword ptr -24h .text:08048399 var_1C = byte ptr -1Ch .text:08048399 var_18 = byte ptr -18h .text:08048399 var_14 = byte ptr -14h .text:08048399 var_10 = byte ptr -10h .text:08048399 var_C = word ptr -0Ch .text:08048399 var_A = word ptr -0Ah .text:08048399 var_8 = word ptr -8 .text:08048399 var_4 = dword ptr -4 .text:08048399 arg_0 = dword ptr 8 .text:08048399 arg_4 = dword ptr 0Ch .text:08048399 .text:08048399 enter 80h, 0 .text:0804839D push ebx .text:0804839E push ecx .text:0804839F push esi .text:080483A0 push edi .text:080483A1 lea ecx, [ebp+var_80] .text:080483A4 push ecx .text:080483A5 push [ebp+arg_0] .text:080483A8 push ds:dword_80497B6 .text:080483AE call ds:dword_804AC8E .text:080483B4 add esp, 0Ch .text:080483B7 dec [ebp+var_78] .text:080483BA dec [ebp+var_74] .text:080483BD push 0 .text:080483BF push 0 .text:080483C1 push [ebp+arg_0] .text:080483C4 push ds:dword_80497B6 .text:080483CA call ds:dword_804AC5E .text:080483D0 add esp, 10h .text:080483D3 mov ebx, eax .text:080483D5 push ebx .text:080483D6 call ds:dword_804AC8A .text:080483DC add esp, 4 .text:080483DF mov [ebp+var_4], eax .text:080483E2 cmp [ebp+arg_4], 0 .text:080483E6 jnz short loc_804845F .text:080483E8 push 606060h .text:080483ED push ebx .text:080483EE push ds:dword_80497B6 .text:080483F4 call ds:dword_804ACB2 .text:080483FA add esp, 0Ch .text:080483FD push [ebp+var_74] .text:08048400 push [ebp+var_78] .text:08048403 push 0 .text:08048405 push 0 .text:08048407 push ebx .text:08048408 push [ebp+arg_0] .text:0804840B push ds:dword_80497B6 .text:08048411 call ds:dword_804AC76 .text:08048417 add esp, 1Ch .text:0804841A sub [ebp+var_78], 2 .text:0804841E sub [ebp+var_74], 2 .text:08048422 push 0D4D0C8h .text:08048427 push ebx .text:08048428 push ds:dword_80497B6 .text:0804842E call ds:dword_804ACB2 .text:08048434 add esp, 0Ch .text:08048437 push [ebp+var_74] .text:0804843A push [ebp+var_78] .text:0804843D push 1 .text:0804843F push 1 .text:08048441 push ebx .text:08048442 push [ebp+arg_0] .text:08048445 push ds:dword_80497B6 .text:0804844B call ds:dword_804AC76 .text:08048451 add esp, 1Ch .text:08048454 inc [ebp+var_78] .text:08048457 inc [ebp+var_74] .text:0804845A jmp loc_8048554 .text:0804845F ; --------------------------------------------------------------------------- .text:0804845F .text:0804845F loc_804845F: ; CODE XREF: sub_8048399+4Dj .text:0804845F push 0FFFFFFh .text:08048464 push ebx .text:08048465 push ds:dword_80497B6 .text:0804846B call ds:dword_804ACB2 .text:08048471 add esp, 0Ch .text:08048474 push 0 .text:08048476 push [ebp+var_78] .text:08048479 push 0 .text:0804847B push 0 .text:0804847D push ebx .text:0804847E push [ebp+arg_0] .text:08048481 push ds:dword_80497B6 .text:08048487 call ds:dword_804AC72 .text:0804848D add esp, 1Ch .text:08048490 push [ebp+var_74] .text:08048493 push 0 .text:08048495 push 0 .text:08048497 push 0 .text:08048499 push ebx .text:0804849A push [ebp+arg_0] .text:0804849D push ds:dword_80497B6 .text:080484A3 call ds:dword_804AC72 .text:080484A9 add esp, 1Ch .text:080484AC push 404040h .text:080484B1 push ebx .text:080484B2 push ds:dword_80497B6 .text:080484B8 call ds:dword_804ACB2 .text:080484BE add esp, 0Ch .text:080484C1 push [ebp+var_74] .text:080484C4 push [ebp+var_78] .text:080484C7 push [ebp+var_74] .text:080484CA push 0 .text:080484CC push ebx .text:080484CD push [ebp+arg_0] .text:080484D0 push ds:dword_80497B6 .text:080484D6 call ds:dword_804AC72 .text:080484DC add esp, 1Ch .text:080484DF push [ebp+var_74] .text:080484E2 push [ebp+var_78] .text:080484E5 push 0 .text:080484E7 push [ebp+var_78] .text:080484EA push ebx .text:080484EB push [ebp+arg_0] .text:080484EE push ds:dword_80497B6 .text:080484F4 call ds:dword_804AC72 .text:080484FA add esp, 1Ch .text:080484FD dec [ebp+var_78] .text:08048500 dec [ebp+var_74] .text:08048503 push 808080h .text:08048508 push ebx .text:08048509 push ds:dword_80497B6 .text:0804850F call ds:dword_804ACB2 .text:08048515 add esp, 0Ch .text:08048518 push [ebp+var_74] .text:0804851B push [ebp+var_78] .text:0804851E push [ebp+var_74] .text:08048521 push 1 .text:08048523 push ebx .text:08048524 push [ebp+arg_0] .text:08048527 push ds:dword_80497B6 .text:0804852D call ds:dword_804AC72 .text:08048533 add esp, 1Ch .text:08048536 push [ebp+var_74] .text:08048539 push [ebp+var_78] .text:0804853C push 1 .text:0804853E push [ebp+var_78] .text:08048541 push ebx .text:08048542 push [ebp+arg_0] .text:08048545 push ds:dword_80497B6 .text:0804854B call ds:dword_804AC72 .text:08048551 add esp, 1Ch .text:08048554 .text:08048554 loc_8048554: ; CODE XREF: sub_8048399+C1j .text:08048554 push 0 .text:08048556 push ebx .text:08048557 push ds:dword_80497B6 .text:0804855D call ds:dword_804ACB2 .text:08048563 add esp, 0Ch .text:08048566 lea ecx, [ebp+var_24] .text:08048569 push ecx .text:0804856A push [ebp+arg_0] .text:0804856D push ds:dword_80497B6 .text:08048573 call ds:dword_804AC7E .text:08048579 add esp, 0Ch .text:0804857C push [ebp+var_24] .text:0804857F call sub_804837C .text:08048584 mov edi, eax .text:08048586 lea ecx, [ebp+var_1C] .text:08048589 lea edx, [ebp+var_18] .text:0804858C lea eax, [ebp+var_14] .text:0804858F lea esi, [ebp+var_10] .text:08048592 push esi .text:08048593 push eax .text:08048594 push edx .text:08048595 push ecx .text:08048596 push edi .text:08048597 push [ebp+var_24] .text:0804859A push [ebp+var_4] .text:0804859D push ds:dword_80497B6 .text:080485A3 call ds:dword_804ACA2 .text:080485A9 add esp, 20h .text:080485AC xor eax, eax .text:080485AE mov ax, [ebp+var_A] .text:080485B2 add ax, [ebp+var_8] .text:080485B6 movsx eax, ax .text:080485B9 sub eax, [ebp+var_74] .text:080485BC add eax, 1 .text:080485BF neg eax .text:080485C1 sar eax, 1 .text:080485C3 movsx ecx, [ebp+var_A] .text:080485C7 lea eax, [eax+ecx+1] .text:080485CB mov [ebp+var_7C], eax .text:080485CE mov ax, [ebp+var_C] .text:080485D2 movsx eax, ax .text:080485D5 sub eax, [ebp+var_78] .text:080485D8 add eax, 1 .text:080485DB neg eax .text:080485DD sar eax, 1 .text:080485DF add eax, 1 .text:080485E2 cmp eax, 1 .text:080485E5 jge short loc_80485EC .text:080485E7 mov eax, 1 .text:080485EC .text:080485EC loc_80485EC: ; CODE XREF: sub_8048399+24Cj .text:080485EC mov [ebp+var_80], eax .text:080485EF push [ebp+var_24] .text:080485F2 call sub_804837C .text:080485F7 push eax .text:080485F8 push [ebp+var_24] .text:080485FB push [ebp+var_7C] .text:080485FE push [ebp+var_80] .text:08048601 push ebx .text:08048602 push [ebp+arg_0] .text:08048605 push ds:dword_80497B6 .text:0804860B call ds:dword_804AC7A .text:08048611 add esp, 1Ch .text:08048614 push [ebp+var_24] .text:08048617 call ds:dword_804AC82 .text:0804861D add esp, 4 .text:08048620 push ebx .text:08048621 push ds:dword_80497B6 .text:08048627 call ds:dword_804AC86 .text:0804862D add esp, 8 .text:08048630 pop edi .text:08048631 pop esi .text:08048632 pop ecx .text:08048633 pop ebx .text:08048634 leave .text:08048635 retn 8 .text:08048635 sub_8048399 endp .text:08048635 .text:08048638 .text:08048638 ; =============== S U B R O U T I N E ======================================= .text:08048638 .text:08048638 .text:08048638 sub_8048638 proc near ; CODE XREF: start+30p .text:08048638 mov eax, ds:80497BAh .text:0804863D cmp eax, 0Ch .text:08048640 jz short loc_804868A .text:08048642 cmp eax, 2 .text:08048645 jz short loc_80486BE .text:08048647 cmp eax, 7 .text:0804864A jz short loc_804866E .text:0804864C cmp eax, 8 .text:0804864F jz short loc_8048652 .text:08048651 retn .text:08048652 ; --------------------------------------------------------------------------- .text:08048652 .text:08048652 loc_8048652: ; CODE XREF: sub_8048638+17j .text:08048652 mov eax, ds:80497CAh .text:08048657 cmp eax, ds:dword_80497B2 .text:0804865D jz short loc_8048660 .text:0804865F retn .text:08048660 ; --------------------------------------------------------------------------- .text:08048660 .text:08048660 loc_8048660: ; CODE XREF: sub_8048638+25j .text:08048660 push 0 .text:08048662 push dword ptr ds:80497CAh .text:08048668 call sub_8048399 .text:0804866D retn .text:0804866E ; --------------------------------------------------------------------------- .text:0804866E .text:0804866E loc_804866E: ; CODE XREF: sub_8048638+12j .text:0804866E mov eax, ds:80497CAh .text:08048673 cmp eax, ds:dword_80497B2 .text:08048679 jz short loc_804867C .text:0804867B retn .text:0804867C ; --------------------------------------------------------------------------- .text:0804867C .text:0804867C loc_804867C: ; CODE XREF: sub_8048638+41j .text:0804867C push 1 .text:0804867E push dword ptr ds:80497CAh .text:08048684 call sub_8048399 .text:08048689 retn .text:0804868A ; --------------------------------------------------------------------------- .text:0804868A .text:0804868A loc_804868A: ; CODE XREF: sub_8048638+8j .text:0804868A cmp dword ptr ds:80497DEh, 0 .text:08048691 jz short loc_8048694 .text:08048693 retn .text:08048694 ; --------------------------------------------------------------------------- .text:08048694 .text:08048694 loc_8048694: ; CODE XREF: sub_8048638+59j .text:08048694 mov eax, ds:80497CAh .text:08048699 cmp eax, ds:dword_80497AE .text:0804869F jz short loc_80486B8 .text:080486A1 cmp eax, ds:dword_80497B2 .text:080486A7 jz short loc_80486AA .text:080486A9 retn .text:080486AA ; --------------------------------------------------------------------------- .text:080486AA .text:080486AA loc_80486AA: ; CODE XREF: sub_8048638+6Fj .text:080486AA push 0 .text:080486AC push ds:dword_80497B2 .text:080486B2 call sub_8048399 .text:080486B7 retn .text:080486B8 ; --------------------------------------------------------------------------- .text:080486B8 .text:080486B8 loc_80486B8: ; CODE XREF: sub_8048638+67j .text:080486B8 call sub_8048309 .text:080486BD retn .text:080486BE ; --------------------------------------------------------------------------- .text:080486BE .text:080486BE loc_80486BE: ; CODE XREF: sub_8048638+Dj .text:080486BE push 0 .text:080486C0 push 80497BAh .text:080486C5 call ds:dword_804AC92 .text:080486CB add esp, 8 .text:080486CE cmp eax, 71h ; 'q' .text:080486D1 jz short loc_80486D4 .text:080486D3 retn .text:080486D4 ; --------------------------------------------------------------------------- .text:080486D4 .text:080486D4 loc_80486D4: ; CODE XREF: sub_8048638+99j .text:080486D4 jmp loc_8048110 .text:080486D4 sub_8048638 endp .text:080486D4 .text:080486D4 _text ends .text:080486D4 seg002:080496D9 ; =========================================================================== seg002:080496D9 seg002:080496D9 ; Segment type: Regular seg002:080496D9 seg002 segment byte public '' use32 seg002:080496D9 assume cs:seg002 seg002:080496D9 ;org 80496D9h seg002:080496D9 assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing seg002:080496D9 _title db 'Xlib Fresh!',0 ; DATA XREF: seg000:ProgramHeadero seg002:080496D9 ; start+12o seg002:080496E5 aThisIsNativeAs db 'This is native assembly language Linux program.Button',0 seg002:0804971B dword_804971B dd 0 ; DATA XREF: sub_8048120+2Ar seg002:0804971F aXopendisplayCo db 'XOpenDisplay: could not open connection to X server.',0 seg002:08049754 aXcreatesimpl_0 db 'XCreateSimpleWindow: could not create window.',0 seg002:08049782 aXmapraisedCoul db 'XMapRaised: could not display window.',0 seg002:080497A8 db 0Ah,0 seg002:080497AA dword_80497AA dd 0 ; DATA XREF: sub_8048120r seg002:080497AA ; Xinitialize+171w ... seg002:080497AE dword_80497AE dd 0 ; DATA XREF: sub_8048120+1Br seg002:080497AE ; Xinitialize:loc_80481DFw ... seg002:080497B2 dword_80497B2 dd 0 ; DATA XREF: Xinitialize+ACw seg002:080497B2 ; Xinitialize+D0r ... seg002:080497B6 dword_80497B6 dd 0 ; DATA XREF: start+21r seg002:080497B6 ; sub_8048120+6r ... seg002:080497B6 seg002 ends seg002:080497B6 seg003:0804A7BA ; =========================================================================== seg003:0804A7BA seg003:0804A7BA ; Segment type: Regular seg003:0804A7BA seg003 segment byte public '' use32 seg003:0804A7BA assume cs:seg003 seg003:0804A7BA ;org 804A7BAh seg003:0804A7BA assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing seg003:0804A7BA aLibLdLinux_so_ db '/lib/ld-linux.so.2',0 ; DATA XREF: seg000:ProgramHeadero seg003:0804A7BA seg003 ends seg003:0804A7BA seg004:0804A7CD ; =========================================================================== seg004:0804A7CD seg004:0804A7CD ; Segment type: Regular seg004:0804A7CD seg004 segment byte public '' use32 seg004:0804A7CD assume cs:seg004 seg004:0804A7CD ;org 804A7CDh seg004:0804A7CD assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing seg004:0804A7CD _DYNAMIC Elf32_Dyn_o <DT_NEEDED, offset aLibc_so_6 - offset _STRTAB> seg004:0804A7CD ; DATA XREF: seg000:ProgramHeadero seg004:0804A7CD ; "libc.so.6" seg004:0804A7D5 Elf32_Dyn_o <DT_NEEDED, offset aLibx11_so_6 - offset _STRTAB> ; "libX11.so.6" seg004:0804A7DD Elf32_Dyn_p <DT_STRTAB, offset _STRTAB> seg004:0804A7E5 Elf32_Dyn_v <DT_STRSZ, 15Dh> seg004:0804A7ED Elf32_Dyn_p <DT_SYMTAB, offset _SYMTAB> seg004:0804A7F5 Elf32_Dyn_v <DT_SYMENT, 10h> seg004:0804A7FD Elf32_Dyn_p <DT_REL, offset _RELTAB> seg004:0804A805 Elf32_Dyn_v <DT_RELSZ, 0C8h> seg004:0804A80D Elf32_Dyn_v <DT_RELENT, 8> seg004:0804A815 Elf32_Dyn_p <DT_HASH, offset _HASHTAB> seg004:0804A81D db 0 seg004:0804A81E db 0 seg004:0804A81F db 0 seg004:0804A820 db 0 seg004:0804A821 db 0 seg004:0804A822 db 0 seg004:0804A823 db 0 seg004:0804A824 db 0 seg004:0804A824 seg004 ends seg004:0804A824 seg005:0804A825 ; =========================================================================== seg005:0804A825 seg005:0804A825 ; Segment type: Regular seg005:0804A825 seg005 segment byte public '' use32 seg005:0804A825 assume cs:seg005 seg005:0804A825 ;org 804A825h seg005:0804A825 assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing seg005:0804A825 _SYMTAB Elf32_Sym <0> ; DATA XREF: seg000:ProgramHeadero seg005:0804A825 ; seg004:0804A7EDo seg005:0804A835 Elf32_Sym <offset aXcreategc - offset _STRTAB, 0, 0, \ ; "XCreateGC" seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 0 seg005:0804A835 Elf32_Sym <offset aXcreatesimplew - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 1 seg005:0804A835 Elf32_Sym <offset aXdefaultrootwi - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 2 seg005:0804A835 Elf32_Sym <offset aXdefaultscreen - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 3 seg005:0804A835 Elf32_Sym <offset aXdestroywindow - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 4 seg005:0804A835 Elf32_Sym <offset aXdrawline - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 5 seg005:0804A835 Elf32_Sym <offset aXdrawrectangle - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 6 seg005:0804A835 Elf32_Sym <offset aXdrawstring - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 7 seg005:0804A835 Elf32_Sym <offset aXfetchname - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 8 seg005:0804A835 Elf32_Sym <offset aXfree - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 9 seg005:0804A835 Elf32_Sym <offset aXfreegc - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 10 seg005:0804A835 Elf32_Sym <offset aXgcontextfromg - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 11 seg005:0804A835 Elf32_Sym <offset aXgetwindowattr - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 12 seg005:0804A835 Elf32_Sym <offset aXlookupkeysym - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 13 seg005:0804A835 Elf32_Sym <offset aXmapraised - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 14 seg005:0804A835 Elf32_Sym <offset aXnextevent - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 15 seg005:0804A835 Elf32_Sym <offset aXopendisplay - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 16 seg005:0804A835 Elf32_Sym <offset aXquerytextexte - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 17 seg005:0804A835 Elf32_Sym <offset aXselectinput - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 18 seg005:0804A835 Elf32_Sym <offset aXsetbackground - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 19 seg005:0804A835 Elf32_Sym <offset aXseterrorhandl - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 20 seg005:0804A835 Elf32_Sym <offset aXsetforeground - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 21 seg005:0804A835 Elf32_Sym <offset aXstorename - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 22 seg005:0804A835 Elf32_Sym <offset aPuts - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 23 seg005:0804A835 Elf32_Sym <offset aExit - offset _STRTAB, 0, 0, \ seg005:0804A835 STT_FUNC or STB_GLOBAL, STV_DEFAULT, 0>; 24 seg005:0804A9C5 _RELTAB Elf32_Rel <offset dword_804AC5E, 101h>; 0 seg005:0804A9C5 ; DATA XREF: seg004:0804A7FDo seg005:0804A9C5 Elf32_Rel <offset dword_804AC62, 201h>; 1 seg005:0804A9C5 Elf32_Rel <offset dword_804AC66, 301h>; 2 seg005:0804A9C5 Elf32_Rel <offset dword_804AC6A, 401h>; 3 seg005:0804A9C5 Elf32_Rel <offset dword_804AC6E, 501h>; 4 seg005:0804A9C5 Elf32_Rel <offset dword_804AC72, 601h>; 5 seg005:0804A9C5 Elf32_Rel <offset dword_804AC76, 701h>; 6 seg005:0804A9C5 Elf32_Rel <offset dword_804AC7A, 801h>; 7 seg005:0804A9C5 Elf32_Rel <offset dword_804AC7E, 901h>; 8 seg005:0804A9C5 Elf32_Rel <offset dword_804AC82, 0A01h>; 9 seg005:0804A9C5 Elf32_Rel <offset dword_804AC86, 0B01h>; 10 seg005:0804A9C5 Elf32_Rel <offset dword_804AC8A, 0C01h>; 11 seg005:0804A9C5 Elf32_Rel <offset dword_804AC8E, 0D01h>; 12 seg005:0804A9C5 Elf32_Rel <offset dword_804AC92, 0E01h>; 13 seg005:0804A9C5 Elf32_Rel <offset dword_804AC96, 0F01h>; 14 seg005:0804A9C5 Elf32_Rel <offset dword_804AC9A, 1001h>; 15 seg005:0804A9C5 Elf32_Rel <offset dword_804AC9E, 1101h>; 16 seg005:0804A9C5 Elf32_Rel <offset dword_804ACA2, 1201h>; 17 seg005:0804A9C5 Elf32_Rel <offset dword_804ACA6, 1301h>; 18 seg005:0804A9C5 Elf32_Rel <offset dword_804ACAA, 1401h>; 19 seg005:0804A9C5 Elf32_Rel <offset dword_804ACAE, 1501h>; 20 seg005:0804A9C5 Elf32_Rel <offset dword_804ACB2, 1601h>; 21 seg005:0804A9C5 Elf32_Rel <offset dword_804ACB6, 1701h>; 22 seg005:0804A9C5 Elf32_Rel <offset dword_804ACBA, 1801h>; 23 seg005:0804A9C5 Elf32_Rel <offset dword_804ACBE, 1901h>; 24 seg005:0804AA8D _HASHTAB db 1 ; DATA XREF: seg004:0804A815o seg005:0804AA8E db 0 seg005:0804AA8F db 0 seg005:0804AA90 db 0 seg005:0804AA91 dd 26 seg005:0804AA95 dd 0, 1, 2, 3, 4, 5, 6 ; 0 seg005:0804AA95 dd 7, 8, 9, 10, 11, 12, 13; 7 seg005:0804AA95 dd 14, 15, 16, 17, 18, 19, 20; 14 seg005:0804AA95 dd 21, 22, 23, 24, 25, 0; 21 seg005:0804AB01 _STRTAB db 0 ; DATA XREF: seg004:_DYNAMIC+4o seg005:0804AB01 ; seg004:0804A7D9o ... seg005:0804AB02 aXcreategc db 'XCreateGC',0 ; DATA XREF: seg005:0804A835o seg005:0804AB0C aXcreatesimplew db 'XCreateSimpleWindow',0 ; DATA XREF: seg005:0804A835o seg005:0804AB20 aXdefaultrootwi db 'XDefaultRootWindow',0 ; DATA XREF: seg005:0804A835o seg005:0804AB33 aXdefaultscreen db 'XDefaultScreen',0 ; DATA XREF: seg005:0804A835o seg005:0804AB42 aXdestroywindow db 'XDestroyWindow',0 ; DATA XREF: seg005:0804A835o seg005:0804AB51 aXdrawline db 'XDrawLine',0 ; DATA XREF: seg005:0804A835o seg005:0804AB5B aXdrawrectangle db 'XDrawRectangle',0 ; DATA XREF: seg005:0804A835o seg005:0804AB6A aXdrawstring db 'XDrawString',0 ; DATA XREF: seg005:0804A835o seg005:0804AB76 aXfetchname db 'XFetchName',0 ; DATA XREF: seg005:0804A835o seg005:0804AB81 aXfree db 'XFree',0 ; DATA XREF: seg005:0804A835o seg005:0804AB87 aXfreegc db 'XFreeGC',0 ; DATA XREF: seg005:0804A835o seg005:0804AB8F aXgcontextfromg db 'XGContextFromGC',0 ; DATA XREF: seg005:0804A835o seg005:0804AB9F aXgetwindowattr db 'XGetWindowAttributes',0 ; DATA XREF: seg005:0804A835o seg005:0804ABB4 aXlookupkeysym db 'XLookupKeysym',0 ; DATA XREF: seg005:0804A835o seg005:0804ABC2 aXmapraised db 'XMapRaised',0 ; DATA XREF: seg005:0804A835o seg005:0804ABCD aXnextevent db 'XNextEvent',0 ; DATA XREF: seg005:0804A835o seg005:0804ABD8 aXopendisplay db 'XOpenDisplay',0 ; DATA XREF: seg005:0804A835o seg005:0804ABE5 aXquerytextexte db 'XQueryTextExtents',0 ; DATA XREF: seg005:0804A835o seg005:0804ABF7 aXselectinput db 'XSelectInput',0 ; DATA XREF: seg005:0804A835o seg005:0804AC04 aXsetbackground db 'XSetBackground',0 ; DATA XREF: seg005:0804A835o seg005:0804AC13 aXseterrorhandl db 'XSetErrorHandler',0 ; DATA XREF: seg005:0804A835o seg005:0804AC24 aXsetforeground db 'XSetForeground',0 ; DATA XREF: seg005:0804A835o seg005:0804AC33 aXstorename db 'XStoreName',0 ; DATA XREF: seg005:0804A835o seg005:0804AC3E aPuts db 'puts',0 ; DATA XREF: seg005:0804A835o seg005:0804AC43 aExit db 'exit',0 ; DATA XREF: seg005:0804A835o seg005:0804AC48 aLibc_so_6 db 'libc.so.6',0 ; DATA XREF: seg004:_DYNAMICo seg005:0804AC52 aLibx11_so_6 db 'libX11.so.6',0 ; DATA XREF: seg004:0804A7D5o seg005:0804AC5E dword_804AC5E dd 0 ; DATA XREF: Xinitialize+168r seg005:0804AC5E ; sub_8048399+31r ... seg005:0804AC62 dword_804AC62 dd 0 ; DATA XREF: Xinitialize+63r seg005:0804AC62 ; Xinitialize+A3r ... seg005:0804AC66 dword_804AC66 dd 0 ; DATA XREF: Xinitialize+3Br seg005:0804AC66 ; seg005:_RELTABo seg005:0804AC6A dword_804AC6A dd 0 ; DATA XREF: Xinitialize+29r seg005:0804AC6A ; seg005:_RELTABo seg005:0804AC6E dword_804AC6E dd 0 ; DATA XREF: sub_8048120+21r seg005:0804AC6E ; seg005:_RELTABo seg005:0804AC72 dword_804AC72 dd 0 ; DATA XREF: sub_8048309+1Dr seg005:0804AC72 ; sub_8048309+43r ... seg005:0804AC76 dword_804AC76 dd 0 ; DATA XREF: sub_8048399+78r seg005:0804AC76 ; sub_8048399+B2r ... seg005:0804AC7A dword_804AC7A dd 0 ; DATA XREF: sub_8048309+69r seg005:0804AC7A ; sub_8048399+272r ... seg005:0804AC7E dword_804AC7E dd 0 ; DATA XREF: sub_8048399+1DAr seg005:0804AC7E ; seg005:_RELTABo seg005:0804AC82 dword_804AC82 dd 0 ; DATA XREF: sub_8048399+27Er seg005:0804AC82 ; seg005:_RELTABo seg005:0804AC86 dword_804AC86 dd 0 ; DATA XREF: sub_8048120+Cr seg005:0804AC86 ; sub_8048399+28Er ... seg005:0804AC8A dword_804AC8A dd 0 ; DATA XREF: sub_8048399+3Dr seg005:0804AC8A ; seg005:_RELTABo seg005:0804AC8E dword_804AC8E dd 0 ; DATA XREF: sub_8048399+15r seg005:0804AC8E ; seg005:_RELTABo seg005:0804AC92 dword_804AC92 dd 0 ; DATA XREF: sub_8048638+8Dr seg005:0804AC92 ; seg005:_RELTABo seg005:0804AC96 dword_804AC96 dd 0 ; DATA XREF: Xinitialize+123r seg005:0804AC96 ; Xinitialize+138r ... seg005:0804AC9A dword_804AC9A dd 0 ; DATA XREF: start+27r seg005:0804AC9A ; seg005:_RELTABo seg005:0804AC9E dword_804AC9E dd 0 ; DATA XREF: Xinitialize+6r seg005:0804AC9E ; seg005:_RELTABo seg005:0804ACA2 dword_804ACA2 dd 0 ; DATA XREF: sub_8048399+20Ar seg005:0804ACA2 ; seg005:_RELTABo seg005:0804ACA6 dword_804ACA6 dd 0 ; DATA XREF: Xinitialize+C2r seg005:0804ACA6 ; Xinitialize+DCr ... seg005:0804ACAA dword_804ACAA dd 0 ; DATA XREF: Xinitialize+19Er seg005:0804ACAA ; seg005:_RELTABo seg005:0804ACAE dword_804ACAE dd 0 ; DATA XREF: sub_8048120+30r seg005:0804ACAE ; seg005:_RELTABo seg005:0804ACB2 dword_804ACB2 dd 0 ; DATA XREF: Xinitialize+184r seg005:0804ACB2 ; sub_8048399+5Br ... seg005:0804ACB6 dword_804ACB6 dd 0 ; DATA XREF: Xinitialize+F4r seg005:0804ACB6 ; Xinitialize+10Er ... seg005:0804ACBA dword_804ACBA dd 0 ; DATA XREF: Xinitialize+18r seg005:0804ACBA ; Xinitialize+75r ... seg005:0804ACBE dword_804ACBE dd 0 ; DATA XREF: Xinitialize-49r seg005:0804ACBE ; seg005:_RELTABo seg005:0804ACBE seg005 ends seg005:0804ACBE seg005:0804ACBE seg005:0804ACBE end where error exactly: Code: seg000:00000034 ProgramHeader Elf32_Phdr <PT_LOAD, 0D4h, offset start, offset start, 605h, 605h, \ seg000:00000034 ; DATA XREF: seg000:stru_0o seg000:00000034 PF_X or PF_R, 1000h>; 0 ; "Xlib Fresh!" seg000:00000034 Elf32_Phdr <PT_LOAD, 6D9h, offset _title, offset _title, 0E1h, 2F1h, \ seg000:00000034 PF_W or PF_R, 1000h>; 1 seg000:00000034 Elf32_Phdr <PT_INTERP, 7BAh, offset aLibLdLinux_so_, \ seg000:00000034 offset aLibLdLinux_so_, 13h, 13h, PF_R, 1>; 2 seg000:00000034 Elf32_Phdr <PT_DYNAMIC, 7CDh, offset _DYNAMIC, offset _DYNAMIC, 58h, \ seg000:00000034 58h, PF_R, 1>; 3 seg000:00000034 Elf32_Phdr <PT_LOAD, 825h, offset _SYMTAB, offset _SYMTAB, 49Dh, 49Dh,\ seg000:00000034 PF_W or PF_R, 1000h>; 4 seg000:00000034 seg000 ends we can see that 2nd ProgramHeader entry has uninitialized data BUT next entry starts from address shifted by only amount of initialized data. That overlap don`t cause error at execution. BUT it is logicaly incorrect. maybe that related only outdate fasm versions (because fresh longtime not updated). Tomasz, please fix it if it still actual. By the way thanks John Found, I asking on forum for a long time for working linux GUI, in thour tool it always was there. (I looked one builded at most low level technology as possible (not higher than Xserver, because I`m hater of GTK and QT and similar ones - which are far far from low level technology). whole sources https://yadi.sk/d/Z2wr66TOK9pnIw (EXTRACTED FROM FRESH) with fasmw17324 tryed to assemble Xlib.asm, with fresh XLib.fpr - both bring to the same result - produced elf is valid - but present segment overlap in its segment (if it was PE not ELF - it will be unexecutable, but in case of ELF - I can`t agree than segment overlaping is good, especialy in cases when such overlap happend unpredictebly to programmer`s will). _________________ I don`t like to refer by "you" to one person. My soul requires acronim "thou" instead. |
|||
29 May 2020, 00:56 |
|
Tomasz Grysztar 29 May 2020, 13:47
See the announcement of 1.73.05 release for an explanation why segments PT_INTERP or PT_DYNAMIC have been made to overlap with contents of a PT_LOAD segment - otherwise they would not be loaded into memory at all, and this causes problems with implementations that assume otherwise.
I'm not sure if what you report is directly related, because I got a bit lost in your post, but the mention of overlapping segments gave me the suspicion. Please read the threads I linked to get a better understanding of what fasm needs to do when laying out the segments. If you find that there is nonetheless a bug there somewhere, please try to report it in a bit more clean way, preferably with a minimized source. Also keep in mind that with fasmg's elfexe.inc you can get the legacy behavior with ELF.Settings.LoadHeaders=0 option. |
|||
29 May 2020, 13:47 |
|
Tomasz Grysztar 29 May 2020, 16:44
ProMiNick wrote: In example I post interpreter overlapped with preciding not following segment, because of breaking requirement to interpreter segment to be first segment. ProMiNick wrote: (I gues example wasn`t fixed to have interpreter as 1st section). ProMiNick wrote: By the way how it should overlap? at begining or at the end of PT_LOAD segment? ProMiNick wrote: One more it is interpreter requirement. Interpreter itself isnt required? application could load itself to memory and apply relocs without needance in interpreter? |
|||
29 May 2020, 16:44 |
|
ProMiNick 29 May 2020, 18:54
Tomasz Grysztar wrote: I don't see it in your example. You have preceding segment at address 080496D9, which resides entirely in 08049xxx page (because its size is only 2F1h), and PT_INTERP is mapped at 0804A7BA, which is in 0804Axxx page and therefore should be mapped by the next PT_LOAD. 6D9h+2F1h=825h - start of segment after interpreter & dynamic (end of segment with uninit data) 6D9h+0E1h=7BAh - start of interpreter segment (end of init data - point where uninit data starts) _________________ I don`t like to refer by "you" to one person. My soul requires acronim "thou" instead. |
|||
29 May 2020, 18:54 |
|
Tomasz Grysztar 29 May 2020, 19:06
Your numbers do not add up, 6D9h+2F1h = 9CAh.
Also, they are offsets in file, not addresses in memory. In memory the end of segment with uninitialized data is 080499CAh (base 080496D9h + size 2F1h), while interpreter data is at 0804A7BAh, which is in the next page. PS. Your disassembly output looks a bit obscure, I would suggest posting something like the output of "readelf -l". |
|||
29 May 2020, 19:06 |
|
ProMiNick 29 May 2020, 19:24
I`m not linuxer, in linux I only launched program. But in linux I`m blind kitten - dosn`t knowing any its tools, so for disassembly I returned back to windows.
|
|||
29 May 2020, 19:24 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.