Author Topic: Solar Assembler location  (Read 13375 times)

mineiro

  • Member
  • ***
  • Posts: 365
Re: Solar Assembler location
« Reply #30 on: June 10, 2016, 03:32:20 AM »
I learned elfedit with you GoneFishing, thanks.
yes, I tested and it works, your solution using elfedit is more elegant.
It's a habit when switching from one O.S. to other, look, you have used .obj instead of .o. I get the point.

On linux x86_64 we have a lot of work to do with macros, we need at least 2 of then:
one to syscall (native) and others to libraries. Should check parameters of functions, stack alignment,preserving register across called functions, registers to stack (shadow space),stack balance, ... .  :lol:

invoke function,rdi,rsi,rdx,RCX,r8,r9, push, push, push,...
and need xmm registers to floating point numbers.

scall function,arg1,arg2,arg3,arg4,arg5,arg6
scall rax,rdi,rsi,rdx,r10,r8,r9

Well, better create a preprocessing program instead of macro. We are on a wild land by using assembly, but this is what I like.
I ask myself sometimes, why not learn C, why not learn C++.
Hmm, an insane person talking to a lazy person :dazzled:
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

GoneFishing

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: Solar Assembler location
« Reply #31 on: June 10, 2016, 04:10:32 AM »
You're welcome
How do you think, should we start a new separate thread for our further discussion and leave a little bit of free space here to Bogdan ?   

mineiro

  • Member
  • ***
  • Posts: 365
Re: Solar Assembler location
« Reply #32 on: June 10, 2016, 11:47:41 AM »
Good idea, we can discuss in a good sense on a new thread, so we can talk not only about solasm assembler, but jwasm too and their forks like hjwasm and casm, and maybe others assemblers.
Well, only to not  pollute this topic.

edited after
------------------------------------------------------
Well sir GoneFishing, I was thinking about and will be better if we create a new topic about solasm examples to linux x86-64, I can create that in a near future. I have started reading solasm documentation and I'm doing some experiments. This way this topic remains to sir Bogdan show info about news on solasm.
When I talked about other's assemblers it's because we can assemble a program inside windows and port that to linux, maybe an other topic to specific assemblers.
Thanks.
« Last Edit: June 10, 2016, 10:15:22 PM by mineiro »
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

BogdanOntanu

  • Global Moderator
  • Member
  • *****
  • Posts: 62
    • Solar_OS, Solar_Asm and HE RTS Game
Re: Solar Assembler location
« Reply #33 on: June 11, 2016, 10:14:27 AM »
Hi mineiro, Hi GoneFishing,

I am kind of busy learning for exams for IT university.
I am going to university again at "old" age ;)

I have noticed the Sol_asm bugs/problems you are talking about here.

As soon as I have some free time I will try to fix those issues and release a new version.

(after 11.06.2016 / my last exams for this year I hope ;) )

Ambition is a lame excuse for the ones not brave enough to be lazy, www.oby.ro

mineiro

  • Member
  • ***
  • Posts: 365
Re: Solar Assembler location
« Reply #34 on: June 12, 2016, 03:07:24 AM »
hello Sir Bogdan;
Good hear info about you and good luck on your's exams. Well, I'm half young and half older, at age 40 now, I continue souped.  :lol: . We get older only because body, but we can remain young forever. If the world need change simple because us, so we getting older, if we think that we can rule the world, were young.
I'm posting here some more info about solasm under linux world, so when you have time you can check.
I was not able to write/read data on a unitialized section, under linux it points to a code section instead of bss section.
I forgot now if I have tested this to initialized data section. Maybe an overview of elf header is necessary.

Other thing is about source code text new line codification. On linux a new line is LF, while on windows is CRLF, I do not have sure if macintosh is LFCR,
So, because recursion of some macros, an output is not valid.

I can be a beta tester on linux if you need, you can count with me.

Again, good luck on your It university.

Oh, I forgot to say, on solasm we can create labels like "opção" (option in portuguese), this is a good thing, does not remove this feature, latim (portuguese, spanish) programmers will like.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

