diff --git a/mach/i80/ncg/table b/mach/i80/ncg/table index 74c85f89e..783500195 100644 --- a/mach/i80/ncg/table +++ b/mach/i80/ncg/table @@ -2475,5 +2475,6 @@ with hlreg gen shld {label,".reghp"} pat trp -kills ALL -gen Call {label,".trp"} + with areg + kills ALL + gen Call {label,".trp"} diff --git a/plat/cpm/boot.s b/plat/cpm/boot.s index a1e99ed00..64f85fd2a 100644 --- a/plat/cpm/boot.s +++ b/plat/cpm/boot.s @@ -170,8 +170,7 @@ _cpm_cmdline = 0x0081 ! Some magic data. All EM systems need these. -.define .trppc, .ignmask, _errno -.comm .trppc, 2 +.define .ignmask, _errno .comm .ignmask, 2 .comm _errno, 2 @@ -184,11 +183,10 @@ envp: .space 2 ! envp array (always empty, must be after argv) ! These are used specifically by the i80 code generator. -.define .trapproc, .retadr, .retadr1 +.define .retadr, .retadr1 .define .bcreg, .areg .define .tmp1, .fra, block1, block2, block3 -.comm .trapproc, 2 .comm .retadr, 2 ! used to save return address .comm .retadr1, 2 ! reserve .comm .bcreg, 2 diff --git a/plat/cpm/libsys/_trap.s b/plat/cpm/libsys/_trap.s index bb541932f..cd561fa65 100644 --- a/plat/cpm/libsys/_trap.s +++ b/plat/cpm/libsys/_trap.s @@ -13,7 +13,8 @@ .define EUNIMPL ! Trap routine -! Expects trap number on stack. +! Expects trap number in A, and must be called directly from the code +! where execution should resume (for those traps which support it). ! Just returns if trap has to be ignored. ! Otherwise it calls a user-defined trap handler if provided. ! When no user-defined trap handler is provided or when the user-defined @@ -46,9 +47,6 @@ EUNIMPL = 63 ! unimplemented em-instruction called .trp: - pop h - xthl - push h ! trap number and return address exchanged mov a,l cpi 16 jnc 3f ! jump if trap cannot be ignored @@ -66,10 +64,12 @@ ret ! OGEN DICHT EN ... SPRING!!! 3: - lhld .trapproc ! user defined trap handler? +.define .trapproc +.trapproc = . + 1 + lxi h, 0 ! user defined trap handler held inline here mov a,l ora h - jz 1f ! jump if there was not + jz 1f ! jump if there was not xra a sta .trapproc ! .trapproc := 0 sta .trapproc+1 diff --git a/plat/cpm/libsys/make_trap.sh b/plat/cpm/libsys/make_trap.sh index 25562fa2a..1c09388ae 100755 --- a/plat/cpm/libsys/make_trap.sh +++ b/plat/cpm/libsys/make_trap.sh @@ -4,9 +4,7 @@ cat <