Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(894)

Side by Side Diff: src/arm/simulator-arm.cc

Issue 568029: Add support for ldrd/strd from Kun Zhang (zhangk@codeaurora.org), Code Aurora (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/arm/codegen-arm.cc ('K') | « src/arm/simulator-arm.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 554
555 555
556 // Get the register from the architecture state. This function does handle 556 // Get the register from the architecture state. This function does handle
557 // the special case of accessing the PC register. 557 // the special case of accessing the PC register.
558 int32_t Simulator::get_register(int reg) const { 558 int32_t Simulator::get_register(int reg) const {
559 ASSERT((reg >= 0) && (reg < num_registers)); 559 ASSERT((reg >= 0) && (reg < num_registers));
560 return registers_[reg] + ((reg == pc) ? Instr::kPCReadOffset : 0); 560 return registers_[reg] + ((reg == pc) ? Instr::kPCReadOffset : 0);
561 } 561 }
562 562
563 563
564 void Simulator::set_dw_register(int dreg, const int* dbl) {
565 ASSERT((dreg >= 0) && (dreg < num_d_registers));
566 registers_[dreg] = dbl[0];
567 registers_[dreg + 1] = dbl[1];
568 }
569
570
564 // Raw access to the PC register. 571 // Raw access to the PC register.
565 void Simulator::set_pc(int32_t value) { 572 void Simulator::set_pc(int32_t value) {
566 pc_modified_ = true; 573 pc_modified_ = true;
567 registers_[pc] = value; 574 registers_[pc] = value;
568 } 575 }
569 576
570 577
571 // Raw access to the PC register without the special adjustment when reading. 578 // Raw access to the PC register without the special adjustment when reading.
572 int32_t Simulator::get_pc() const { 579 int32_t Simulator::get_pc() const {
573 return registers_[pc]; 580 return registers_[pc];
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 *ptr = value; 796 *ptr = value;
790 } 797 }
791 798
792 799
793 void Simulator::WriteB(int32_t addr, int8_t value) { 800 void Simulator::WriteB(int32_t addr, int8_t value) {
794 int8_t* ptr = reinterpret_cast<int8_t*>(addr); 801 int8_t* ptr = reinterpret_cast<int8_t*>(addr);
795 *ptr = value; 802 *ptr = value;
796 } 803 }
797 804
798 805
806 int* Simulator::ReadDW(int32_t addr) {
Erik Corry 2010/05/04 07:06:13 Please use int32_t for things like this where the
zhangk 2010/05/07 05:32:14 On 2010/05/04 07:06:13, Erik Corry wrote: Done.
807 int *ptr = reinterpret_cast<int *>(addr);
Erik Corry 2010/05/04 07:06:13 int *ptr -> int* ptr
zhangk 2010/05/07 05:32:14 On 2010/05/04 07:06:13, Erik Corry wrote: Done.
808 return ptr;
809 }
810
811
812 void Simulator::WriteDW(int32_t addr, int32_t value1, int32_t value2) {
813 int32_t *ptr = reinterpret_cast<int32_t*>(addr);
Erik Corry 2010/05/04 07:06:13 Asterisk placement.
zhangk 2010/05/07 05:32:14 On 2010/05/04 07:06:13, Erik Corry wrote: Done.
814 *ptr++ = value1;
815 *ptr = value2;
816 return;
817 }
818
819
799 // Returns the limit of the stack area to enable checking for stack overflows. 820 // Returns the limit of the stack area to enable checking for stack overflows.
800 uintptr_t Simulator::StackLimit() const { 821 uintptr_t Simulator::StackLimit() const {
801 // Leave a safety margin of 256 bytes to prevent overrunning the stack when 822 // Leave a safety margin of 256 bytes to prevent overrunning the stack when
802 // pushing values. 823 // pushing values.
803 return reinterpret_cast<uintptr_t>(stack_) + 256; 824 return reinterpret_cast<uintptr_t>(stack_) + 256;
804 } 825 }
805 826
806 827
807 // Unsupported instructions use Format to print an error and stop execution. 828 // Unsupported instructions use Format to print an error and stop execution.
808 void Simulator::Format(Instr* instr, const char* format) { 829 void Simulator::Format(Instr* instr, const char* format) {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 } 1422 }
1402 break; 1423 break;
1403 } 1424 }
1404 default: { 1425 default: {
1405 // The PU field is a 2-bit field. 1426 // The PU field is a 2-bit field.
1406 UNREACHABLE(); 1427 UNREACHABLE();
1407 break; 1428 break;
1408 } 1429 }
1409 } 1430 }
1410 } 1431 }
1411 if (instr->HasH()) { 1432 if (((instr->Bits(7, 4) & 0xd) == 0xd) && (instr->Bit(20) == 0)) {
1433 if (instr->HasH()) {
1434 // strd
Erik Corry 2010/05/04 07:06:13 Please check that rd specifies an even-numbered re
zhangk 2010/05/07 05:32:14 On 2010/05/04 07:06:13, Erik Corry wrote: Done.
1435 int32_t value1 = get_register(rd);
1436 int32_t value2 = get_register(rd+1);
1437 WriteDW(addr, value1, value2);
1438 } else {
1439 // ldrd
1440 int* rn_data = ReadDW(addr);
1441 set_dw_register(rd, rn_data);
1442 }
1443 } else if (instr->HasH()) {
1412 if (instr->HasSign()) { 1444 if (instr->HasSign()) {
1413 if (instr->HasL()) { 1445 if (instr->HasL()) {
1414 int16_t val = ReadH(addr, instr); 1446 int16_t val = ReadH(addr, instr);
1415 set_register(rd, val); 1447 set_register(rd, val);
1416 } else { 1448 } else {
1417 int16_t val = get_register(rd); 1449 int16_t val = get_register(rd);
1418 WriteH(addr, val, instr); 1450 WriteH(addr, val, instr);
1419 } 1451 }
1420 } else { 1452 } else {
1421 if (instr->HasL()) { 1453 if (instr->HasL()) {
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp); 2318 uintptr_t* stack_slot = reinterpret_cast<uintptr_t*>(current_sp);
2287 uintptr_t address = *stack_slot; 2319 uintptr_t address = *stack_slot;
2288 set_register(sp, current_sp + sizeof(uintptr_t)); 2320 set_register(sp, current_sp + sizeof(uintptr_t));
2289 return address; 2321 return address;
2290 } 2322 }
2291 2323
2292 2324
2293 } } // namespace assembler::arm 2325 } } // namespace assembler::arm
2294 2326
2295 #endif // !defined(__arm__) 2327 #endif // !defined(__arm__)
OLDNEW
« src/arm/codegen-arm.cc ('K') | « src/arm/simulator-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698