1 /* Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3 This file is part of GDB.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "amd64-tdep.h"
22 #include "solib-target.h"
25 /* The registers used to pass integer arguments during a function call. */
26 static int amd64_windows_dummy_call_integer_regs[] =
28 AMD64_RCX_REGNUM, /* %rcx */
29 AMD64_RDX_REGNUM, /* %rdx */
34 /* Implement the "classify" method in the gdbarch_tdep structure
38 amd64_windows_classify (struct type *type, enum amd64_reg_class class[2])
40 switch (TYPE_CODE (type))
43 /* Arrays are always passed by memory. */
44 class[0] = class[1] = AMD64_MEMORY;
47 case TYPE_CODE_STRUCT:
49 /* Struct/Union types whose size is 1, 2, 4, or 8 bytes
50 are passed as if they were integers of the same size.
51 Types of different sizes are passed by memory. */
52 if (TYPE_LENGTH (type) == 1
53 || TYPE_LENGTH (type) == 2
54 || TYPE_LENGTH (type) == 4
55 || TYPE_LENGTH (type) == 8)
57 class[0] = AMD64_INTEGER;
58 class[1] = AMD64_NO_CLASS;
61 class[0] = class[1] = AMD64_MEMORY;
65 /* For all the other types, the conventions are the same as
66 with the System V ABI. */
67 amd64_classify (type, class);
72 amd64_windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
74 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
76 amd64_init_abi (info, gdbarch);
78 /* On Windows, "long"s are only 32bit. */
79 set_gdbarch_long_bit (gdbarch, 32);
82 tdep->call_dummy_num_integer_regs =
83 ARRAY_SIZE (amd64_windows_dummy_call_integer_regs);
84 tdep->call_dummy_integer_regs = amd64_windows_dummy_call_integer_regs;
85 tdep->classify = amd64_windows_classify;
86 tdep->memory_args_by_pointer = 1;
88 set_solib_ops (gdbarch, &solib_target_so_ops);
92 _initialize_amd64_windows_tdep (void)
94 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64, GDB_OSABI_CYGWIN,
95 amd64_windows_init_abi);