Annotation of qemu/roms/openbios/include/kernel/stack.h, revision 1.1.1.1

1.1       root        1: /* stack.h
                      2:  * tag: stack and stack access functions
                      3:  *
                      4:  * Copyright (C) 2003 Patrick Mauritz, Stefan Reinauer
                      5:  *
                      6:  * See the file "COPYING" for further information about
                      7:  * the copyright and warranty status of this work.
                      8:  */
                      9: 
                     10: #ifndef __STACK_H
                     11: #define __STACK_H
                     12: 
                     13: #define dstacksize 512
                     14: extern int  dstackcnt;
                     15: extern cell dstack[dstacksize];
                     16: 
                     17: #define rstacksize 512
                     18: extern int  rstackcnt;
                     19: extern cell rstack[rstacksize];
                     20: 
                     21: extern int dbgrstackcnt;
                     22: 
                     23: //typedef struct opaque_xt *xt_t;
                     24: //typedef struct opaque_ihandle *ihandle_t;
                     25: //typedef struct opaque_phandle *phandle_t;
                     26: 
                     27: typedef ucell xt_t;
                     28: typedef ucell ihandle_t;
                     29: typedef ucell phandle_t;
                     30: 
                     31: 
                     32: 
                     33: #ifdef NATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH
                     34: 
                     35: static inline ucell pointer2cell(const void* x)
                     36: {
                     37:     return (ucell)(uintptr_t)x;
                     38: }
                     39: 
                     40: static inline void* cell2pointer(ucell x)
                     41: {
                     42:     return (void*)(uintptr_t)x;
                     43: }
                     44: 
                     45: #endif
                     46: 
                     47: static inline void PUSH(ucell value) {
                     48:        dstack[++dstackcnt] = (value);
                     49: }
                     50: static inline void PUSH_xt( xt_t xt ) { PUSH( (ucell)xt ); }
                     51: static inline void PUSH_ih( ihandle_t ih ) { PUSH( (ucell)ih ); }
                     52: static inline void PUSH_ph( phandle_t ph ) { PUSH( (ucell)ph ); }
                     53: 
                     54: static inline ucell POP(void) {
                     55:        return (ucell) dstack[dstackcnt--];
                     56: }
                     57: static inline xt_t POP_xt( void ) { return (xt_t)POP(); }
                     58: static inline ihandle_t POP_ih( void ) { return (ihandle_t)POP(); }
                     59: static inline phandle_t POP_ph( void ) { return (phandle_t)POP(); }
                     60: 
                     61: static inline void DROP(void) {
                     62:        dstackcnt--;
                     63: }
                     64: 
                     65: static inline void DDROP(void) {
                     66:        dstackcnt -= 2;
                     67: }
                     68: 
                     69: static inline void DPUSH(ducell value) {
                     70: #ifdef NEED_FAKE_INT128_T
                     71:        dstack[++dstackcnt] = (cell) value.lo;
                     72:        dstack[++dstackcnt] = (cell) value.hi;
                     73: #else
                     74:        dstack[++dstackcnt] = (cell) value;
                     75:        dstack[++dstackcnt] = (cell) (value >> bitspercell);
                     76: #endif
                     77: }
                     78: 
                     79: static inline ducell DPOP(void) {
                     80: #ifdef NEED_FAKE_INT128_T
                     81:        ducell du;
                     82:        du.hi = (ucell) dstack[dstackcnt--];
                     83:        du.lo = (ucell) dstack[dstackcnt--];
                     84:        return du;
                     85: #else
                     86:        ducell du;
                     87:         du = ((ducell)(ucell) dstack[dstackcnt--]) << bitspercell;
                     88:        du |= (ucell) dstack[dstackcnt--];
                     89:        return du;
                     90: #endif
                     91: }
                     92: 
                     93: static inline ucell GETTOS(void) {
                     94:        return dstack[dstackcnt];
                     95: }
                     96: 
                     97: #define GETITEM(number) (dstack[dstackcnt - number])
                     98: static inline void PUSHR(ucell value) {
                     99:        rstack[++rstackcnt] = (value);
                    100: }
                    101: 
                    102: static inline ucell POPR(void) {
                    103:        return (ucell) rstack[rstackcnt--];
                    104: }
                    105: static inline ucell GETTORS(void) {
                    106:        return rstack[rstackcnt];
                    107: }
                    108: 
                    109: 
                    110: #if defined(DEBUG_DSTACK) || defined(FCOMPILER)
                    111: void printdstack(void);
                    112: #endif
                    113: #if defined(DEBUG_RSTACK) || defined(FCOMPILER)
                    114: void printrstack(void);
                    115: #endif
                    116: 
                    117: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.