MentOS
0.8.0
The Mentoring Operating System
mentos
inc
klib
stack_helper.h
Go to the documentation of this file.
1
6
#pragma once
7
9
#define __ACCESS_PTR(type, ptr) (*(type *)(ptr))
11
#define __MOVE_PTR_DOWN(type, ptr) ((ptr) -= sizeof(type))
13
#define __MOVE_PTR_UP(type, ptr) ((ptr) += sizeof(type))
15
#define PUSH_VALUE_ON_STACK(ptr, value) (__ACCESS_PTR(__typeof__(value), __MOVE_PTR_DOWN(__typeof__(value), ptr)) = (value))
17
#define POP_VALUE_FROM_STACK(value, ptr) ({value = __ACCESS_PTR(__typeof__(value), ptr); __MOVE_PTR_UP(__typeof__(value), ptr); })
Generated by
1.9.1