Skip to content

Commit

Permalink
Refactor and remove libvm, working Intel Linux bootloader.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Rogers committed Mar 16, 2009
1 parent 85a2c78 commit 0d85441
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tools/bootloader/sysThread_Intel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Common Public License (CPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/cpl1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/

/*
* Architecture specific thread code
*/

#include "sys.h"

/**
* Transfer execution from C to Java for thread startup
*/
void bootThread (void *ip, void *tr, void *sp, void UNUSED *jtoc)
{
void *saved_ebp;
asm (
#ifndef __x86_64__
"mov %%ebp, %0 \n"
"mov %%esp, %%ebp \n"
"mov %3, %%esp \n"
"push %%ebp \n"
"call *%%eax \n"
"pop %%esp \n"
"mov %0, %%ebp \n"
#else
"mov %%rbp, %0 \n"
"mov %%rsp, %%rbp \n"
"mov %3, %%rsp \n"
"push %%rbp \n"
"call *%%rax \n"
"pop %%rsp \n"
"mov %0, %%rbp \n"
#endif
: "=m"(saved_ebp)
: "a"(ip), // EAX = Instruction Pointer
"S"(tr), // ESI = Thread Register
"r"(sp)
);
}
32 changes: 32 additions & 0 deletions tools/bootloader/sysThread_PowerPC.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Common Public License (CPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/cpl1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/

/*
* Architecture specific thread code
*/

/**
* Transfer execution from C to Java for thread startup
*/
void bootThread (void *pc, void *tr, void *sp, void UNUSED *jtoc)
{
asm ("mtlr %3\n"
"blr \n"
: /* outs */
: /* ins */
"JTOC"(jtoc),
"THREAD_REGISTER"(tr),
"FP"(sp),
"r"(pc)
);
}

0 comments on commit 0d85441

Please sign in to comment.