|
|
1.1 root 1: /*
2: * nf_asm.s - GCC NatFeats ASM detection code
3: *
4: * Copyright (c) 2014 by Eero Tamminen
5: *
6: * Mostly based on code from EmuTOS,
7: * Copyright (c) 2001-2013 by the EmuTOS development team
8: *
9: * This file is distributed under the GPL, version 2 or at your
10: * option any later version.
11: *
12: * TODO: test this
13: */
14:
15: /*
16: * public interface
17: */
18: .globl _nf_id
19: .globl _nf_call
20: .globl _detect_nf
21:
22: /* illegal exception vector */
23: .equ vec_illegal, 0x10
24:
25: /*
26: * code
27: */
28: .text
29:
30: /*
31: * NatFeats test
32: *
33: * Needs to be called from Supervisor mode,
34: * otherwise exception handler change bombs
35: */
36: _detect_nf:
37: clr.l d0 /* assume no NatFeats available */
38: move.l sp,a1
39: move.l vec_illegal,a0
40: move.l #fail_nf,vec_illegal
41: pea nf_version_name
42: sub.l #4,sp
43: #ifdef __mcoldfire__
44: #error Conflict with instruction mvs.b d0,d1
45: #else
46: .dc.w 0x7300 /* Jump to NATFEAT_ID */
47: #endif
48: tst.l d0
49: beq.s fail_nf
50: moveq #1,d0 /* NatFeats detected */
51:
52: fail_nf:
53: move.l a1,sp
54: move.l a0,vec_illegal
55:
56: rts
57:
58: nf_version_name:
59: .ascii "NF_VERSION\0"
60: .even
61:
62: /*
63: * map native features to NF ID
64: */
65: _nf_id:
66: .dc.w 0x7300 /* Conflict with ColdFire instruction mvs.b d0,d1 */
67: rts
68:
69: /*
70: * call native feature by its ID
71: */
72: _nf_call:
73: .dc.w 0x7301 /* Conflict with ColdFire instruction mvs.b d1,d1 */
74: rts
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.