Subversion Repositories HelenOS-historic

Compare Revisions

No changes between revisions

Ignore whitespace Rev 719 → Rev 720

/kernel/branches/falloc_bad/tools/amd64/decpt.py
0,0 → 1,25
#!/usr/bin/env python
"""
Decode 64-bit address into components
"""
import sys
 
def main():
if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'):
print "%s 0x..." % sys.argv[0]
sys.exit(1)
address = int(sys.argv[1],16)
offset = address & 0xfff
ptl3 = (address >> 12) & 0x1ff
ptl2 = (address >> 21) & 0x1ff
ptl1 = (address >> 30) & 0x1ff
ptl0 = (address >> 39) & 0x1ff
print "Ptl0: %3d" % ptl0
print "Ptl1: %3d" % ptl1
print "Ptl2: %3d" % ptl2
print "Ptl3: %3d" % ptl3
print "Offset: 0x%x" % offset
 
if __name__ == '__main__':
main()
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/kernel/branches/falloc_bad/tools/amd64/gencontext.c
0,0 → 1,39
#include <stdio.h>
 
 
typedef long long __u64;
typedef __u64 ipl_t;
typedef __u64 __address;
 
#define __amd64_TYPES_H__
#include "../../arch/amd64/include/context.h"
 
#define FILENAME "../../arch/amd64/include/context_offset.h"
 
int main(void)
{
FILE *f;
struct context ctx;
struct context *pctx = &ctx;
 
f = fopen(FILENAME,"w");
if (!f) {
perror(FILENAME);
return 1;
}
 
fprintf(f, "/* This file is automatically generated by %s. */\n", __FILE__);
 
fprintf(f,"#define OFFSET_SP 0x%x\n",((int)&pctx->sp) - (int )pctx);
fprintf(f,"#define OFFSET_PC 0x%x\n",((int)&pctx->pc) - (int )pctx);
fprintf(f,"#define OFFSET_RBX 0x%x\n",((int)&pctx->rbx) - (int )pctx);
fprintf(f,"#define OFFSET_RBP 0x%x\n",((int)&pctx->rbp) - (int )pctx);
fprintf(f,"#define OFFSET_R12 0x%x\n",((int)&pctx->r12) - (int )pctx);
fprintf(f,"#define OFFSET_R13 0x%x\n",((int)&pctx->r13) - (int )pctx);
fprintf(f,"#define OFFSET_R14 0x%x\n",((int)&pctx->r14) - (int )pctx);
fprintf(f,"#define OFFSET_R15 0x%x\n",((int)&pctx->r15) - (int )pctx);
fprintf(f,"#define OFFSET_IPL 0x%x\n",((int)&pctx->ipl) - (int )pctx);
fclose(f);
 
return 0;
}