flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Projects and Ideas > Another FreshLib based project - phWeb server.

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
Ray



Joined: 01 Dec 2015
Posts: 9
I tried to build phWeb with the latest Fresh IDE 2.2.5, but it throws errors during compilation. I tried for all 3 platforms:Win32, KolibriOS,Linux with no success. I'm personally interested only in KolibriOS version of phWeb.
Post 01 Dec 2015, 17:40
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
Well, this project has not been updated for a long time and is probably not compatible with the recent FreshLib changes. I will try to update the project today or tomorrow.

Notice that for KolibriOS, it works only with the network stack developed by hidnplayr. I am not sure it is already in the official distribution.
Post 01 Dec 2015, 18:42
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Ray



Joined: 01 Dec 2015
Posts: 9
Thanks!
Its already more than a year in the trunk and official KolibriOS builds.
Post 01 Dec 2015, 23:23
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
OK, I tested the project with the latest FreshLibDev version and actually it compiles at least for Win32 and Linux. There was some issues, but not related to the library.

You probably tried to compile the attached file from the first post, but it was really outdated. Now I deleted it in order to not mislead the readers anymore.

Instead, use the Fossil repository of phWeb. The best option is to clone it with Fossil and then locally check out and work. This way you will always get the latest changes and if you are willing to develop the project further I can give you write access to the repository in order to push the changes.

Now about KolibriOS port. There was some issues with the latest changes to the network stack, I updated the FreshLibDev branch on the Fresh IDE repository. These changes will be merged to the official version of Fresh IDE, but not instantly. So you need to checkout the FreshLIbDev branch and set your IDE "lib" alias to the directory of FreshLibDev: From the menu "Options|IDE options" and then select "lib" and press "Edit" button.

I know this procedure is long, but phWeb and especially the KolibriOS port are on the edge of FreshLib/Fresh IDE development and you will need to apply some efforts.

Regards
Post 02 Dec 2015, 14:32
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Ray



Joined: 01 Dec 2015
Posts: 9
Ok, thanks for that!
Post 02 Dec 2015, 17:09
View user's profile Send private message Reply with quote
Ray



Joined: 01 Dec 2015
Posts: 9
I tested latest changes of phWeb + FreshLibDev. Now phWeb can be compiled for all 3 supported platforms. I have tested Win32 version on WinXP and Linux version on Ubuntu. They worked good there.
Then I tried phWeb on the latest KolibriOS build and got PageFault exception. After debugging phWeb in mtdebug I've found two errors that lead to PageFault exception.
The first error is in the file "FreshLibDev/system/KolibriOS/files.asm" procedure "body FileRead" line "stdcall StrPtr, [esi+__TFile.hFilename]". It passes first 4 bytes of the string to eax instead of pointer to it. I replaced that line with "lea eax, [esi+__TFile.hFilename]".
The second one is in the file "phWeb/phWeb.asm" procedure "proc LoadConfiguration" line "stdcall StrCharCat, '.'". This procedure accepts two arguments instead of one. So I replaced it with "stdcall StrCharCat, eax, '.'".
Some more work needed to make phWeb work properly on Kolibri, but at least it doesn't fall with PageFault. I hope you can apply this changes to make phWeb be more stable.
Post 04 Dec 2015, 17:25
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
@Ray - The second bug is real. I missed it because it is in the fall back code, that is executed only if there is no "WebSite.DocumentRoot" option in the configuration file. Now it is fixed in the repository.

But the first bug reported is elsewhere. Actually, the problem is that the OS dependent procedure "FileOpenAccess" was not implemented at all. There was simply empty stub and it returned some trash instead of open file handle.

Now I implemented this procedure, so please update your library ("fossil revert", "fossil update" in the FreshLibDev directory). Unfortunately I can't test this code right now, so some bugs are still possible.
Post 04 Dec 2015, 22:57
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Ray



Joined: 01 Dec 2015
Posts: 9
I tried latest version of FreshLibDev with phWeb. There is still #PF because FileOpenAccess do not get control in proc CfgGetStr. mtdbg is very helpfull to step debug phWeb on Kolibri.
Post 05 Dec 2015, 18:03
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
Well, probably bugs in FileOpenAccess. I will try to setup some testing platform. It is hard to debug code without some way to run it. Wink
Post 05 Dec 2015, 18:24
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
I found where the problem is, but unfortunately there is no easy solution. CfgGetStr can work with filename string or open file handle as a input argument. In order to distinguish both it assumes all the pointers are above the first 64K and all the handles are below this limit. This is true in Linux and Windows but not in KolibriOS where the programs are loaded at address 0.
Post 06 Dec 2015, 11:27
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 14607
Location: Planet Dirt

JohnFound wrote:
I found where the problem is, but unfortunately there is no easy solution. CfgGetStr can work with filename string or open file handle as a input argument. In order to distinguish both it assumes all the pointers are above the first 64K and all the handles are below this limit. This is true in Linux and Windows but not in KolibriOS where the programs are loaded at address 0.

The sounds like a dangerous assumption even for Linux and Windows. Unless that is documented as part of the spec then the behaviour could change in a future update.
Post 06 Dec 2015, 11:51
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria

revolution wrote:
The sounds like a dangerous assumption even for Linux and Windows. Unless that is documented as part of the spec then the behaviour could change in a future update.



It is dangerous assumption. These assumptions are used only internally in FreshLib and are not part of the user interface, so I can always change them.

_________________
Tox ID: A48DEF727DF44C3B5C2E576B65021F1A45D8FA52E2F8E257F1CAE148BBADB162FDF7820BD1F9
Post 06 Dec 2015, 14:19
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
OK, with the latest commited versions of FreshLibDev and phWeb, the server starts in KolibriOS and even is able to serve one-two requests from the client. But I stuck on a problem that seems to be bug in the kernel. On random intervals, the listening socket hangs and stops to accept connections (system fn.75, subfn.5 simply hangs and does not return with or without error). The thread called SocketAccept hangs as well and it is not possible to kill it. This way, the whole OS have to be reboot.

For testing I am using QEMU as a KolibriOS machine and Firefox browser on the host machine. Of course some bugs in my code are also possible, but the fact that the hanging thread can not be killed indicates probably problem in the kernel.

_________________
Tox ID: A48DEF727DF44C3B5C2E576B65021F1A45D8FA52E2F8E257F1CAE148BBADB162FDF7820BD1F9
Post 10 Dec 2015, 17:39
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
hidnplayr



Joined: 13 Dec 2015
Posts: 8
I'm trying to compile phweb so I can debug the problem, but got stuck with the following error when compiling:

Code:
Illegal instruction << dproc __ProcessOneSystemEvent.hwnd.wmsg.wparam.lparam



PS: yes, I'm using latest source from fossil repositories.
Post 13 Dec 2015, 11:09
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
Welcome on FASM message board, hidnplayr. It is great to see you here! Smile


hidnplayr wrote:
PS: yes, I'm using latest source from fossil repositories.



Are you sure? "dproc" macro is deprecated in the latest FreshLibDev. Ensure you checked out FreshLib with "fossil co FreshLibDev". Also check the alias "%lib%" (or environment variable if you are using FASM for compilation).

Also, if you are using plain FASM, don't forget about environment variable "%TargetOS%" = "KolibriOS".

If the problem persists, please post the output of "fossil stat" in the directories of FreshLibDev and phWeb and describe in details your compilation process.

_________________
Tox ID: A48DEF727DF44C3B5C2E576B65021F1A45D8FA52E2F8E257F1CAE148BBADB162FDF7820BD1F9
Post 13 Dec 2015, 13:45
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
hidnplayr



Joined: 13 Dec 2015
Posts: 8
I'm using Fresh 2.2.5 (installer from fossil rep)


Code:
D:\freshlibdev>fossil stat
repository:   D:/freshlibdev/FreshLibDev.fossil
local-root:   D:/freshlibdev/
config-db:    C:/Users/hidnplayr/AppData/Local/_fossil
checkout:     5516a8f95d013d72b1187f98b2c40588865c31e8 2015-11-29 06:18:02 UTC
parent:       21f6f420b64b71e11a1a56dff69c97164fa5a5fe 2015-11-28 20:50:33 UTC
tags:         trunk
comment:      Missing release date fixed. (userjohnfound)




Code:
D:\kolibrios\phweb>fossil stat
repository:   D:/kolibrios/phweb/phWeb.fossil
local-root:   D:/kolibrios/phweb/
config-db:    C:/Users/hidnplayr/AppData/Local/_fossil
checkout:     c30e7bfb6602b915a3085c99d5601436b4ead5bc 2015-12-10 14:36:43 UTC
parent:       75d3e16e45a0b450d9231127fe921b12b7a88652 2015-12-04 23:12:48 UTC
tags:         trunk
comment:      Mainly added some debug output code in order to diagnose
              problems with KolibriOS port. (userjohnfound)



I changed directorys in fresh IDE for libs etc to point to "D:\freshlibdev"
Then I opened phWeb.fpr and hit ctrl+f9 in fresh IDE.
Post 13 Dec 2015, 14:27
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
You have checked out not the FreshLibDev branch, but the trunk branch of Fresh IDE. Please, enter the directory "D:/freshlibdev" and execute "fossil co FreshLibDev" then try to compile again. Notice that this will remove all the Fresh IDE code and only the FreshLib code will remain.

Check one more time the option TargetOS - see the screenshot. Of course, you can compile for Linux of Win32 as well.


Description: Screenshot.
Filesize: 6.49 KB
Viewed: 2073 Time(s)

KolibriOS.png


Post 13 Dec 2015, 14:56
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
hidnplayr



Joined: 13 Dec 2015
Posts: 8

JohnFound wrote:
You have checked out not the FreshLibDev branch, but the trunk branch of Fresh IDE.



Yes, that must have been the problem, I'm not used to this fossil system.
It assembles now, time to squash some bugs.
Post 13 Dec 2015, 15:15
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3415
Location: Bulgaria
Oh, fossil is great and in fact very easy, but still needs some learning. Smile

About the phWeb, notice that I still may be wrong and the problem is in FreshLib interfaces to the KolibriOS network functions. You can check them in "freshlib/system/KolibriOS/network.asm".
Post 13 Dec 2015, 15:33
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
hidnplayr



Joined: 13 Dec 2015
Posts: 8
JohnFound

Only problem noticed so far is stack corruption which results in page fault at address 0x4BE.

Edit1:
Perhaps freeing the stack and then using it is a bad idea Wink


Code:
; free the stack
        mov     eaxsys_f68
        mov     ebx13
        int     $40

        mov     [__ThreadLock], 0

        DebugMsg "Thread will be terminated now."    




Edit2:
Another problem has been found, in kernel indeed.
Need to investigate further.


Last edited by hidnplayr on 13 Dec 2015, 18:42; edited 1 time in total
Post 13 Dec 2015, 17:21
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  Next

< 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.