minoca / os

Minoca operating system
Other
2.71k stars 231 forks source link

Intrin #147

Closed Alexcolom closed 6 years ago

Alexcolom commented 6 years ago

The use of intrinsics that are available in MSVC for input and output operations.

evangreen commented 6 years ago

Hi Alexander, This file is very old, it dates back to the very beginnings of Minoca OS. I wrote it before I had understood that inline assembly is very compiler-specific and non-standard. Since then, I have learned to avoid inline assembly, exactly because it locks you in to one compiler and makes future porting difficult.

The one other place I know of that we do this is in the FS_READ32 family of macros. There it was a tradeoff between the ugliness of inline assembly, and the ugliness of hardcoded structure offsets. Anyway, that's for later.

I've been meaning to ask, how are you assembling the .S files? Does Microsoft's assembler support GNU-as formatted assembly files? If not, then my answer below does not apply.

I think rather than putting in ugly ifdefs for each new compiler, the right change would be to delete this file and add a pair of ioport.S assembly files (for x86 and x64). You can use uefi/archlib/x86/ioport.S and uefi/archlib/x64/ioport.S as templates, and should really just need to change the function names.

Do you feel up for that?

Alexcolom commented 6 years ago

Hi Evan, I fully support your proposal for a separate ioport.S(for x86 and x64) file and is ready to reset the commit and redo my solution. Only I ask your advice about the unification of the functions of EfilioPort and HlIoPort - it may be worth including in a separate library or still leave two implementations of access to ports?

evangreen commented 6 years ago

I thought about trying to combine them into one library as well. I think since it's a relatively small set of simple functions, the duplicate files are okay.

Alexcolom commented 6 years ago

Hi Evan, I prepared two commits related to comments and file ioport.c ,but I have a few questions.

30 января 2018, 05:29:38, от "Evan Green" notifications@github.com:

I thought about trying to combine them into one library as well. I think since it's a relatively small set of simple functions, the duplicate files are okay. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

evangreen commented 6 years ago

Take a look at the man pages for 'git add', 'git rm', 'git status', and 'git log' (notice git log -p). That should help you understand how to add and remove files, and verify what changes are in a commit. In general git's man pages are very helpful, and can even help clarify tricky concepts like branching and rebasing.

The build.ck files are a new build system I've been working on. To try it out, cd into $SRCROOT/os and run mingen. Then cd into $SRCROOT/x86dbg/obj/os, and run ninja. My mingen tool can also create Makefiles: run mingen --format=make in $SRCROOT/os, then cd back into $SRCROOT/x86dbg/obj/os and run make. The new build system fixes a lot of deficiencies with the current recursive Makefile solution, but it's not activated by default quite yet. If you get confused editing build.ck, let me know and I can try to explain.

Alexcolom commented 6 years ago

Hi Evan, Assembly with changing iport and build.ck with make, mingen + ninja for x86 is going well, but for x64 I have not toollchain. It exists in Windows only for the x86 platform? To check the x64 platform, do I need Linux 64 with toolchain for x64 platform? --Olexandr.

31 января 2018, 06:30:59, от "Evan Green" notifications@github.com:

Take a look at the man pages for 'git add', 'git rm', 'git status', and 'git log' (notice git log -p). That should help you understand how to add and remove files, and verify what changes are in a commit. In general git's man pages are very helpful, and can even help clarify tricky concepts like branching and rebasing. The build.ck files are a new build system I've been working on. To try it out, cd into $SRCROOT/os and run mingen. Then cd into $SRCROOT/x86dbg/obj/os, and run ninja. My mingen tool can also create Makefiles: run mingen --format=make in $SRCROOT/os, then cd back into $SRCROOT/x86dbg/obj/os and run make. The new build system fixes a lot of deficiencies with the current recursive Makefile solution, but it's not activated by default quite yet. If you get confused editing build.ck, let me know and I can try to explain. — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.