flat assembler
Message board for the users of flat assembler.
Index
> Main > push macro |
Author |
|
killasmurf86 31 Oct 2010, 16:10
Is it somehow possible to
Code: push macro_name macro_parameter I want to know if it's possible for macro to "return" value, that will be pushed? |
|||
31 Oct 2010, 16:10 |
|
killasmurf86 31 Oct 2010, 18:17
I need analogue to http://fxr.watson.org/fxr/source/sys/ioccom.h?v=FREEBSD8
So later I can use puch _IOW(g,n,t) for example Currently I work around this by inserting push in one of macros.... this works quite well, but code doesn't look so readable here's part of code, that reads vol from /dev/mixer on FreeBSD Code: SIZEOF_INT = 4 ; for 64bit arch should be 8 IOCPARM_SHIFT = 13 IOCPARM_MASK = (1 shl IOCPARM_SHIFT) - 1 macro IOCPARM_LEN x { (x shr 16) and IOCPARM_MASK } macro IOCBASECMD x { x and not (IOCPARM_MASK shl 16) } macro IOCGROUP x { (x shr 8) and 0xFF } IOC_VOID = 0x20000000 IOC_OUT = 0x40000000 IOC_IN = 0x80000000 IOC_INOUT = IOC_OUT or IOC_IN IOC_DIRMASK = IOC_VOID or IOC_OUT or IOC_IN macro _IOC inout, group, num, len { push inout or ((len and IOCPARM_MASK) shl 16) or (group shl 8) or num } macro _IO g, n { _IOC IOC_VOID, g, n, 0 } macro _IOWINT g, n { _IOC IOC_VOID, g, n, SIZEOF_INT } macro _IOR g, n, t { _IOC IOC_OUT, g, n, t } ; t must be sizeof macro _IOW g, n, t { _IOC IOC_IN, g, n, t } ; t must be sizeof macro _IORW g, n, t { _IOC IOC_INOUT, g, n, t } ; t must be sizeof macro MIXER_READ dev { _IOR 'M', dev, SIZEOF_INT } macro MIXER_WRITE dev { _IOW 'M', dev, SIZEOF_INT } ... push vol MIXER_READ SOUND_MIXER_VOLUME push eax push eax mov eax,SYS_IOCTL int 0x80 lea esp,[esp+4*4] jc error mov eax,[vol] SOUND_MIXER_VOLUME is constant (also calculated in source) |
|||
31 Oct 2010, 18:17 |
|
baldr 31 Oct 2010, 18:55
killasmurf86,
You're taking wrong measures against inexistent problems. That .H file doesn't define (almost) anything besides constants. |
|||
31 Oct 2010, 18:55 |
|
killasmurf86 31 Oct 2010, 20:12
I now....
But it's the way how it defines constants |
|||
31 Oct 2010, 20:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.