. service tells you which device it couldn't stat
[minix3.git] / lib / ack / libm2 / load.c
blob3ec6321b263d7d9885990220006fa86af953fd2a
1 /*
2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
4 */
6 /*
7 Module: get value on stack, byte by byte
8 Author: Ceriel J.H. Jacobs
9 Version: $Header$
12 #include <m2_traps.h>
14 #ifndef EM_WSIZE
15 #define EM_WSIZE _EM_WSIZE
16 #define EM_PSIZE _EM_PSIZE
17 #endif
19 #if EM_WSIZE==EM_PSIZE
20 typedef unsigned pcnt;
21 #else
22 typedef long pcnt;
23 #endif
25 load(siz, addr, p)
26 register char *addr;
27 register pcnt siz;
29 /* Make sure, that a value with a size that could have been
30 handled by the LOI instruction ends up at the same place,
31 where it would, were the LOI instruction used.
33 register char *q = (char *) &p;
34 char t[4];
36 if (siz < EM_WSIZE && EM_WSIZE % siz == 0) {
37 /* as long as EM_WSIZE <= 4 ... */
38 if (siz != 2) TRP(M2_INTERNAL); /* internal error */
39 q = &t[0];
41 while (siz--) *q++ = *addr++;
42 if (q - t == 2) {
43 *((unsigned *)(&p)) = *((unsigned short *) (&t[0]));