mineiro

  • Member
  • ***
  • Posts: 365
Re: Solar Assembler location
« Reply #35 on: June 16, 2016, 04:39:11 AM »
Simple tests to be done, one work and another not, what I was thinking is change only command line and compile to both 32 and x864-64.

usage is: ./make_32 source

make_32.sh
Code: [Select]
sol32 $1.asm $1.o -elf32
ld -m elf_i386 -o $1 $1.o
./$1 ; echo $?
rm $1.o
make_x86_64.sh
Code: [Select]
sol32 $1.asm $1.o -elf64 $2 $3 $4
elfedit --output-mach x86-64 $1.o
ld -m elf_x86_64 -o $1 $1.o
./$1 ; echo $?
rm $1.o
macro.inc
Code: [Select]
MACRO string
MARG name, symbols :req
name db &symbols
sz&name equ $-&name
ENDM

/*
eg: sol32 source.asm source.o -elf64 -d check
this will create a fake (not valid) object file into this context but will count function parameters
need more work, how can I know if an function needs an address but we put [address]?,
this is valid to invoke and can generated errors that are hard to find
*/
#ifdef check
define ncall invoke
#endif

#ifdef -elf64

MACRO ncall
MARG nfunction :req, p1, p2, p3, p4, p5, p6

  #ifnb <&p6>
    mov r9,p6
  #endif

  #ifnb <&p5>
    mov r8,p5
  #endif

  #ifnb <&p4>
    mov rcx,p4
  #endif

  #ifnb <&p3>
    mov rdx,p3
  #endif

  #ifnb <&p2>
    mov rsi,p2
  #endif

  #ifnb <&p1>
    mov rdi,p1
  #endif

  mov rax,nfunction
  syscall

ENDM
#endif

#ifdef -elf32

MACRO ncall
MARG nfunction :req, p1, p2, p3, p4, p5, p6

  #ifnb <&p6>
    mov ebp,p6
  #endif

  #ifnb <&p5>
    mov edi,p5
  #endif

  #ifnb <&p4>
    mov esi,p4
  #endif

  #ifnb <&p3>
    mov edx,p3
  #endif

  #ifnb <&p2>
    mov ecx,p2
  #endif

  #ifnb <&p1>
    mov ebx,p1
  #endif

  mov eax,nfunction
  int 80h

ENDM
#endif
unistd.inc
Code: [Select]
stdin equ 0
stdout          equ     1
stderr equ 2

;just to count functions parameters, so can report errors
import sys_write [3] ;fd,ptr buf,count
import sys_exit [1] ;status


;no holes allowed into syscall enumeration

#ifdef -elf64
      ENUM Native,0,314
      sys_read
      sys_write
      sys_open
      sys_close
      sys_newstat
      sys_newfstat
      sys_newlstat
      sys_poll
      sys_lseek
      sys_mmap
      sys_mprotect
      sys_munmap
      sys_brk
      sigaction
      sigprocmask
      rt_sigreturn
      sys_ioctl
      sys_pread64
      sys_pwrite64
      sys_readv
      sys_writev
      sys_access
      sys_pipe
      sys_select
      sys_sched_yield
      sys_mremap
      sys_msync
      sys_mincore
      sys_madvise
      sys_shmget
      sys_shmat
      sys_shmctl
      sys_dup
      sys_dup2
      sys_pause
      sys_nanosleep
      sys_getitimer
      sys_alarm
      sys_setitimer
      sys_getpid
      sys_sendfile64
      sys_socket
      sys_connect
      sys_accept
      sys_sendto
      sys_recvfrom
      sys_sendmsg
      sys_recvmsg
      sys_shutdown
      sys_bind
      sys_listen
      sys_getsockname
      sys_getpeername
      sys_socketpair
      sys_setsockopt
      sys_getsockopt
      stub_clone
      stub_fork
      stub_vfork
      stub_execve
      sys_exit
      sys_wait4
      sys_kill
      sys_newuname
      sys_semget
      sys_semop
      sys_semctl
      sys_shmdt
      sys_msgget
      sys_msgsnd
      sys_msgrcv
      sys_msgctl
      sys_fcntl
      sys_flock
      sys_fsync
      sys_fdatasync
      sys_truncate
      sys_ftruncate
      sys_getdents
      sys_getcwd
      sys_chdir
      sys_fchdir
      sys_rename
      sys_mkdir
      sys_rmdir
      sys_creat
      sys_link
      sys_unlink
      sys_symlink
      sys_readlink
      sys_chmod
      sys_fchmod
      sys_chown
      sys_fchown
      sys_lchown
      sys_umask
      sys_gettimeofday
      sys_getrlimit
      sys_getrusage
      sys_sysinfo
      sys_times
      sys_ptrace
      sys_getuid
      sys_syslog
      sys_getgid
      sys_setuid
      sys_setgid
      sys_geteuid
      sys_getegid
      sys_setpgid
      sys_getppid
      sys_getpgrp
      sys_setsid
      sys_setreuid
      sys_setregid
      sys_getgroups
      sys_setgroups
      sys_setresuid
      sys_getresuid
      sys_setresgid
      sys_getresgid
      sys_getpgid
      sys_setfsuid
      sys_setfsgid
      sys_getsid
      sys_capget
      sys_capset
      sys_rt_sigpending
      sys_rt_sigtimedwait
      sys_rt_sigqueueinfo
      sys_rt_sigsuspend
      stub_sigaltstack
      sys_utime
      sys_mknod
      sys_ni_syscall
      sys_personality
      sys_ustat
      sys_statfs
      sys_fstatfs
      sys_sysfs
      sys_getpriority
      sys_setpriority
      sys_sched_setparam
      sys_sched_getparam
      sys_sched_setscheduler
      sys_sched_getscheduler
      sys_sched_get_priority_max
      sys_sched_get_priority_min
      sys_sched_rr_get_interval
      sys_mlock
      sys_munlock
      sys_mlockall
      sys_munlockall
      sys_vhangup
      sys_modify_ldt
      sys_pivot_root
      sys_sysctl
      sys_prctl
      sys_arch_prctl
      sys_adjtimex
      sys_setrlimit
      sys_chroot
      sys_sync
      sys_acct
      sys_settimeofday
      sys_mount
      sys_umount
      sys_swapon
      sys_swapoff
      sys_reboot
      sys_sethostname
      sys_setdomainname
      stub_iopl
      sys_ioperm
      sys_create_module
      sys_init_module
      sys_delete_module
      sys_get_kernel_syms
      sys_query_module
      sys_quotactl
      sys_nfsservctl
      sys_getpmsg
      sys_putpmsg
      sys_afs_syscall
      sys_tuxcall
      sys_security
      sys_gettid
      sys_readahead
      sys_setxattr
      sys_lsetxattr
      sys_fsetxattr
      sys_getxattr
      sys_lgetxattr
      sys_fgetxattr
      sys_listxattr
      sys_llistxattr
      sys_flistxattr
      sys_removexattr
      sys_lremovexattr
      sys_fremovexattr
      sys_tkill
      sys_time
      sys_futex
      sys_sched_setaffinity
      sys_sched_getaffinity
      sys_set_thread_area
      sys_io_setup
      sys_io_destroy
      sys_io_getevents
      sys_io_submit
      sys_io_cancel
      sys_get_thread_area
      sys_lookup_dcookie
      sys_epoll_create
      sys_epoll_ctl_old
      sys_epoll_wait_old
      sys_remap_file_pages
      sys_getdents64
      sys_set_tid_address
      sys_restart_syscall
      sys_semtimedop
      sys_fadvise64
      sys_timer_create
      sys_timer_settime
      sys_timer_gettime
      sys_timer_getoverrun
      sys_timer_delete
      sys_clock_settime
      sys_clock_gettime
      sys_clock_getres
      sys_clock_nanosleep
      sys_exit_group
      sys_epoll_wait
      sys_epoll_ctl
      sys_tgkill
      sys_utimes
      sys_vserver
      sys_mbind
      sys_set_mempolicy
      sys_get_mempolicy
      sys_mq_open
      sys_mq_unlink
      sys_mq_timedsend
      sys_mq_timedreceive
      sys_mq_notify
      sys_mq_getsetattr
      sys_kexec_load
      sys_waitid
      sys_add_key
      sys_request_key
      sys_keyctl
      sys_ioprio_set
      sys_ioprio_get
      sys_inotify_init
      sys_inotify_add_watch
      sys_inotify_rm_watch
      sys_migrate_pages
      sys_openat
      sys_mkdirat
      sys_mknodat
      sys_fchownat
      sys_futimesat
      sys_newfstatat
      sys_unlinkat
      sys_renameat
      sys_linkat
      sys_symlinkat
      sys_readlinkat
      sys_fchmodat
      sys_faccessat
      sys_pselect6
      sys_ppoll
      sys_unshare
      sys_set_robust_list
      sys_get_robust_list
      sys_splice
      sys_tee
      sys_sync_file_range
      sys_vmsplice
      sys_move_pages
      sys_utimensat
      sys_epoll_pwait
      sys_signalfd
      sys_timerfd_create
      sys_eventfd
      sys_fallocate
      sys_timerfd_settime
      sys_timerfd_gettime
      sys_accept4
      sys_signalfd4
      sys_eventfd2
      sys_epoll_create1
      sys_dup3
      sys_pipe2
      sys_inotify_init1
      sys_preadv
      sys_pwritev
      sys_rt_tgsigqueueinfo
      sys_perf_event_open
      sys_recvmmsg
      sys_fanotify_init
      sys_fanotify_mark
      sys_prlimit64
      sys_name_to_handle_at
      sys_open_by_handle_at
      sys_clock_adjtime
      sys_syncfs
      sys_sendmmsg
      sys_setns
      sys_getcpu
      sys_process_vm_readv
      sys_process_vm_writev
      sys_kcmp
      sys_finit_module
      ENDE
#endif

#ifdef -elf32

      ENUM Native,0,348
      sys_restart_syscall
      sys_exit
      sys_fork
      sys_read
      sys_write
      sys_open
      sys_close
      sys_waitpid
      sys_creat
      sys_link
      sys_unlink
      sys_execve
      sys_chdir
      sys_time
      sys_mknod
      sys_chmod
      sys_lchown
      sys_break
      sys_oldstat
      sys_lseek
      sys_getpid
      sys_mount
      sys_umount
      sys_setuid
      sys_getuid
      sys_stime
      sys_ptrace
      sys_alarm
      sys_oldfstat
      sys_pause
      sys_utime
      sys_stty
      sys_gtty
      sys_access
      sys_nice
      sys_ftime
      sys_sync
      sys_kill
      sys_rename
      sys_mkdir
      sys_rmdir
      sys_dup
      sys_pipe
      sys_times
      sys_prof
      sys_brk
      sys_setgid
      sys_getgid
      sys_signal
      sys_geteuid
      sys_getegid
      sys_acct
      sys_umount2
      sys_lock
      sys_ioctl
      sys_fcntl
      sys_mpx
      sys_setpgid
      sys_ulimit
      sys_oldolduname
      sys_umask
      sys_chroot
      sys_ustat
      sys_dup2
      sys_getppid
      sys_getpgrp
      sys_setsid
      sys_sigaction
      sys_sgetmask
      sys_ssetmask
      sys_setreuid
      sys_setregid
      sys_sigsuspend
      sys_sigpending
      sys_sethostname
      sys_setrlimit
      sys_getrlimit
      sys_getrusage
      sys_gettimeofday
      sys_settimeofday
      sys_getgroups
      sys_setgroups
      sys_select
      sys_symlink
      sys_oldlstat
      sys_readlink
      sys_uselib
      sys_swapon
      sys_reboot
      sys_readdir
      sys_mmap
      sys_munmap
      sys_truncate
      sys_ftruncate
      sys_fchmod
      sys_fchown
      sys_getpriority
      sys_setpriority
      sys_profil
      sys_statfs
      sys_fstatfs
      sys_ioperm
      sys_socketcall
      sys_syslog
      sys_setitimer
      sys_getitimer
      sys_stat
      sys_lstat
      sys_fstat
      sys_olduname
      sys_iopl
      sys_vhangup
      sys_idle
      sys_vm86old
      sys_wait4
      sys_swapoff
      sys_sysinfo
      sys_ipc
      sys_fsync
      sys_sigreturn
      sys_clone
      sys_setdomainname
      sys_uname
      sys_modify_ldt
      sys_adjtimex
      sys_mprotect
      sys_sigprocmask
      sys_create_module
      sys_init_module
      sys_delete_module
      sys_get_kernel_syms
      sys_quotactl
      sys_getpgid
      sys_fchdir
      sys_bdflush
      sys_sysfs
      sys_personality
      sys_afs_syscall
      sys_setfsuid
      sys_setfsgid
      sys__llseek
      sys_getdents
      sys__newselect
      sys_flock
      sys_msync
      sys_readv
      sys_writev
      sys_getsid
      sys_fdatasync
      sys__sysctl
      sys_mlock
      sys_munlock
      sys_mlockall
      sys_munlockall
      sys_sched_setparam
      sys_sched_getparam
      sys_sched_setscheduler
      sys_sched_getscheduler
      sys_sched_yield
      sys_sched_get_priority_max
      sys_sched_get_priority_min
      sys_sched_rr_get_interval
      sys_nanosleep
      sys_mremap
      sys_setresuid
      sys_getresuid
      sys_vm86
      sys_query_module
      sys_poll
      sys_nfsservctl
      sys_setresgid
      sys_getresgid
      sys_prctl
      sys_rt_sigreturn
      sys_rt_sigaction
      sys_rt_sigprocmask
      sys_rt_sigpending
      sys_rt_sigtimedwait
      sys_rt_sigqueueinfo
      sys_rt_sigsuspend
      sys_pread64
      sys_pwrite64
      sys_chown
      sys_getcwd
      sys_capget
      sys_capset
      sys_sigaltstack
      sys_sendfile
      sys_getpmsg
      sys_putpmsg
      sys_vfork
      sys_ugetrlimit
      sys_mmap2
      sys_truncate64
      sys_ftruncate64
      sys_stat64
      sys_lstat64
      sys_fstat64
      sys_lchown32
      sys_getuid32
      sys_getgid32
      sys_geteuid32
      sys_getegid32
      sys_setreuid32
      sys_setregid32
      sys_getgroups32
      sys_setgroups32
      sys_fchown32
      sys_setresuid32
      sys_getresuid32
      sys_setresgid32
      sys_getresgid32
      sys_chown32
      sys_setuid32
      sys_setgid32
      sys_setfsuid32
      sys_setfsgid32
      sys_pivot_root
      sys_mincore
      sys_madvise
      sys_madvise1
      sys_getdents64
      sys_fcntl64
      sys_gettid
      sys_readahead
      sys_setxattr
      sys_lsetxattr
      sys_fsetxattr
      sys_getxattr
      sys_lgetxattr
      sys_fgetxattr
      sys_listxattr
      sys_llistxattr
      sys_flistxattr
      sys_removexattr
      sys_lremovexattr
      sys_fremovexattr
      sys_tkill
      sys_sendfile64
      sys_futex
      sys_sched_setaffinity
      sys_sched_getaffinity
      sys_set_thread_area
      sys_get_thread_area
      sys_io_setup
      sys_io_destroy
      sys_io_getevents
      sys_io_submit
      sys_io_cancel
      sys_fadvise64
      sys_exit_group
      sys_lookup_dcookie
      sys_epoll_create
      sys_epoll_ctl
      sys_epoll_wait
      sys_remap_file_pages
      sys_set_tid_address
      sys_timer_create
      sys_timer_settime
      sys_timer_gettime
      sys_timer_getoverrun
      sys_timer_delete
      sys_clock_settime
      sys_clock_gettime
      sys_clock_getres
      sys_clock_nanosleep
      sys_statfs64
      sys_fstatfs64
      sys_tgkill
      sys_utimes
      sys_fadvise64_64
      sys_vserver
      sys_mbind
      sys_get_mempolicy
      sys_set_mempolicy
      sys_mq_open
      sys_mq_unlink
      sys_mq_timedsend
      sys_mq_timedreceive
      sys_mq_notify
      sys_mq_getsetattr
      sys_kexec_load
      sys_waitid
      sys_add_key
      sys_request_key
      sys_keyctl
      sys_ioprio_set
      sys_ioprio_get
      sys_inotify_init
      sys_inotify_add_watch
      sys_inotify_rm_watch
      sys_migrate_pages
      sys_openat
      sys_mkdirat
      sys_mknodat
      sys_fchownat
      sys_futimesat
      sys_fstatat64
      sys_unlinkat
      sys_renameat
      sys_linkat
      sys_symlinkat
      sys_readlinkat
      sys_fchmodat
      sys_faccessat
      sys_pselect6
      sys_ppoll
      sys_unshare
      sys_set_robust_list
      sys_get_robust_list
      sys_splice
      sys_sync_file_range
      sys_tee
      sys_vmsplice
      sys_move_pages
      sys_getcpu
      sys_epoll_pwait
      sys_utimensat
      sys_signalfd
      sys_timerfd_create
      sys_eventfd
      sys_fallocate
      sys_timerfd_settime
      sys_timerfd_gettime
      sys_signalfd4
      sys_eventfd2
      sys_epoll_create1
      sys_dup3
      sys_pipe2
      sys_inotify_init1
      sys_preadv
      sys_pwritev
      sys_rt_tgsigqueueinfo
      sys_perf_event_open
      sys_recvmmsg
      sys_fanotify_init
      sys_fanotify_mark
      sys_prlimit64
      sys_name_to_handle_at
      sys_open_by_handle_at
      sys_clock_adjtime
      sys_syncfs
      sys_sendmmsg
      sys_setns
      sys_process_vm_readv
      sys_process_vm_writev
      ENDE

#endif

write.asm
Code: [Select]
section "text" class_code alias ".text"
section "data" class_data alias ".data"

lf equ 10

.USE64

include ../native/unistd.inc
include ../macro/macro.inc

.data
string msg_01 <"x86-64 native system calls:",lf,"syscall rax,rdi,rsi,rdx,r10,r8,r9",lf,"return: rax rdx",lf>
string msg_02 <"Registers that should be preserved accross function calls:",lf,"rbx,rbp,rsp,r12,r13,r14,r15",lf,lf>
string msg_03 <"x86-64 C function libraries:",lf,"call function,rdi,rsi,rdx,rcx,r8,r9",lf>

.text
.entry _start
_start:

ncall sys_write,stdout,msg_01,szmsg_01
ncall sys_write,stdout,msg_02,szmsg_02
ncall sys_write,stdout,msg_03,szmsg_03
ncall sys_exit,0 ;should have one "new line" at the end? or generate an error
read.asm
Code: [Select]
section "text" class_code alias ".text"
section "data" class_data alias ".data"
section "bss" class_bss alias ".bss"

lf equ 10

.USE64

include ../native/unistd.inc
include ../macro/macro.inc

.bss
buffer1 rq 1 ;<----section is created but reserved data no

.data
string msg_01 < "type anything",lf >
string msg_02 < "right",lf >
string msg_03 < "wrong",lf >
buffer dq 1

.text
.entry _start
_start:

ncall sys_write,stdout,msg_01,szmsg_01
;ncall sys_read,stdin,buffer1,8 ;buffer1 is not reserved into this section
ncall sys_read,stdin,buffer,8
mov rax, [buffer]
;.if rax == swap "anything" --->*Error** Mini string is too big: "gnihtyna"
;.if rax == "gnihtyna" ;--->*Error** Mini string is too big: "gnihtyna"
cmp rax, qword "gnihtyna" ;--->cmp rax,74796E61
jne not_right
ncall sys_write,stdout,msg_02,szmsg_02
jmp skip
not_right:
ncall sys_write,stdout,msg_03,szmsg_03
skip:
ncall sys_exit,0
That rax register can be eax register, so I can create a macro like rax|eax==r00, this way we can reach portability.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

BogdanOntanu

  • Global Moderator
  • Member
  • *****
  • Posts: 62
    • Solar_OS, Solar_Asm and HE RTS Game
Re: Solar Assembler location
« Reply #36 on: July 02, 2016, 08:06:17 AM »
Hi all,

I have released a new Sol_Asm version here:

http://www.oby.ro/sol_asm/files/sol_asm_2016_07_01_v36_28.zip

I have added  a "lin64" keyword for Unix System V ABI used in invoke and proc
you can also use the "varg" keyword to signal a variable arguments procedure or imported function.
(the manual is not yet updated)

I have also added two Linux elf64 samples and a Ubuntu 14.04 LTS pre compiled binary for sol_asm2.


Ambition is a lame excuse for the ones not brave enough to be lazy, www.oby.ro

GoneFishing

  • Member
  • ****
  • Posts: 950
  • Gone fishing
Re: Solar Assembler location
« Reply #37 on: July 02, 2016, 07:14:40 PM »
Hi Bogdan,
I hope you've passed your exams in IT university .

Thank you for releasing new version of SOL_ASM  with new LIN64 features . I've  built lin64 samples on my UBUNTU 14.04 .
All worked fine.

Thanks again  :t

mineiro

  • Member
  • ***
  • Posts: 365
Re: Solar Assembler location
« Reply #38 on: July 02, 2016, 10:19:19 PM »
Hello sir Bodgan,
The same, I hope you've passed your exams in IT university.

Good news, I build your examples and worked fine. Today I'm busy painting a wall into my house, but at night I can do more tests.

I have seen that for a while we are not able to write into global variables. Maybe sir GoneFishing can test too.

This is a test piece.
Code: [Select]
section "text" class_code alias ".text"
section "data" class_data alias ".data"
section "bss" class_bss alias ".bss"

exit equ 60

.USE64

.data
temp2 dq 0

.bss
temp rq 1

.text
.entry _start
_start:
mov [temp2],exit
mov rcx,[temp2]
mov [temp],rcx
mov rax,[temp]
syscall

I think the answer to this is relocation or maybe a symbol table. A command line 'objdump -x source.o' show me this. I will study this case with more attention at night, for a while it's just a supposition. I have seen on others object files a section like .rodata but I never have tried create this section.

Good work sir, I know that I can call a function to reserve memory space like 'globalalloc' on windows, mmap on linux and have a global data area with r/w/x permissions, so I know how to walk on this subject, I'm just posting what I'm finding.

Now we (users) have invoke, and this speedup code a lot and turns code more easy to read. So, I only have words to say thank you Bogdan.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

BogdanOntanu

  • Global Moderator
  • Member
  • *****
  • Posts: 62
    • Solar_OS, Solar_Asm and HE RTS Game
Re: Solar Assembler location
« Reply #39 on: July 03, 2016, 06:57:47 AM »
Hi mineiro, Hi GoneFishing,

Yes I have passed almost all of my university exams with max scores... ;)
(well I still have to find the result to one of the last exams but I hope it is ok)

Thank you both for testing Sol_Asm on Linux 64 bits ;)

I will also check the .bss  variables issues you reported and fix them when I find the bug /problem.
I will try to add an Linux 64 syscall invoke in next releases

