addressing

Address woes from Hacking: The Art of Exploitation [closed]

不问归期 提交于 2020-01-13 07:24:32
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I bought this book recently titled: Hacking: The Art of Exploitation (2nd Edition) and it's been bugging me so much lately. Anyway, with one of the examples, firstprog.c : #include <stdio.h> int main() { int i; for(i=0; i < 10; i++) { // Loop 10 times. printf("Hello, world!\n"); // put the string to the output.

Simpletron machine and indirect addressing

99封情书 提交于 2020-01-02 09:28:12
问题 I recently made the Simpletron assignment from the Deitel and Deitel textbook. The Simpletron machine language has only one addressing mode which is direct addressing. (That is, you have to specify the address you want to access in the operand part of the instruction.) So I think there is no way of computing an address at run time and access it. So doing something like this: [pseudo-c] int a[10]; ... int i = 0; while(a[i] > 100) { i++; } .. would require some self modifying code or expanding

Using references to access class objects C++

两盒软妹~` 提交于 2019-12-31 05:45:09
问题 This one has me stumped. What I'm trying to do is get a reference variable in a wrapper class to point to a struct object in the class it wraps so that any setting of variables in the struct from other classes that use the wrapper class, actually are set in the wrapped class not the wrappper class. To do this I tried to simply create a reference in the wrap class to the struct in the wrapped class like class CClassWrap { CClass::plot_type& PlotArgs; } and then init PlotArgs CClassWrap:

Why does 20 address space with on a 16 bit machine give access to 1 Megabyte and not 2 Megabytes?

走远了吗. 提交于 2019-12-19 09:59:39
问题 OK, this question sounds simple but I am taken by surprise. In the ancient days when 1 Megabyte was a huge amount of memory, Intel was trying to figure out how to use 16 bits to access 1 Megabyte of memory. They came up with the idea of using segment and offset address values to generate a 20 bit address. Now, 20 bits gives 2^20 = 1,048,576 locations that can be addressed. Now assuming that we access 1 byte per address location we get 1,048,576/(1024*1024) = 2^20/2^20 Megabytes = 1 Megabyte.

Why does 20 address space with on a 16 bit machine give access to 1 Megabyte and not 2 Megabytes?

让人想犯罪 __ 提交于 2019-12-19 09:59:11
问题 OK, this question sounds simple but I am taken by surprise. In the ancient days when 1 Megabyte was a huge amount of memory, Intel was trying to figure out how to use 16 bits to access 1 Megabyte of memory. They came up with the idea of using segment and offset address values to generate a 20 bit address. Now, 20 bits gives 2^20 = 1,048,576 locations that can be addressed. Now assuming that we access 1 byte per address location we get 1,048,576/(1024*1024) = 2^20/2^20 Megabytes = 1 Megabyte.

Why 32-bit processor can only address 4GiB of memory, even with large word size?

戏子无情 提交于 2019-12-11 11:51:55
问题 Until now I thought that a 32-bit processor can use 4 GiB of memory because 2 32 is 4 GiB, but this approach means processor have word size = 1 byte . So a process with 32-bit program counter can address 2 32 different memory words and hence we have 4 GiB. But if a processor has word size larger than 1 byte , which is the case with most of processors now days I believe ( My understanding is that word size is equal to the width of data bus, so a processor with 64-bit data bus must have a word

Change Shape color in a loop VBA PPT

孤街浪徒 提交于 2019-12-11 10:35:11
问题 I need to change Colors of certain Shapes in a slide, based on the criteria if the shape is an EndConnectedShape of certain Connectors (the connectors are selected based on some data in a .txt file, but the data input part works fine). Although it must be straightforward, the part where I try to get the Shape by its Name is still not working: Sub test() Dim oFSO As FileSystemObject Set oFSO = New FileSystemObject Dim oFS As TextStream Dim i, j As Long Dim filePath, smth As String filePath =

addressing in assembler

让人想犯罪 __ 提交于 2019-12-10 23:15:12
问题 There is something I can't digest. I'm learning some assembler and right now I'm at the chapter with addressing. I understand the concept of brackets for dereferencing, but somehow when I see the usage of it I just can't soak up the point of it. To be a little bit more exact here is where my confusion started: mov al, [L1] Here I suppose L1 as an example case is some kind of macro which is later substituted for a real address in the machine code, right? So what this instruction does is:

What is PC-relative addressing and how can I use it in MASM?

早过忘川 提交于 2019-12-10 18:03:02
问题 I'm following Jack Crenshaw's compiler tutorial (If you look at my profile, that's what all my questions are about lol) and it just got to the point where variables are introduced. He comments that the 68k requires everything to be "position-independent" which means it's "PC-relative". I get that PC is the program counter, and on x86 it's EIP. But he uses syntax like MOVE X(PC),D0 where X is a variable name. I've read a little ahead and it says nothing later about declaring a variable in

MATLAB: extract submatrix with logical indexing

馋奶兔 提交于 2019-12-06 23:29:58
问题 I'm looking for an elegant solution to this very simple problem in MATLAB. Suppose I have a matrix >> M = magic(5) M = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 and a logical variable of the form I = 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 If I try to retrieve the elements of M associated to 1 values in I , I get a column vector >> M(I) ans = 5 6 7 13 What would be the simplest way to obtain the matrix [5 7 ; 6 13] from this logical indexing? If I know the