forked from KolibriOS/kolibrios
Update kernel's proc32.inc from fasm source
* Resulting kernel.bin did not change. * This file had KolibriOS copyright header which I did not preserve because we use it unchanged as shipped with fasm. git-svn-id: svn://kolibrios.org@7294 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5220da9d33
commit
d00e5c3855
@ -1,12 +1,3 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; ;;
|
|
||||||
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
|
|
||||||
;; Distributed under terms of the GNU General Public License ;;
|
|
||||||
;; ;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
$Revision$
|
|
||||||
|
|
||||||
|
|
||||||
; Macroinstructions for defining and calling procedures
|
; Macroinstructions for defining and calling procedures
|
||||||
|
|
||||||
@ -64,11 +55,15 @@ macro proc [args] ; define procedure
|
|||||||
prologue@proc equ prologuedef
|
prologue@proc equ prologuedef
|
||||||
|
|
||||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||||
{ if parmbytes | localbytes
|
{ local loc
|
||||||
|
loc = (localbytes+3) and (not 3)
|
||||||
|
parmbase@proc equ ebp+8
|
||||||
|
localbase@proc equ ebp-loc
|
||||||
|
if parmbytes | localbytes
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
if localbytes
|
if localbytes
|
||||||
sub esp, localbytes
|
sub esp, loc
|
||||||
end if
|
end if
|
||||||
end if
|
end if
|
||||||
irps reg, reglist \{ push reg \} }
|
irps reg, reglist \{ push reg \} }
|
||||||
@ -80,12 +75,14 @@ macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
|||||||
if parmbytes | localbytes
|
if parmbytes | localbytes
|
||||||
leave
|
leave
|
||||||
end if
|
end if
|
||||||
if (flag and 10000b) | (parmbytes=0)
|
if flag and 10000b
|
||||||
retn
|
retn
|
||||||
else
|
else
|
||||||
retn parmbytes
|
retn parmbytes
|
||||||
end if }
|
end if }
|
||||||
|
|
||||||
|
close@proc equ
|
||||||
|
|
||||||
macro define@proc name,statement
|
macro define@proc name,statement
|
||||||
{ local params,flag,regs,parmbytes,localbytes,current
|
{ local params,flag,regs,parmbytes,localbytes,current
|
||||||
if used name
|
if used name
|
||||||
@ -100,24 +97,25 @@ macro define@proc name,statement
|
|||||||
flag = 10001b \}
|
flag = 10001b \}
|
||||||
match =params, params \{ params equ statement
|
match =params, params \{ params equ statement
|
||||||
flag = 0 \}
|
flag = 0 \}
|
||||||
virtual at ebp+8
|
|
||||||
match =uses reglist=,args, params \{ regs equ reglist
|
match =uses reglist=,args, params \{ regs equ reglist
|
||||||
params equ args \}
|
params equ args \}
|
||||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||||
params equ \}
|
params equ \}
|
||||||
match =regs, regs \{ regs equ \}
|
match =regs, regs \{ regs equ \}
|
||||||
|
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||||
|
virtual at parmbase@proc
|
||||||
match =,args, params \{ defargs@proc args \}
|
match =,args, params \{ defargs@proc args \}
|
||||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||||
parmbytes = $ - (ebp+8)
|
parmbytes = $-(parmbase@proc)
|
||||||
end virtual
|
end virtual
|
||||||
name # % = parmbytes/4
|
name # % = parmbytes/4
|
||||||
all@vars equ
|
all@vars equ
|
||||||
current = 0
|
current = 0
|
||||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
|
||||||
macro locals
|
macro locals
|
||||||
\{ virtual at ebp-localbytes+current
|
\{ virtual at localbase@proc+current
|
||||||
macro label . \\{ deflocal@proc .,:, \\}
|
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
|
||||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||||
|
struc du [val] \\{ \common deflocal@proc .,du,val \\}
|
||||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||||
@ -131,16 +129,16 @@ macro define@proc name,statement
|
|||||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||||
macro endl
|
macro endl
|
||||||
\{ purge label
|
\{ purge label
|
||||||
restruc db,dw,dp,dd,dt,dq
|
restruc db,du,dw,dp,dd,dt,dq
|
||||||
restruc rb,rw,rp,rd,rt,rq
|
restruc rb,rw,rp,rd,rt,rq
|
||||||
restruc byte,word,dword,pword,tword,qword
|
current = $-(localbase@proc)
|
||||||
current = $-(ebp-localbytes)
|
|
||||||
end virtual \}
|
end virtual \}
|
||||||
macro ret operand
|
macro ret operand
|
||||||
\{ match any, operand \\{ retn operand \\}
|
\{ match any, operand \\{ retn operand \\}
|
||||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> \\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
macro finish@proc
|
||||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
\{ localbytes = current
|
||||||
|
match close:reglist, close@proc:<regs> \\{ close name,flag,parmbytes,localbytes,reglist \\}
|
||||||
end if \} }
|
end if \} }
|
||||||
|
|
||||||
macro defargs@proc [arg]
|
macro defargs@proc [arg]
|
||||||
@ -172,6 +170,8 @@ macro defargs@proc [arg]
|
|||||||
common
|
common
|
||||||
end if }
|
end if }
|
||||||
|
|
||||||
|
macro deflocal@proc name,def,[val] { name def val }
|
||||||
|
|
||||||
macro deflocal@proc name,def,[val]
|
macro deflocal@proc name,def,[val]
|
||||||
{ common
|
{ common
|
||||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||||
@ -180,7 +180,9 @@ macro deflocal@proc name,def,[val]
|
|||||||
local ..var,..tmp
|
local ..var,..tmp
|
||||||
..var def val
|
..var def val
|
||||||
match =?, val \{ ..tmp equ \}
|
match =?, val \{ ..tmp equ \}
|
||||||
match any =dup (=?), val \{ ..tmp equ \}
|
match any =?, val \{ ..tmp equ \}
|
||||||
|
match any (=?), val \{ ..tmp equ \}
|
||||||
|
match =label, def \{ ..tmp equ \}
|
||||||
match tmp : value, ..tmp : val
|
match tmp : value, ..tmp : val
|
||||||
\{ tmp: end virtual
|
\{ tmp: end virtual
|
||||||
initlocal@proc ..var,def value
|
initlocal@proc ..var,def value
|
||||||
@ -188,6 +190,8 @@ macro deflocal@proc name,def,[val]
|
|||||||
common
|
common
|
||||||
match first rest, ..var, \{ name equ first \} }
|
match first rest, ..var, \{ name equ first \} }
|
||||||
|
|
||||||
|
struc label type { label . type }
|
||||||
|
|
||||||
macro initlocal@proc name,def
|
macro initlocal@proc name,def
|
||||||
{ virtual at name
|
{ virtual at name
|
||||||
def
|
def
|
||||||
|
Loading…
Reference in New Issue
Block a user