Sponsored Content
Full Discussion: far pointer
Top Forums Programming far pointer Post 302144425 by porter on Thursday 8th of November 2007 04:13:33 AM
Old 11-08-2007
It's a historical anachronism from segmented architectures such as the 8086.

Back in the days of yore there was the 8080, this was an 8 bit processor with 16 bit address bus, hence 16 bit pointers.

Along came the 8086, in order to support some level of backward compatiblity it adopted a segmented architecture which let use use either 16 bit, 20 bit or 32 bit pointers depending on the day of the week. Where a pointer was a combination of 16 bit segment register and 16 bit near offset. This lead to the rise of tiny, small, medium, large and huge memory models with near, far and huge pointers.

Other architectures such as 68000 did not adopt this scheme and had what is called a flat memory model.

With the 80386 and true 32 bit mode, all pointers are 32 bit, but ironically are now really near pointers but 32 bit wide, the operating system hides the segments from you.
 

10 More Discussions You Might Find Interesting

1. Programming

pointer

void main() { int a={1,2,3,4,5,6,7,8,9,10}; int *p=a; int *q=&a; cout<<q-p+1<<endl; } The output is 10, how? if we give cout<<q it will print the address, value won't print.... if we give cout<<p it will print the address, value won't print.... p has the base addr; q... (1 Reply)
Discussion started by: sarwan
1 Replies

2. Programming

why we never delete a pointer twice

can u tell me the reson that why we should not delete a pointer twice.? if we delete ponter twice then what happen and why this happen Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

3. Programming

pointer problem

could any one tell why the following is showing segmentation fault while using **ptr but working fine using **a #include<stdio.h> ... (1 Reply)
Discussion started by: useless79
1 Replies

4. Programming

Need help in character pointer

Hi, I am trying to divide my input to different type of out puts for some other use. ex: logical_name : jkl00001 expected out put : model=jkl and num=00001 here is the code i actually written /*******************************************************************/ void... (11 Replies)
Discussion started by: jagan_kalluri
11 Replies

5. Programming

pass a pointer-to-pointer, or return a pointer?

If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it: (1) one is to pass a pointer-to-pointer parameter, like: int my_malloc(int size, char **pmem) { *pmem=(char *)malloc(size); if(*pmem==NULL)... (11 Replies)
Discussion started by: aaronwong
11 Replies

6. Programming

matrix pointer

Can anyone tell me what the following statements do? float (*tab); tab=(float (*)) calloc(MAXCLASS, (MAXCLASS+1)*sizeof(float)); (3 Replies)
Discussion started by: littleboyblu
3 Replies

7. Programming

C dynamic pointer

Hi, Can anyone tell me how i can declare and allocate dynamically an array of pointers to structured type?? Is declaration something like this:? struct_name ** array; (1 Reply)
Discussion started by: littleboyblu
1 Replies

8. Programming

Pointer to pointers

Hi guys, I'm trying to understand pointers in C and made a simple example and I've problems with It. Can someone help? #include <stdio.h> #include <stdlib.h> #include <assert.h> int f1(char **str_); int main(int argc, char **argv) { char *str = NULL; f1(&str); ... (3 Replies)
Discussion started by: pharaoh
3 Replies

9. Programming

Pointer and address

This code is to print out the program name and arguments list one by one: 1 #include<stdio.h> 2 3 void main(int argc, char *argv) 4 { 5 int iCount = 0; 6 while (iCount < argc) { 7 printf("argc:%d\t%s\n",iCount, argv); 8 ... (14 Replies)
Discussion started by: yifangt
14 Replies

10. Programming

Pointer confusion

Here are two programs that pass a pointer to a variable but behave differently. Shouldnt the i in second program be 0 after the function call? #include<stdio.h> void changeI(int *i) { *i = 10; } int main(void) { int i=5; printf("%d before\n", i); changeI(&i); printf("%d... (1 Reply)
Discussion started by: dragonpoint
1 Replies
I386_VM86(2)						   BSD/i386 System Calls Manual 					      I386_VM86(2)

NAME
i386_vm86 -- set virtual 8086 processor registers and mode LIBRARY
i386 Architecture Library (libi386, -li386) SYNOPSIS
#include <sys/types.h> #include <signal.h> #include <machine/mcontext.h> #include <machine/segments.h> #include <machine/sysarch.h> #include <machine/vm86.h> int i386_vm86(struct vm86_struct *vmcp); DESCRIPTION
i386_vm86() will set the process into virtual 8086 mode using the registers and selectors specified by the context pointed to by vmcp. The processor registers are set from vmcp->substr.regs, and the emulated processor type from vmcp->substr.ss_cpu_type. The kernel keeps a pointer to the context, and uses the tables stored at vmcp->int_byuser and vmcp->int21_byuser for fast virtual interrupt handling. If the n th bit is clear in the first of these arrays, then the kernel may directly emulate the real-mode x86 INT n instruction handling. If the n th bit is set, then the process is delivered a signal when an INT instruction is executed. Since MS-DOS puts many DOS functions onto interrupt 21, it is handled specially: the k th bit in the vmcp->int21_byuser array is checked when INT 21 is requested and the ah register is k. RETURN VALUES
This routine does not normally return: 32-bit mode will be restored by the delivery of a signal to the process. In case of an error in set- ting the VM86 mode, a value of -1 is returned and the global variable errno is set to indicate the error. ERRORS
i386_vm86() will fail if: [EFAULT] The state at vmcp was not readable to the user process. REFERENCES
i386 Microprocessor Programmer's Reference Manual, Intel BSD
February 20, 1996 BSD
All times are GMT -4. The time now is 11:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy