flat assembler
Message board for the users of flat assembler.

Index > Main > after FASMLIB v0.1 - where to continue?


which should be done first?
add linux heap management and fix string module
64%
 64%  [ 11 ]
add conversion and console input (and leave those inefficient)
35%
 35%  [ 6 ]
Total Votes : 17

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
hi, i have finnaly released FASMLIB v0.1. You can see it at http://board.flatassembler.net/topic.php?t=4696

it still contains several inefficiency problems

1. memory management on linux, which is done only via mmap(). That means smallest memory block is 4KB, eg. 100 dynamic strings takes 400KB. FASMLIB memory module is inteded to provide heap memory, but linux kernel doesn't have heap manager so we need to write our own.

2. string library is inefficient, doesn't have any compacting it's buffers after heavy use, reallocation is too often needed because string buffer size handling.

but fasmlib also misses many things, mainly input from console. This involves several ascii->data conversion routines, and we must incorporate buffering of input data - again it may be considerable amount of work.
Post 18 Sep 2006, 13:04
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
HyperVista



Joined: 18 Apr 2005
Posts: 691
Location: Virginia, USA
HyperVista
vid, thank you for all your hard work on FASMLIB. I know you're very busy in your own work and for you to take the time to work on this important aspect of FASM is very much appreciated.
fyi, I voted for adding heap management support in linux.

Thanks!
Post 18 Sep 2006, 14:16
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
vid, I manage to have free time for a few days and i like to devote it to the fasmlib. Today I'm going to study your just released version.
I'll be glad to contribute with the heap management support. Do you have a preference (intended design)?
Post 18 Sep 2006, 18:14
View user's profile Send private message Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
great, thanks. i got some link about alloc/free from mrpink: http://www-128.ibm.com/developerworks/linux/library/l-memory/

it shows basic. for now, i only want very basic working heap managent.

i want just linux version of mem.alloc and mem.free conforming to specs in doc/mem.txt. see my other procs for example of coding style, but that is NOT important (i anyway tend to edit all code myself. Their functionality could be something like in given example.

if you don't have experiences with linux, you can build it on win32, that's no problem, it's actual code that interests me. Soup around it can be added anytime.

Or you can even base your code on my mem.alloc, mem.realloc and mem.free, and name functions "heap.alloc" and "heap.free" - it really doesn't matter.

thanks very much, ask me if you have any problems

PS: tommorow i will be probably offline until at least 5 PM GMT+1 Sad
Post 18 Sep 2006, 21:49
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88
I would like to see support for SkyOS. I'm in charge of handing out Developer Access so you'd get access for free in a hurry if you say the word Smile

Just post a short application here if you're interested.

Thanks
Post 19 Sep 2006, 01:10
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
i was already discussing support for Dex4U OS. Generally, OS has to meet few things that FASMLIB awaits, and it is (roughly):
- flat mode
- program is always above 10000h
- file API must have open (for read/readwrite), create (overwriting/nonoverwriting, for read/readwrite), seek, read, write, close
- since we don't have heap manager, mem API must have alloc(), realloc() free() (this is why Dex can't be supported yet)
- API must have console output (in form roughly "output(buffer, size)")
- and few more, probably supported
Post 19 Sep 2006, 05:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
mattst: can't find memory management API description in skyos docs


Last edited by vid on 24 Sep 2006, 19:26; edited 1 time in total
Post 24 Sep 2006, 19:03
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
to the topic: i have realized i can't go further in any of these two problems without having static string library - so this is my next goal, then i will rewrite dynamic string library to be built atop of it. then also conversion module will work with static strings.
Post 24 Sep 2006, 19:21
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88
vid: All SkyOS memory management functions are POSIX compliant. We've got alloc, realloc, free, etc + mmap and friends.
Post 25 Sep 2006, 22:04
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
hmm, i thought POSIX compliant is brk() and mmap() only (Linux only has these). Or you have "libc" integrated into OS?
Post 26 Sep 2006, 04:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88
Ah, you are correct.

But yes, we do have a libc integrated into the OS (libsky) though there has been some discussion with replacing it all together with glibc.

I think in either case the functions you need are available.
Post 26 Sep 2006, 14:01
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
matttst: please give me some FASM example how to work with SkyOS, or preferably some asm-coding-releated documentation. i've read you use ELF, but what about calling standard, name decoration etc.?

then i will try to prepare some testing version for it and send to you. or maybe i could make version that generally links to libc?
Post 28 Sep 2006, 08:24
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
by the way, this documentation looks little weird, you must confess Wink
Post 28 Sep 2006, 08:26
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
tom tobias



Joined: 09 Sep 2003
Posts: 1320
Location: usa
tom tobias
Quote:

looks little weird

just typical C documentation, therefore useless.
Smile
Post 28 Sep 2006, 12:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17472
Location: In your JS exploiting you and your system
revolution
Quote:
just typical C documentation, therefore useless.
If that is typical C documentation then for sure it is useless. All the functions are either say "empty" or "Don't use this function!". Not very helpful.
Post 28 Sep 2006, 15:10
View user's profile Send private message Visit poster's website Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88
Here's a list of syscalls:

Code:
_sys_open                               =       0
_sys_close                              =       1
_sys_os_read                            =       2
_sys_write                              =       3
_sys_lseek                              =       4
_os_exit                                =       5
_sys_sysinfo                            =       6
_sys_set_quantum                        =       7

_sys_socket                             =       8
_sys_bind                               =       9
_sys_accept                             =       10

_sys_dup                                =       11
_sys_dup2                               =       12
_sys_connect                            =       13

_sys_spawn                              =       14
_sys_findfirst                          =       15
_sys_findnext                           =       16
_sys_chdir                              =       17

_sys_mount                              =       18
_sys_umount                             =       19
_sys_getcwd                             =       20
_sys_brk                                =       21
_sys_msgbox                             =       22
_sys_ioctl                              =       23
_sys_getpos                             =       24
_sys_module_alloc                       =       25
_sys_module_symbol_size                 =       26
_sys_module_get_symbolt                 =       27
_sys_module_init                        =       28
_sys_exec                               =       29
_call_v86                               =       30
_os_image_info                          =       31
_sys_get_ticks                          =       32
_sys_sendto                             =       33
_sys_recvfrom                           =       34
_sys_get_curtime                        =       35

_sys_shutdown                           =       37
_sys_readdir                            =       38
_sys_cpe_set                            =       39
_sys_createdir                          =       40
_sys_ramdisk                            =       41
_sys_sync                               =       42
_sys_cache_configure                    =       43
_sys_module_unload                      =       44
_sys_semaphore                          =       45
_sys_SystemInfo                         =       46
_sys_getpid                             =       47
_sys_gettaskname                        =       48
_sys_get_usec_counter                   =       49

_sys_RSMGetNodeByName                   =       51
_sys_RSMEnumNodes                       =       52
_sys_send                               =       53
_sys_recv                               =       54
_sys_listen                             =       55
_sys_ioctlsocket                        =       56
_sys_sleeptaskusec                      =       57
_sys_fsinfo                             =       58
_sys_RSMSetEntry                        =       59
_sys_debug_attach                       =       60
_sys_debug_action                       =       61
_sys_stat                               =       70
_sys_notify                             =       71
_sys_RSMGetEntry                        =       72
_sys_RSMIterEntry                       =       73
_sys_RegistryLoad                       =       74
_sys_statfs                             =       75
_sys_unlink                             =       76
_sys_GetMeasurePoint                    =       77
_sys_GetMeasurePointByIndex             =       78
_sys_GI_create_window                   =       100
_sys_GI_wait_message                    =       101
_sys_GI_rect                            =       102
_sys_GI_line                            =       103
_sys_GI_setpix                          =       104
_sys_GI_post_message                    =       105
_sys_GI_blit                            =       106
_sys_GI_text                            =       107
_sys_GI_set_timer                       =       108
_sys_GI_destroy_window                  =       109
_sys_GI_set_mouse_pointer               =       110
_sys_GI_get_resolution                  =       111
_sys_GI_setup_GFX                       =       112
_sys_GI_compute_screen_coordinates      =       113
_sys_GI_set_dimension                   =       114
_sys_GI_palette_set_logical             =       115
_sys_GI_beginpaint                      =       116
_sys_GI_endpaint                        =       117
_sys_GI_window_info                     =       118
_sys_GI_get_next_handle                 =       119
_sys_GI_window_set_state                =       120
_sys_GI_color_free                      =       121
_sys_GI_color_get                       =       122
_sys_GI_install_font                    =       123
_sys_GI_get_font                        =       124
_sys_GI_enum_fonts                      =       125
_sys_GI_capture_screen                  =       126
_sys_GI_sound_play                      =       127
_sys_GI_sound_setup                     =       128
_sys_GI_sound_max_buffer                =       129
_sys_GI_query_message                   =       130
_sys_GI_redraw_window                   =       131
_sys_closesocket                        =       132
_sys_kill                               =       133
_sys_task_info                          =       134
_sys_wait_for_task_state                =       135
_sys_syslog_set                         =       136
_sys_GI_copy_rect                       =       137
_sys_theme_get                          =       138
_sys_theme_set                          =       139
_sys_GI_mouse_get                       =       140
_sys_clipboard_add                      =       141
_sys_clipboard_get                      =       142
_sys_GI_kill_timer                      =       143
_sys_GI_circle                          =       144
_sys_SystemEventServices_Initialize     =       145
_sys_style_set                          =       146
_sys_style_get                          =       147
_sys_DllInfo                            =       148
_sys_DllLoad                            =       149
_sys_DllUnload                          =       150
_sys_DllGetFunction                     =       151
_sys_GI_redraw_region                   =       152
_sys_TimeDebug                          =       153
_sys_GI_request_fullscreen              =       154
_sys_SetKeyMap                          =       155
_sys_GI_GetResource                     =       156
_sys_GetNetStatistic                    =       157
_sys_GI_set_high_timer                  =       158
_sys_RSMGetNodeWithIndex                =       159

_sys_getsockopt                         =       160
_sys_setsockopt                         =       161
_sys_select                             =       162
_sys_sethostname                        =       163
_sys_gethostname                        =       164
_sys_isatty                             =       165
_sys_fcntl                              =       166
_sys_getsockname                        =       167
_sys_getpeername                        =       168
_sys_SetCapture                         =       169
_sys_GI_set_focus                       =       170
_sys_debug_data                         =       171
_sys_GI_SetWindowCap                    =       172
_sys_mem_dump                           =       173
_sys_settaskstate                       =       174
_sys_tasklogging                        =       175
_sys_seek                               =       176
_sys_system_busy                        =       177
_sys_fork                               =       178
_sys_waitpid                            =       179
_sys_utime                              =       180
_sys_GI_GetWindow                       =       181
_sys_GI_GetDataMessage                  =       182
_sys_RegisterMessageDumper              =       183
_sys_GI_SetWindowValue                  =       184
_sys_GI_Lock                            =       185
_sys_CheckBootOption                    =       186
_sys_GI_SetWindowBitmap                 =       187
_sys_GetBootKey                         =       188
_sys_GI_AddTransparentRect              =       189
_sys_GI_GetMousePos                     =       190
_sys_pipe                               =       191
_sys_ShdMem                             =       192
_sys_GI_SetMousePointerImage            =       193
_sys_NetFilterStart                     =       194
_sys_NetFilterGetNextPacket             =       195
_sys_opendir                            =       196
_sys_closedir                           =       197
_sys_listener_register                  =       198
_sys_listener_unregister                =       199
_sys_fs_initialize                      =       200
_sys_SendSignal                         =       201
_sys_SignalSetHandler                   =       202
_sys_return                             =       203
_sys_GetProcessImageName                =       204
_sys_GI_SetWindowTitle                  =       205
_sys_GI_WindowAtPointer                 =       206
_sys_rewinddir                          =       207
_sys_tls_alloc                          =       208
_sys_tls_free                           =       209
_sys_tls_set                            =       210
_sys_tls_get                            =       211
_sys_SystemEvent                        =       212
_sys_profile                            =       213
_sys_RegistrySerializeEnable            =       214
_sys_AttributeRead                      =       215
_sys_AttributeOpenDirectory             =       216
_sys_AttributeCloseDirectory            =       217
_sys_AttributeReadDirectory             =       218
_sys_GetApplicationDirectory            =       219

_sys_DataExchangePortRegister           =       220
_sys_DataExchangePortConnect            =       221
_sys_DataExchangePortRead               =       222
_sys_DataExchangePortWrite              =       223
_sys_DataExchangePortBlocking           =       224
_sys_DataExchangePortRelease            =       225
_sys_BootStep                           =       226
_sys_SwitchSecurityContext              =       227
_sys_uname                              =       228
_sys_GI_SetMousePos                     =       229
_sys_GI_HideMouseCursor                 =       230
_sys_GetFSCapability                    =       231
_sys_dump_fd                            =       232
_sys_sigprocmask                        =       233
_sys_setpgid                            =       234
_sys_getpgid                            =       235
_sys_getppid                            =       236
_sys_MapVirtualKey                      =       237
_sys_GI_register_accelerator            =       238
_sys_setsid                             =       239
_sys_getsid                             =       240
_sys_tweak                              =       241
_sys_GI_KeyStateGet                     =       242
_sys_GI_RaiseWindowToTop                =       243
_sys_rename                             =       244
_sys_GI_InjectMouseAction               =       245
_sys_GI_InjectKeyAction                 =       246
_sys_GI_GetMouseState                   =       247
_sys_MemoryMap                          =       248
_sys_MemoryUnMap                        =       249
_sys_usleep                             =       250
_sys_SemaphoreCreateEtc                 =       251
_sys_SemaphoreCreate                    =       252
_sys_SemaphoreDelete                    =       253
_sys_SemaphoreDeleteEtc                 =       254
_sys_SemaphoreAcquire                   =       255
_sys_SemaphoreAcquireEtc                =       256
_sys_SemaphoreRelease                   =       257
_sys_SemaphoreReleaseEtc                =       258
_sys_SemaphoreGetCount                  =       259
_sys_SemaphoreInfo                      =       260
_sys_DataExchangePortDataAvailable      =       261
_sys_ThreadResume                       =       262
_sys_TaskInfo                           =       263
_sys_GI_PosInWindow                     =       264
_sys_MultipleObjectWait                 =       265
_sys_MemoryMapGet                       =       266
_sys_SystemGetVolumeInformation         =       267
_sys_GetInternalOSVersion               =       268
_sys_symlink                            =       269
_sys_readlink                           =       270
_sys_DataExchangePortWriteTo            =       271
_sys_DataExchangePortWriteToBroadcast   =       272
_sys_ThreadSetPriority                  =       273
_sys_SystemNotificationsGet             =       274
_sys_sigsuspend                         =       275
_sys_GetPidOfTask                       =       276
_sys_alarm                              =       277
_sys_ThreadYield                        =       278
_sys_QueryOpen                          =       279
_sys_QueryClose                         =       280
_sys_QueryRead                          =       281
_sys_GetParentNode                      =       282
_sys_IndexCreate                        =       283
_sys_IndexRemove                        =       284
_sys_IndexOpen                          =       285
_sys_IndexRead                          =       286
_sys_IndexClose                         =       287
_sys_LastInputActivity                  =       288
_sys_GI_DirectAccess                    =       289
_sys_IsDebugKernel                      =       290
_sys_GetInternalBuildNumber             =       291
_sys_TaskLogData                        =       292
_sys_DragAndDropServiceStart            =       293
_sys_DragAndDropCancel                  =       294
_sys_DragAndDropDrop                    =       295
_sys_DragAndDropAllow                   =       296
_sys_GI_DragAndDropInProgress           =       297
_sys_GI_DragAndDropDeny                 =       298
_sys_GI_GetWindowValue                  =       299
_sys_fsync                              =       300
_sys_DesktopComposing                   =       301
_sys_GI_TranslationChanged              =       302
_sys_TaskFlagSet                        =       303
_sys_TaskFlagClear                      =       304
_sys_TaskFlagsGet                       =       305
_sys_gettimeofday                       =       306
_sys_GI_RegisterGestureExecutor         =       307
_sys_TraceAction                        =       308
_sys_sysconf                            =       309
_sys_MemAreaAlloc                       =       310
_sys_MemAreaMap                         =       311
_sys_GI_WindowSetIcon                   =       312
_sys_GI_WindowGetIcon                   =       313
_sys_UpdateMeasurePoint                 =       314
_sys_AddMeasurePoint                    =       315
_sys_HeapAlloc                          =       316
_sys_HeapResize                         =       317
_sys_ThreadDetach                       =       318
_sys_SecurityContextCheckCurrentProcess =       319
_sys_GI_set_window_mouse_pointer        =       320
_sys_listener_register_thread           =       321
_sys_CheckFilePermission                =       322
_sys_FilePermissionAuthentificate       =       323
_sys_GetFunctionName                    =       324
_sys_mmap                               =       325
_sys_munmap                             =       326
_sys_KernelDebuggerEnter                =       327
_sys_mprotect                           =       328
_sys_msync                              =       329
_sys_GI_WindowUnlink                    =       330
_sys_GI_WindowLink                      =       331
_sys_GI_compute_window_coordinates      =       332
_sys_GI_WindowOwnSet                    =       333
_sys_GIWM_LayerCommand                  =       334
_sys_GI_WindowSetDefaultColor           =       335
_sys_GI_WindowTransparency              =       336
_sys_chmod                              =       337
_sys_exit_code                          =       338
_sys_getprocesspid                      =       339
_sys_clipboard_clear                    =       340    


