Rev | Line | |
---|
[9] | 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 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
| 7 | Module: store values from stack, byte by byte
|
---|
| 8 | Author: Ceriel J.H. Jacobs
|
---|
| 9 | Version: $Header: /cvsup/minix/src/lib/ack/libm2/store.c,v 1.1 2005/10/10 15:27:46 beng Exp $
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | #include <m2_traps.h>
|
---|
| 13 |
|
---|
| 14 | #ifndef EM_WSIZE
|
---|
| 15 | #define EM_WSIZE _EM_WSIZE
|
---|
| 16 | #define EM_PSIZE _EM_PSIZE
|
---|
| 17 | #endif
|
---|
| 18 |
|
---|
| 19 | #if EM_WSIZE==EM_PSIZE
|
---|
| 20 | typedef unsigned pcnt;
|
---|
| 21 | #else
|
---|
| 22 | typedef long pcnt;
|
---|
| 23 | #endif
|
---|
| 24 |
|
---|
| 25 | store(siz, addr, p)
|
---|
| 26 | register char *addr;
|
---|
| 27 | register pcnt siz;
|
---|
| 28 | {
|
---|
| 29 | /* Make sure, that a value with a size that could have been
|
---|
| 30 | handled by the LOI instruction is handled as if it was
|
---|
| 31 | loaded with the LOI instruction.
|
---|
| 32 | */
|
---|
| 33 | register char *q = (char *) &p;
|
---|
| 34 | char t[4];
|
---|
| 35 |
|
---|
| 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 | *((unsigned short *) (&t[0])) = *((unsigned *) q);
|
---|
| 40 | q = &t[0];
|
---|
| 41 | }
|
---|
| 42 | while (siz--) *addr++ = *q++;
|
---|
| 43 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.