flat assembler
Message board for the users of flat assembler.
Index
> Main > fasm for MacOS (intel CPU) |
Author |
|
m 31 Jan 2008, 09:01
do we have fasm for MacOS?
i have mac with intel processor. _________________ Attitude! |
|||
31 Jan 2008, 09:01 |
|
m 31 Jan 2008, 09:54
thanks i will wait.
|
|||
31 Jan 2008, 09:54 |
|
OzzY 31 Jan 2008, 23:19
Is it possible to install Mac OS for Intel together with Windows XP and Linux?
I'd like to try it. |
|||
31 Jan 2008, 23:19 |
|
HyperVista 01 Feb 2008, 01:22
Hi Ozzy - Parallels hypervisor product (it's a true hypervisor, by the way) allows a Mac user to run Windows and Linux on the Mac. I'm not sure if Xen will allow you to run Mac on a x86 box but it sure will allow you to run Linux and Windows simultaneously on the same box.
|
|||
01 Feb 2008, 01:22 |
|
f0dder 01 Feb 2008, 10:56
OS X runs on stock x86 hardware, Apple moved away from non-x86 quite a while ago.
However, there's two issues. The first is that there's limited driver support, since Apple only support the hardware they ship themselves. The second is that Apple are monopolist bigots and only want OS X to run on "their hardware". But you can find patches that'll allow you to run OS X on (most) standard PCs (assuming you have compatible hardware), either on real machines or in vmware/whatever. |
|||
01 Feb 2008, 10:56 |
|
AlexP 02 Feb 2008, 15:35
I believe that mac's should be shot and killed on sight .
|
|||
02 Feb 2008, 15:35 |
|
rugxulo 02 Feb 2008, 17:46
I started a poll here to see how many people would use this.
|
|||
02 Feb 2008, 17:46 |
|
f0dder 03 Feb 2008, 23:26
AlexP wrote: I believe that mac's should be shot and killed on sight . You mean "macs" and not "mac's", right? You're an Amerikan and don't know when to insert the apostrophe? >_< Do you mean macs, or mac users? And why? _________________ - carpe noctem |
|||
03 Feb 2008, 23:26 |
|
hawk 04 Apr 2008, 22:27
Well, I have a working "libc fasm" on my Mac (as of now ) thanks to objconv ( http://www.agner.org/optimize/#objconv ) and to BogdanOntanu who started me up on this.
You have it attached. Basically it's not very complicated once you have objconv converting the ELF object file intro Mach-O object file, however there are some (minor?) glitches: 1. For some reason objconv doesn't like the elf format that fasm produces in that it can't convert the external references to have an underline in front - you have to manually change fseek to _fseek and so on 2. The bigger problem is that MacOS requires (stupidly, perhaps) that at the moment of each and every call to a system function the stack be aligned at 16bytes boundary. The only quick solution (for me at least) was to change ccall macro to do that. I know it's not a "nice" thing to do, even more it's a very dirty change - e.g. it uses 2 global variables to save stack and eax 3. Because of laziness (or whatever) I changed ccall to accept standard calls (w/o arguments) and also align the stack. So for better or worse, here is what I've done (using the latest fasm download, built on Linux machine, link edited with gcc on Mac) In fasm/fasm/source/libc/fasm.asm 1.Changed macro ccall to (warning, ugly code): Code: macro ccall proc,[arg] ; call CDECL procedure { common local size size = 0 if ~ arg eq forward size = size+4 common end if mov [stack_ccall],esp mov [save_eax],eax mov eax,esp ; sub eax,4 sub eax,size and eax,15 sub esp,eax mov eax,[save_eax] if ~ arg eq reverse pushd arg common end if call proc mov esp,[stack_ccall] } 2. added global variables needed for the above macro, at the end of fasm (where its other globals are): Code: stack_ccall dd ? save_eax dd ? 3. changed extrn to have an underline in front: extrn _gettimeofday and, of course ccall _gettimeofday,buffer,0 In fasm/fasm/source/libc/system.inc 1. Again, all extrn to start with underline [code] extrn _malloc extrn _free extrn _getenv extrn _fopen extrn _fclose extrn _fread extrn _fwrite extrn _fseek extrn _ftell extrn _time extrn _exit extrn '_write' as libc_write [code] Don't forget _write! When changing function names through the code be careful to also replace call with ccall when appropriate (IIRC only _exit needs that, and it could be neglected, MacOS allows simple ret instruction to cleanly terminate the program and pass whatever is in eax as return value) e.g. Assemble as usual - fasm fasm.asm Now for the funny part: 1. take the fasm.o object file to you mac (you could run objconv on linux, I think but... mac is needed anyway for the next step 2. apply objconv as follows: [code] Hawk-MB:libc hawk$ objconv -fmacho fasm.o fasm.mach.o Input file: fasm.o, output file: f.o Converting from ELF32 to Mach-O Little Endian32 0 Debug sections removed 0 Exception sections removed Hawk-MB:libc hawk$ [/code] 3. gcc to link (you could use ld but it's more complicated) gcc fasm.mach.o -o fasm And you have a working libc fasm on mac os (Hope I haven't forgot anything)
_________________ Always begining something |
|||||||||||
04 Apr 2008, 22:27 |
|
bitRAKE 04 Apr 2008, 23:40
Might want to atleast use something like this:
Code: macro ccall proc,[arg] ; call CDECL procedure { common local size size = 0 if ~ arg eq forward size = size+4 common end if push ebp mov ebp,esp sub esp,size and esp,-16 add esp,size if ~ arg eq reverse pushd arg common end if call proc leave } _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
04 Apr 2008, 23:40 |
|
hawk 05 Apr 2008, 06:58
bitRAKE,
Thanks for the improvement. You are right, in fact at some point I thought I should use a separate macro "extcall" or something like that, for system calls. However, after seeing that in fasm ccall is used only for system calls.. I took the easier path. |
|||
05 Apr 2008, 06:58 |
|
rugxulo 14 Apr 2008, 20:05
Has Tomasz read this thread lately? It should be made "sticky", IMO.
|
|||
14 Apr 2008, 20:05 |
|
turdus 26 Apr 2008, 14:50
Hawk: thank you very much for mac version of fasm! That's what I was looking for! And, I noticed that there's a predefine option, I don't know if it's your version's improvement, but about a year (or two) ago I was asking for this feature here in this forum, and I ended up by overwriting the fasm source. So, mac+predefine well done, thank you very much!!!
|
|||
26 Apr 2008, 14:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.