And here's a Hello World program: http://mattst88.no-ip.com:8181/skyos/?page=asm
Post 28 Sep 2006, 23:20
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
okay, just one note: what is register argument passing and preserving standard: eg. what about 5th and 6th argument? are they in ESI, EDI? Are reisteres preserved upon call?
Post 29 Sep 2006, 04:42
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88
In syscalls.h, it has this section:

Code:
#define ASMFMT_0()
#define ASMFMT_1(arg1) \
        , "acdSD" (arg1)
#define ASMFMT_2(arg1, arg2) \
        , "adSD" (arg1), "c" (arg2)
#define ASMFMT_3(arg1, arg2, arg3) \
        , "aSD" (arg1), "c" (arg2), "d" (arg3)
#define ASMFMT_4(arg1, arg2, arg3, arg4) \
        , "aD" (arg1), "c" (arg2), "d" (arg3), "S" (arg4)
#define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
        , "a" (arg1), "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5)    
.

I would assume that the argument passing order is eax, ecx, edx, esi, edi from looking at that code. I'll see if I can get a definite answer from Robert (SkyOS's developer) and let you know the answer.
Post 29 Sep 2006, 22:15
View user's profile Send private message Visit poster's website Reply with quote
mattst88



Joined: 12 May 2006
Posts: 260
Location: South Carolina
mattst88
Argument order is as follows:

ebx, ecx, edx, esi, edi

All registers are preserved. Return is in eax.

If you need 6 or more arguments, Robert says to make a structure and pass a pointer to it in the first argument.

Anything other info you might need?
Post 30 Sep 2006, 18:22
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.