OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:22 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to use ACPICA
PostPosted: Sat Apr 29, 2023 1:11 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
I want to integrate acpica into my new OS, i will use it in a separate driver.

How can I compile it ? It gives me tons of errors (I don't bother using gcc)

OS : https://github.com/NXTdevosc1/New-Operating-System


Top
 Profile  
 
 Post subject: Re: How to use ACPICA
PostPosted: Sun Apr 30, 2023 5:31 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
I opened the acpi solution in generate/msvc and it generated all the executables, but only AcpiExec and AcpiSubsystem have no executable so I think they are the ones which I should link to. So now I should implement a copy of the imported win32 functions. But after linking both to my main.c the linker gives an "symbol already defined error".

From the wiki I know now that I only need the AcpiSubsystem object files, and it works.

It only gives me most unresolved externals from the OS layer functions.
But now there is functions such as "unresolved external symbol __acrt_iob_func, __imp_GetCurrentProcess" which I don't know how to handle those. I think they try to use kernel32.dll

Edit:
The AcpiSubsystem was not successfully compiled, it generates the error "__asm keyword not usable on x64 architecture" but if I compile it in x86 it works and it generates AcpiSubsystem.lib.

Now it somehow compiles my x64 executable with the library generated in x64 configuration but win32 platform, this is weird.


Top
 Profile  
 
 Post subject: Re: How to use ACPICA
PostPosted: Mon May 01, 2023 2:49 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
I finally succeeded in the compilation process (compiling my driver with the acpica lib), I did not tested because I still don't provide the full required os layer, but here is how I did it in windows in case you wonder (using msvc compiler):

- I opened up the solution in generate/msvc2017
I changed the build configuration from win32 to x64
I gone to AcpiSubsystem build config and created a new config (it shows 2 options either arm64 or x64 so I chose x64).
- In the AcpiSubsystem project configuration, I disabled security checks, enabled intrinsic functions and changed the WIN32 define to WIN64 in the compiler settings, then added 2 other defines.
- When it compiles it will generate a .lib file which I linked to my driver, now it gives unresolved externals to some stdlib functions like (strstr, nstrcmp...) which I copied from gcc library, then you remain with some other unresolved externs which you simply fix by including all the files from each directory in the project (you can find the file to include just by searching in the solution for the function which gives unresolved extern error).

- Then you copy all the oslayer from acpiosxf.h to an osl.c file or whatever you want to name, now you just fill the functions with a bunch of return 0; it should fix the other unresolved externals.
- I recommend running the vcvars64.bat before compiling.

Now the driver compiles finely and it's almost 700kb.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 56 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group