Let me know what other stuff you think it is important / useful for Linux 64 / 32 bits ASM programming
Ambition is a lame excuse for the ones not brave enough to be lazy, www.oby.ro

mineiro

  • Member
  • ***
  • Posts: 365
Re: Solar Assembler location
« Reply #40 on: July 03, 2016, 09:55:17 PM »
Wow, max scores, this is the man, flawless victory.  :icon_cool:

Thanks for updating solasm, I like so much your macro approach, it's minimalistic approach with maximalistic power, original idea. I'm doing a paralell study here about object files on linux world, I start today. My intention is to create a object file by hand making.

Good job sir Bogdan.

Can you check this:
Code: [Select]
.text
.entry _start
_start:

mov al,byte [rip] ;Unknown address expresion in [] : rip
nop
;solasm generate correct code on list 1 but on list 2 that's is removed, need a prefix byte '67h' before
; mov al,[rip] ;8A 05 FC FF FF FF
;nop ;90
; 67 8A 05 FC FF FF FF
« Last Edit: July 04, 2016, 03:17:48 AM by mineiro »
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

BogdanOntanu

  • Global Moderator
  • Member
  • *****
  • Posts: 62
    • Solar_OS, Solar_Asm and HE RTS Game
Re: Solar Assembler location
« Reply #41 on: July 05, 2016, 03:04:47 AM »
Hi mineiro,

Yes I will check the issue ;)
Ambition is a lame excuse for the ones not brave enough to be lazy, www.oby.ro

BogdanOntanu

  • Global Moderator
  • Member
  • *****
  • Posts: 62
    • Solar_OS, Solar_Asm and HE RTS Game
Re: Solar Assembler location
« Reply #42 on: July 07, 2016, 06:41:38 AM »
Hi all,

There is a new version for Sol_Asm v0.36.32 here:
http://www.oby.ro/sol_asm/files/sol_asm_2016_07_05_v36_32.zip

It fixes the .bss issue for ELF64 on Linux.

I am thinking to restart the forums in order to avoid too many messages about Sol_Asm here ;)

@mineiro:

I do not think that rip is a register known to Sol_Asm
(there is no encoding for RIP register in x64)

I guess that it is considered an "yet to be resolved" symbol in first pass and not found in second pass
Ambition is a lame excuse for the ones not brave enough to be lazy, www.oby.ro

Vortex

  • Member
  • *****
  • Posts: 1692
Re: Solar Assembler location
« Reply #43 on: July 07, 2016, 07:18:39 AM »
Hi Bogdan,

Congratulations on your examination scores :t

If you reactivate the Solar forums, could you enable the attachment feature? It's very unpleasant to depend on file sharing sites to send links to your forums. Thanks.

mineiro

  • Member
  • ***
  • Posts: 365
Re: Solar Assembler location
« Reply #44 on: July 07, 2016, 08:05:34 AM »
Hello sir Bogdan;
Thanks, I'm downloading now your new solasm version and putting my fingers on it. All of this time and I only have build an elf header on a structured way using -binary switch. I have see that solasm accepts some keywords about C headers, I was changing all to equates, ..., old customs. I'm slow to code because I read a lot, think a lot and code a little.  :lol:

That previous code about 'rip' move to al register 90h (nop). I think that this is about PIC (position independent code).
Code: [Select]
; New method
mov ah, [rip] ; RIP points to the next instruction aka NOP
nop

; Alternative new method
lea rbx, [rip] ; RBX now points to the next instruction
nop
cmp byte ptr [rbx], 90h ; Should be equal!

; Old method (using 64-bit addressing!)
call $ + 5 ; A 64-bit call instruction is still 5 bytes wide!
pop rbx
add rbx, 5 ; RBX now points to the next instruction aka NOP
nop
mov al, [rbx]

; AH and AL should now be equal :)
cmp ah, al
source: http://www.codegurus.be/Programming/riprelativeaddressing_en.htm

Sounds interesting reactivating your forum.
I'd rather be this ambulant metamorphosis than to have that old opinion about everything